diff --git a/CertDetail.ui b/CertDetail.ui index 075d0a3d..dcda07d0 100644 --- a/CertDetail.ui +++ b/CertDetail.ui @@ -11,7 +11,7 @@ 0 0 - 581 + 577 446 @@ -137,7 +137,7 @@ title - Status + &Status @@ -1451,7 +1451,7 @@ title - Subject & Issuer + Subject & &Issuer @@ -1947,7 +1947,7 @@ title - Extensions + &Extensions diff --git a/CertExtend.ui b/CertExtend.ui index f766132e..871118e3 100644 --- a/CertExtend.ui +++ b/CertExtend.ui @@ -11,8 +11,8 @@ 0 0 - 416 - 279 + 388 + 284 @@ -252,7 +252,11 @@ text - Cancel + &Cancel + + + accel + 276824131 @@ -284,7 +288,7 @@ text - OK + &OK diff --git a/MainWindow.cpp b/MainWindow.cpp index 8ddaac28..ccaf616e 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -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; } } diff --git a/MainWindow.h b/MainWindow.h index 2ed82728..0d822195 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -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); diff --git a/MainWindowKeys.cpp b/MainWindowKeys.cpp index e43411aa..beef59d4 100644 --- a/MainWindowKeys.cpp +++ b/MainWindowKeys.cpp @@ -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); diff --git a/MainWindowX509.cpp b/MainWindowX509.cpp index 20ff522c..97e97e3c 100644 --- a/MainWindowX509.cpp +++ b/MainWindowX509.cpp @@ -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; inumCa(); 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; inumCa(); i++) { - acert = pk12->getCa(i); - if (showDetailsCert(acert, true)) { + for (int i=0; inumCa(); i++) { + acert = pk12->getCa(i); insertCert(acert); } - else { - delete(acert); +#else + showDetailsKey(akey, true); + showDetailsCert(acert,true); + for (int i=0; inumCa(); 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; inumCert(); i++) { acert = pk7->getCert(i); diff --git a/MainWindowX509Req.cpp b/MainWindowX509Req.cpp index 29fb60f1..92b19e13 100644 --- a/MainWindowX509Req.cpp +++ b/MainWindowX509Req.cpp @@ -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); } } diff --git a/lib/pki_pkcs12.cpp b/lib/pki_pkcs12.cpp index a745b6f8..0033e21c 100644 --- a/lib/pki_pkcs12.cpp +++ b/lib/pki_pkcs12.cpp @@ -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"; }