mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
pkcs12 added to commandline
This commit is contained in:
parent
4b7be6e45c
commit
46ace66d1c
@ -11,7 +11,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>581</width>
|
||||
<width>577</width>
|
||||
<height>446</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -137,7 +137,7 @@
|
||||
</property>
|
||||
<attribute>
|
||||
<name>title</name>
|
||||
<string>Status</string>
|
||||
<string>&Status</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property stdset="1">
|
||||
@ -1451,7 +1451,7 @@
|
||||
</property>
|
||||
<attribute>
|
||||
<name>title</name>
|
||||
<string>Subject & Issuer</string>
|
||||
<string>Subject & &Issuer</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property stdset="1">
|
||||
@ -1947,7 +1947,7 @@
|
||||
</property>
|
||||
<attribute>
|
||||
<name>title</name>
|
||||
<string>Extensions</string>
|
||||
<string>&Extensions</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property stdset="1">
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>416</width>
|
||||
<height>279</height>
|
||||
<width>388</width>
|
||||
<height>284</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
@ -252,7 +252,11 @@
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Cancel</string>
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>accel</name>
|
||||
<number>276824131</number>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
@ -284,7 +288,7 @@
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>OK</string>
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
|
||||
@ -129,6 +129,7 @@ void MainWindow::read_cmdline()
|
||||
#define XCA_KEY 1
|
||||
#define XCA_REQ 2
|
||||
#define XCA_CERT 3
|
||||
#define XCA_P12 5
|
||||
#define XCA_DB 4
|
||||
|
||||
int type = XCA_DB;
|
||||
@ -137,6 +138,7 @@ void MainWindow::read_cmdline()
|
||||
pki_key *key;
|
||||
pki_x509 *cert;
|
||||
pki_x509req *req;
|
||||
pki_pkcs12 *p12;
|
||||
exitApp = 0;
|
||||
|
||||
while (cnt < qApp->argc()) {
|
||||
@ -152,6 +154,9 @@ void MainWindow::read_cmdline()
|
||||
case 'k' : type = XCA_KEY;
|
||||
exitApp =1;
|
||||
break;
|
||||
case 'p' : type = XCA_P12;
|
||||
exitApp =1;
|
||||
break;
|
||||
case 'd' : type = XCA_DB;
|
||||
break;
|
||||
}
|
||||
@ -182,6 +187,10 @@ void MainWindow::read_cmdline()
|
||||
req = new pki_x509req(arg);
|
||||
showDetailsReq(req, true);
|
||||
break;
|
||||
case XCA_P12 :
|
||||
p12 = new pki_pkcs12(arg, &MainWindow::passRead);
|
||||
insertP12(p12);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -145,6 +145,7 @@ class MainWindow: public MainWindow_UI
|
||||
pki_key *insertKey(pki_key *lkey);
|
||||
pki_x509req *insertReq(pki_x509req *req);
|
||||
pki_x509 *insertCert(pki_x509 *cert);
|
||||
void insertP12(pki_pkcs12 *pk12);
|
||||
void insertTemp(pki_temp *temp);
|
||||
string md5passwd();
|
||||
bool opensslError(pki_base *pki);
|
||||
|
||||
@ -154,6 +154,7 @@ bool MainWindow::showDetailsKey(pki_key *key, bool import)
|
||||
delete detDlg;
|
||||
return false;
|
||||
}
|
||||
string odesc = key->getDescription();
|
||||
bool ret = detDlg->exec();
|
||||
string ndesc = detDlg->keyDesc->text().latin1();
|
||||
delete detDlg;
|
||||
@ -165,7 +166,7 @@ bool MainWindow::showDetailsKey(pki_key *key, bool import)
|
||||
key = insertKey(key);
|
||||
}
|
||||
CERR(ndesc << " " << key->getDescription());
|
||||
if ( ndesc != key->getDescription()) {
|
||||
if ( ndesc != odesc) {
|
||||
MARK
|
||||
try {
|
||||
keys->renamePKI(key, ndesc);
|
||||
|
||||
@ -496,6 +496,7 @@ bool MainWindow::showDetailsCert(pki_x509 *cert, bool import)
|
||||
}
|
||||
|
||||
// show it to the user...
|
||||
string odesc = cert->getDescription();
|
||||
ret = dlg->exec();
|
||||
string ndesc = dlg->descr->text().latin1();
|
||||
delete dlg;
|
||||
@ -507,7 +508,7 @@ bool MainWindow::showDetailsCert(pki_x509 *cert, bool import)
|
||||
if (import) {
|
||||
cert = insertCert(cert);
|
||||
}
|
||||
if (ndesc != cert->getDescription()) {
|
||||
if (ndesc != odesc) {
|
||||
certs->renamePKI(cert, ndesc);
|
||||
return true;
|
||||
}
|
||||
@ -581,8 +582,6 @@ void MainWindow::loadCert()
|
||||
void MainWindow::loadPKCS12()
|
||||
{
|
||||
pki_pkcs12 *pk12;
|
||||
pki_x509 *acert;
|
||||
pki_key *akey;
|
||||
QStringList filt;
|
||||
filt.append(tr("PKCS#12 Certificates ( *.p12 )"));
|
||||
filt.append(tr("All files ( *.* )"));
|
||||
@ -603,46 +602,44 @@ void MainWindow::loadPKCS12()
|
||||
s = QDir::convertSeparators(s);
|
||||
try {
|
||||
pk12 = new pki_pkcs12(s.latin1(), &MainWindow::passRead);
|
||||
akey = pk12->getKey();
|
||||
acert = pk12->getCert();
|
||||
insertKey(akey);
|
||||
insertCert(acert);
|
||||
for (int i=0; i<pk12->numCa(); i++) {
|
||||
acert = pk12->getCa(i);
|
||||
insertCert(acert);
|
||||
}
|
||||
insertP12(pk12);
|
||||
delete pk12;
|
||||
keys->updateView();
|
||||
}
|
||||
catch (errorEx &err) {
|
||||
Error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* insert with asking.....
|
||||
if (showDetailsKey(akey, true)) {
|
||||
|
||||
void MainWindow::insertP12(pki_pkcs12 *pk12)
|
||||
{
|
||||
pki_x509 *acert;
|
||||
pki_key *akey;
|
||||
|
||||
try {
|
||||
akey = pk12->getKey();
|
||||
acert = pk12->getCert();
|
||||
#ifdef INSERT_WO_ASK
|
||||
insertKey(akey);
|
||||
}
|
||||
else {
|
||||
delete(akey);
|
||||
}
|
||||
if (showDetailsCert(acert,true)) {
|
||||
insertCert(acert);
|
||||
}
|
||||
else {
|
||||
delete(acert);
|
||||
}
|
||||
for (int i=0; i<pk12->numCa(); i++) {
|
||||
acert = pk12->getCa(i);
|
||||
if (showDetailsCert(acert, true)) {
|
||||
for (int i=0; i<pk12->numCa(); i++) {
|
||||
acert = pk12->getCa(i);
|
||||
insertCert(acert);
|
||||
}
|
||||
else {
|
||||
delete(acert);
|
||||
#else
|
||||
showDetailsKey(akey, true);
|
||||
showDetailsCert(acert,true);
|
||||
for (int i=0; i<pk12->numCa(); i++) {
|
||||
acert = pk12->getCa(i);
|
||||
showDetailsCert(acert, true);
|
||||
}
|
||||
#endif
|
||||
keys->updateView();
|
||||
}
|
||||
catch (errorEx &err) {
|
||||
Error(err);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -669,7 +666,7 @@ void MainWindow::loadPKCS7()
|
||||
s = *it;
|
||||
s = QDir::convertSeparators(s);
|
||||
try {
|
||||
pk7 = new pki_pkcs7("");
|
||||
pk7 = new pki_pkcs7(s.latin1());
|
||||
pk7->readP7(s.latin1());
|
||||
for (int i=0; i<pk7->numCert(); i++) {
|
||||
acert = pk7->getCert(i);
|
||||
|
||||
@ -132,6 +132,7 @@ void MainWindow::showDetailsReq(pki_x509req *req, bool import)
|
||||
dlg->but_cancel->setText(tr("Discard"));
|
||||
}
|
||||
|
||||
string odesc = req->getDescription();
|
||||
bool ret = dlg->exec();
|
||||
string ndesc = dlg->descr->text().latin1();
|
||||
delete dlg;
|
||||
@ -143,7 +144,7 @@ void MainWindow::showDetailsReq(pki_x509req *req, bool import)
|
||||
req = insertReq(req);
|
||||
}
|
||||
|
||||
if (ndesc != req->getDescription()) {
|
||||
if (ndesc != odesc) {
|
||||
reqs->renamePKI(req, ndesc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,13 +55,13 @@
|
||||
pki_pkcs12::pki_pkcs12(const string d, pki_x509 *acert, pki_key *akey, pem_password_cb *cb):
|
||||
pki_base(d)
|
||||
{
|
||||
className="pki_pkcs12";
|
||||
key = new pki_key(akey);
|
||||
cert = new pki_x509(acert);
|
||||
certstack = sk_X509_new_null();
|
||||
pkcs12 = NULL;
|
||||
passcb = cb;
|
||||
openssl_error();
|
||||
className="pki_pkcs12";
|
||||
}
|
||||
|
||||
pki_pkcs12::pki_pkcs12(const string fname, pem_password_cb *cb)
|
||||
@ -73,6 +73,7 @@ pki_pkcs12::pki_pkcs12(const string fname, pem_password_cb *cb)
|
||||
X509 *mycert;
|
||||
key=NULL; cert=NULL; pkcs12=NULL;
|
||||
passcb = cb;
|
||||
className="pki_pkcs12";
|
||||
certstack = sk_X509_new_null();
|
||||
PASS_INFO p;
|
||||
string title = XCA_TITLE;
|
||||
@ -102,7 +103,6 @@ pki_pkcs12::pki_pkcs12(const string fname, pem_password_cb *cb)
|
||||
}
|
||||
}
|
||||
else fopen_error(fname);
|
||||
className="pki_pkcs12";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user