mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
This patchset adds: - configure.mac now looks for qmake, backs up xcode project, uses xca.pro to generate a new one, generates a different local.h - mac-package.sh generates a standalone .app bundle for distribution using deployqt from trolltech labs, packages up manual, COPYRIGHT, etc into a .dmg - mac packaging niceties in the qmake project - mac icon file - usability fixes for OS X: - look for user configured oids and such in ~/Library/Preferences/xca if it exists - look for original ones in app bundle/Contents/Resources (it tried to do this before...) - more robust code for getting bundle location (less likely to be broken by Apple in OS revisions) - start browsing for files in ~/Documents - fix wildcards on mac so files without extensions will be opened - fix save behavior for .xdb files so that it's hard to get one that doesn't end in .xdb, as this causes difficulty w/Qt Notes: - one of the compilation fixes was in the new revocation data function that replaced the old macros... I didn't have time to verify that my fix doesn't break when used with 0.9.8. - QStringToAsn1() is clearly incorrect but I haven't yet determined what callers expect, so I just called it out in a comment and did not yet fix it - I added some code that I haven't tested on Windows because I thought it might be a nice function to have there too. I have not added anything to call that function, however, since I don't currently have a machine I can test on :). The code is clearly marked in comments.
166 lines
2.9 KiB
C++
166 lines
2.9 KiB
C++
/* vi: set sw=4 ts=4:
|
|
*
|
|
* Copyright (C) 2001 - 2007 Christian Hohnstaedt.
|
|
*
|
|
* All rights reserved.
|
|
*/
|
|
|
|
|
|
#include "load_obj.h"
|
|
#include "pki_x509.h"
|
|
#include "pki_key.h"
|
|
#include "pki_x509req.h"
|
|
#include "pki_pkcs7.h"
|
|
#include "pki_pkcs12.h"
|
|
#include "pki_multi.h"
|
|
#include "widgets/MainWindow.h"
|
|
|
|
load_base::load_base()
|
|
{
|
|
#if defined(Q_WS_MAC)
|
|
filter = QObject::tr("All files ( * )");
|
|
#else
|
|
filter = QObject::tr("All files ( *.* )");
|
|
#endif
|
|
caption = "";
|
|
}
|
|
|
|
pki_base *load_base::loadItem(QString s)
|
|
{
|
|
pki_base *pki = newItem();
|
|
if (!pki)
|
|
return NULL;
|
|
try {
|
|
pki->fload(s);
|
|
}
|
|
catch (errorEx &err){
|
|
delete pki;
|
|
throw err;
|
|
}
|
|
return pki;
|
|
}
|
|
|
|
pki_base * load_base::newItem()
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
load_base::~load_base()
|
|
{
|
|
}
|
|
|
|
/* Keys */
|
|
load_key::load_key()
|
|
:load_base()
|
|
{
|
|
filter = QObject::tr("PKI Keys ( *.pem *.der *.key );;"
|
|
"PKCS#8 Keys ( *.p8 *.pk8 );;") + filter;
|
|
caption = QObject::tr("Import RSA key");
|
|
}
|
|
|
|
pki_base * load_key::newItem()
|
|
{
|
|
return new pki_key();
|
|
}
|
|
|
|
/* Requests */
|
|
load_req::load_req()
|
|
:load_base()
|
|
{
|
|
filter = QObject::tr("PKCS#10 CSR ( *.pem *.der *.csr );;"
|
|
"Netscape Request ( *.spkac *.spc );;") + filter;
|
|
caption = QObject::tr("Import Request");
|
|
}
|
|
|
|
pki_base * load_req::newItem()
|
|
{
|
|
return new pki_x509req();
|
|
}
|
|
|
|
/* Certificates */
|
|
load_cert::load_cert()
|
|
:load_base()
|
|
{
|
|
filter = QObject::tr("Certificates ( *.pem *.der *.crt *.cer );;") + filter;
|
|
caption = QObject::tr("Import X.509 Certificate");
|
|
}
|
|
|
|
pki_base * load_cert::newItem()
|
|
{
|
|
return new pki_x509();
|
|
}
|
|
|
|
/* PKCS#7 Certificates */
|
|
load_pkcs7::load_pkcs7()
|
|
:load_base()
|
|
{
|
|
filter = QObject::tr("PKCS#7 data ( *.p7s *.p7m *.p7b );;") + filter;
|
|
caption = QObject::tr("Import PKCS#7 Certificates");
|
|
}
|
|
|
|
pki_base * load_pkcs7::newItem()
|
|
{
|
|
return new pki_pkcs7();
|
|
}
|
|
|
|
/* PKCS#12 Certificates */
|
|
load_pkcs12::load_pkcs12()
|
|
:load_base()
|
|
{
|
|
filter = QObject::tr("PKCS#12 Certificates ( *.p12 *.pfx );;") + filter;
|
|
caption = QObject::tr("Import PKCS#12 Private Certificate");
|
|
}
|
|
|
|
pki_base * load_pkcs12::loadItem(QString s)
|
|
{
|
|
pki_base *p12 = new pki_pkcs12(s, MainWindow::passRead);
|
|
return p12;
|
|
}
|
|
|
|
/* Templates */
|
|
load_temp::load_temp()
|
|
:load_base()
|
|
{
|
|
filter = QObject::tr("XCA templates ( *.xca );;") + filter;
|
|
caption = QObject::tr("Import XCA Templates");
|
|
}
|
|
|
|
pki_base * load_temp::newItem()
|
|
{
|
|
return new pki_temp();
|
|
}
|
|
|
|
/* CRLs */
|
|
load_crl::load_crl()
|
|
:load_base()
|
|
{
|
|
filter = QObject::tr("Revocation lists ( *.pem *.der *.crl );;") + filter;
|
|
caption = QObject::tr("Import Certificate Revocation List");
|
|
}
|
|
|
|
pki_base * load_crl::newItem()
|
|
{
|
|
return new pki_crl();
|
|
}
|
|
|
|
/* Database */
|
|
load_db::load_db()
|
|
:load_base()
|
|
{
|
|
filter = QObject::tr("XCA Databases ( *.xdb );;") + filter;
|
|
caption = QObject::tr("Open XCA Database");
|
|
}
|
|
|
|
/* General PEM loader */
|
|
load_pem::load_pem()
|
|
:load_base()
|
|
{
|
|
filter = QObject::tr("PEM files ( *.pem );;") + filter;
|
|
caption = QObject::tr("Load PEM encoded file");
|
|
}
|
|
|
|
pki_base *load_pem::newItem()
|
|
{
|
|
return new pki_multi();
|
|
}
|