From 6a88c53778cd0ad86c69d804ad2f57492fdebda0 Mon Sep 17 00:00:00 2001 From: chris2511 Date: Wed, 25 Jun 2003 15:42:51 +0000 Subject: [PATCH] *** empty log message *** --- lib/base.h.in | 2 +- ui/CertDetail.ui | 530 ++++++++--------------------------------- view/CertView.cpp | 113 +-------- view/ReqView.cpp | 45 +--- widgets/CertDetail.cpp | 55 ++--- widgets/CertDetail.h | 8 +- widgets/CrlDetail.cpp | 5 +- widgets/CrlDetail.h | 5 +- widgets/ExportCert.cpp | 6 +- widgets/ExportCert.h | 10 +- widgets/ExportKey.cpp | 5 + widgets/ExportKey.h | 10 +- widgets/Makefile.in | 2 +- widgets/NewX509.cpp | 103 +++----- widgets/NewX509.h | 7 +- widgets/ReqDetail.cpp | 91 +++++++ widgets/ReqDetail.h | 68 ++++++ widgets/distname.cpp | 8 +- widgets/distname.h | 3 +- widgets/validity.h | 1 - 20 files changed, 360 insertions(+), 717 deletions(-) create mode 100644 widgets/ReqDetail.cpp create mode 100644 widgets/ReqDetail.h diff --git a/lib/base.h.in b/lib/base.h.in index 49e404bf..c2a818ad 100644 --- a/lib/base.h.in +++ b/lib/base.h.in @@ -8,7 +8,7 @@ #define MARK CERR("--Mark--") #define DBEX(x) CERR("DB-error: "< 0 0 - 557 + 553 446 @@ -1249,11 +1249,11 @@ QWidget name - Widget9 + unnamed title - Subject & &Issuer + &Subject @@ -1286,437 +1286,11 @@ - QLayoutWidget + DistName name - Layout11 + subject - - - margin - 0 - - - spacing - 6 - - - QGroupBox - - name - GroupBox3 - - - title - Subject - - - - margin - 11 - - - spacing - 6 - - - QLabel - - name - TextLabel6_2 - - - text - name / DNS: - - - - QLabel - - name - TextLabel4_2 - - - text - Locality: - - - - QLabel - - name - TextLabel7_2 - - - text - E-Mail: - - - - QLabel - - name - dnOU - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - TextLabel4_2_2 - - - text - Organisation - - - - QLabel - - name - TextLabel3 - - - text - Country: - - - - QLabel - - name - dnO - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - TextLabel5 - - - text - Org. unit: - - - - QLabel - - name - dnEmail - - - sizePolicy - - 7 - 1 - - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - dnC - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - dnL - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - dnCN - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - - - QGroupBox - - name - GroupBox3_2 - - - title - Issuer - - - - margin - 11 - - - spacing - 6 - - - QLabel - - name - dnCN_2 - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - TextLabel4_2_3 - - - text - Locality: - - - - QLabel - - name - TextLabel5_2 - - - text - Org. unit: - - - - QLabel - - name - dnEmail_2 - - - sizePolicy - - 7 - 1 - - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - dnC_2 - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - dnO_2 - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - TextLabel7_2_2 - - - text - E-Mail: - - - - QLabel - - name - dnL_2 - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - TextLabel4_2_2_2 - - - text - Organisation: - - - - QLabel - - name - TextLabel6_2_2 - - - text - name / DNS: - - - - QLabel - - name - dnOU_2 - - - frameShape - Panel - - - frameShadow - Sunken - - - text - - - - - QLabel - - name - TextLabel3_2 - - - text - Country: - - - - - @@ -1749,7 +1323,77 @@ title - &Extensions + &Issuer + + + + margin + 11 + + + spacing + 6 + + + + name + Spacer7 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + DistName + + name + issuer + + + + + name + Spacer8 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + QWidget + + name + tab + + + title + &Extension @@ -2053,6 +1697,28 @@ + + + DistName +
distname.h
+ + -1 + -1 + + 1 + + 7 + 7 + + image0 +
+
+ + + image0 + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + but_ok diff --git a/view/CertView.cpp b/view/CertView.cpp index 79cd50f4..09feeda5 100644 --- a/view/CertView.cpp +++ b/view/CertView.cpp @@ -62,7 +62,7 @@ #include #include "ui/CertExtend.h" #include "widgets/ExportCert.h" -#include "ui/CertDetail.h" +#include "widgets/CertDetail.h" #include "ui/TrustState.h" #include "widgets/ExportTinyCA.h" #include "widgets/validity.h" @@ -354,127 +354,34 @@ void CertView::extendCert() } } -void CertView::showItem(pki_base *basecert, bool import) +void CertView::showItem(pki_base *item, bool import) { - pki_x509 *cert = (pki_x509 *)basecert; - if (!cert) return; - if (Error(cert)) return ; + if (!item) return; try { - CertDetail_UI *dlg = new CertDetail_UI(this,0,true); + CertDetail *dlg = new CertDetail(this,0,true); bool ret; - dlg->image->setPixmap(*MainWindow::certImg); - dlg->descr->setText(cert->getIntName()); - dlg->setCaption(tr(XCA_TITLE)); - - // examine the key - pki_key *key= cert->getRefKey(); - if (key) - if (key->isPrivKey()) { - dlg->privKey->setText(key->getIntName()); - dlg->privKey->setDisabled(false); - } - - // examine the signature - if ( cert->getSigner() == NULL) { - dlg->verify->setText(tr("SIGNER UNKNOWN")); - } - else if ( cert->compare(cert->getSigner()) ) { - dlg->verify->setText(tr("SELF SIGNED")); - } - - else { - dlg->verify->setText(cert->getSigner()->getIntName()); - } - - // check trust state - if (cert->getEffTrust() == 0) { - dlg->verify->setDisabled(true); - } - CERR( cert->getEffTrust() ); - - // the serial - dlg->serialNr->setText(cert->getSerial().toHex()); - - // details of subject - x509name subj = cert->getSubject(); - QString land = subj.getEntryByNid(NID_countryName); - QString land1 = subj.getEntryByNid(NID_stateOrProvinceName); - if (land != "" && land1 != "") - land += " / " +land1; - else - land+=land1; - - dlg->dnCN->setText(subj.getEntryByNid(NID_commonName)); - dlg->dnC->setText(land); - dlg->dnL->setText(subj.getEntryByNid(NID_localityName)); - dlg->dnO->setText(subj.getEntryByNid(NID_organizationName)); - dlg->dnOU->setText(subj.getEntryByNid(NID_organizationalUnitName)); - dlg->dnEmail->setText(subj.getEntryByNid(NID_pkcs9_emailAddress)); - - // same for issuer.... - x509name iss = cert->getIssuer(); - land = iss.getEntryByNid(NID_countryName); - land1 = iss.getEntryByNid(NID_stateOrProvinceName); - if (land != "" && land1 != "") - land += " / " +land1; - else - land+=land1; - - dlg->dnCN_2->setText(iss.getEntryByNid(NID_commonName) ); - dlg->dnC_2->setText(land); - dlg->dnL_2->setText(iss.getEntryByNid(NID_localityName)); - dlg->dnO_2->setText(iss.getEntryByNid(NID_organizationName)); - dlg->dnOU_2->setText(iss.getEntryByNid(NID_organizationalUnitName)); - dlg->dnEmail_2->setText(iss.getEntryByNid(NID_pkcs9_emailAddress)); - dlg->notBefore->setText(cert->getNotBefore().toPretty()); - dlg->notAfter->setText(cert->getNotAfter().toPretty()); - MARK - - // validation of the Date - if (cert->checkDate() == -1) { - dlg->dateValid->setText(tr("Not valid")); - dlg->dateValid->setDisabled(true); - } - if (cert->checkDate() == +1) { - dlg->dateValid->setText(tr("Not valid")); - dlg->dateValid->setDisabled(true); - } - if (cert->isRevoked()) { - dlg->dateValid->setText(tr("Revoked: ") + - cert->getRevoked().toPretty()); - dlg->dateValid->setDisabled(true); - - } - // the fingerprints - dlg->fpMD5->setText(cert->fingerprint(EVP_md5())); - dlg->fpSHA1->setText(cert->fingerprint(EVP_sha1())); - - // V3 extensions - dlg->v3Extensions->setText(cert->printV3ext()); - - // rename the buttons in case of import + dlg->setCert((pki_x509 *)item); if (import) { - dlg->but_ok->setText(tr("Import")); - dlg->but_cancel->setText(tr("Discard")); + dlg->setImport(); } // show it to the user... - QString odesc = cert->getIntName(); + QString odesc = item->getIntName(); ret = dlg->exec(); QString ndesc = dlg->descr->text(); delete dlg; if (!ret && import) { - delete cert; + delete item; } if (!ret) return; emit init_database(); if (import) { - cert = (pki_x509 *)insert(cert); + item = insert(item); } if (ndesc != odesc) { - db->renamePKI(cert, ndesc); + db->renamePKI(item, ndesc); return; } } diff --git a/view/ReqView.cpp b/view/ReqView.cpp index a767ddc8..d1606414 100644 --- a/view/ReqView.cpp +++ b/view/ReqView.cpp @@ -50,7 +50,7 @@ #include "ReqView.h" -#include "ui/ReqDetail.h" +#include "widgets/ReqDetail.h" #include #include #include @@ -109,56 +109,27 @@ void ReqView::showItem(pki_base *item, bool import) if (!item) return; emit init_database(); try { - pki_x509req *req = (pki_x509req *)item; - ReqDetail_UI *dlg = new ReqDetail_UI(this,0,true); - dlg->descr->setText(req->getIntName()); - dlg->setCaption(tr(XCA_TITLE)); - if (!req->verify() ) { - dlg->verify->setDisabled(true); - dlg->verify->setText("ERROR"); - } - pki_key *key =req->getRefKey(); - if (key) { - dlg->privKey->setText(key->getIntName()); - dlg->privKey->setDisabled(false); - } - /* - x509name rn = req->getSubject(); - dlg->dnCN->setText(rn.getEntryByNid(NID_commonName)); - dlg->dnC->setText(rn.getEntryByNid(NID_countryName) + " / " - + rn.getEntryByNid(NID_stateOrProvinceName)); - dlg->dnL->setText(rn.getEntryByNid(NID_localityName)); - dlg->dnO->setText(rn.getEntryByNid(NID_organizationName)); - dlg->dnOU->setText(rn.getEntryByNid(NID_organizationalUnitName)); - dlg->dnEmail->setText(rn.getEntryByNid(NID_pkcs9_emailAddress)); - dlg->image->setPixmap(*MainWindow::csrImg); - */ + ReqDetail *dlg = new ReqDetail(this,0,true); + + dlg->setReq((pki_x509req *)item); - dlg->subject->setX509name(req->getSubject()); - - // rename the buttons in case of import - if (import) { - dlg->but_ok->setText(tr("Import")); - dlg->but_cancel->setText(tr("Discard")); - } - - QString odesc = req->getIntName(); + QString odesc = item->getIntName(); bool ret = dlg->exec(); QString ndesc = dlg->descr->text(); delete dlg; if (!ret && import) { - delete req; + delete (pki_x509req *)item; } if (!ret) return; emit init_database(); if (import) { - req = (pki_x509req *)insert((pki_x509req *)req); + item = insert(item); } if (ndesc != odesc) { - db->renamePKI(req, ndesc); + db->renamePKI(item, ndesc); } } catch (errorEx &err) { diff --git a/widgets/CertDetail.cpp b/widgets/CertDetail.cpp index 2203f613..e47d153a 100644 --- a/widgets/CertDetail.cpp +++ b/widgets/CertDetail.cpp @@ -51,18 +51,19 @@ #include "CertDetail.h" #include "MainWindow.h" +#include "distname.h" #include #include -#include +#include -CertDetail::CertDetail(QWidget *parent, const char *name) +CertDetail::CertDetail(QWidget *parent, const char *name, bool modal, WFlags f) :CertDetail_UI(parent,name,true,0) { setCaption(tr(XCA_TITLE)); - image->setPixmap(*MainWindow::revImg); + image->setPixmap(*MainWindow::certImg); } -CertDetail::setCrt(pki_x509 *cert) +void CertDetail::setCert(pki_x509 *cert) { descr->setText(cert->getIntName()); @@ -89,46 +90,17 @@ CertDetail::setCrt(pki_x509 *cert) if (cert->getEffTrust() == 0) { verify->setDisabled(true); } - CERR( cert->getEffTrust() ); // the serial serialNr->setText(cert->getSerial().toHex()); - // details of subject - x509name subj = cert->getSubject(); - QString land = subj.getEntryByNid(NID_countryName); - QString land1 = subj.getEntryByNid(NID_stateOrProvinceName); - if (land != "" && land1 != "") - land += " / " +land1; - else - land+=land1; - - dlg->dnCN->setText(subj.getEntryByNid(NID_commonName)); - dlg->dnC->setText(land); - dlg->dnL->setText(subj.getEntryByNid(NID_localityName)); - dlg->dnO->setText(subj.getEntryByNid(NID_organizationName)); - dlg->dnOU->setText(subj.getEntryByNid(NID_organizationalUnitName)); - dlg->dnEmail->setText(subj.getEntryByNid(NID_pkcs9_emailAddress)); - - // same for issuer.... - x509name iss = cert->getIssuer(); - land = iss.getEntryByNid(NID_countryName); - land1 = iss.getEntryByNid(NID_stateOrProvinceName); - if (land != "" && land1 != "") - land += " / " +land1; - else - land+=land1; - - dlg->dnCN_2->setText(iss.getEntryByNid(NID_commonName) ); - dlg->dnC_2->setText(land); - dlg->dnL_2->setText(iss.getEntryByNid(NID_localityName)); - dlg->dnO_2->setText(iss.getEntryByNid(NID_organizationName)); - dlg->dnOU_2->setText(iss.getEntryByNid(NID_organizationalUnitName)); - dlg->dnEmail_2->setText(iss.getEntryByNid(NID_pkcs9_emailAddress)); - dlg->notBefore->setText(cert->getNotBefore().toPretty()); - dlg->notAfter->setText(cert->getNotAfter().toPretty()); - MARK + // details of subject and issuer + subject->setX509name(cert->getSubject()); + issuer->setX509name(cert->getIssuer()); + // The dates + notBefore->setText(cert->getNotBefore().toPretty()); + notAfter->setText(cert->getNotAfter().toPretty()); // validation of the Date if (cert->checkDate() != 0) { dateValid->setText(tr("Not valid")); @@ -138,14 +110,15 @@ CertDetail::setCrt(pki_x509 *cert) dateValid->setText(tr("Revoked: ") + cert->getRevoked().toPretty()); dateValid->setDisabled(true); - } + // the fingerprints fpMD5->setText(cert->fingerprint(EVP_md5())); fpSHA1->setText(cert->fingerprint(EVP_sha1())); // V3 extensions - dlg->v3Extensions->setText(cert->printV3ext()); + v3Extensions->setText(cert->printV3ext()); +} void CertDetail::setImport() { diff --git a/widgets/CertDetail.h b/widgets/CertDetail.h index 51fe0a4c..1158254a 100644 --- a/widgets/CertDetail.h +++ b/widgets/CertDetail.h @@ -52,15 +52,17 @@ #define CERTDETAIL_H #include "ui/CertDetail.h" -#include "lib/pki_x509.h" + +class pki_x509; class CertDetail: public CertDetail_UI { Q_OBJECT public: - CertDetail( QWidget *parent = 0, const char *name = 0); - void setCert(pki_crl *crl); + CertDetail( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0); + void setCert(pki_x509 *cert); + void setImport(); }; #endif diff --git a/widgets/CrlDetail.cpp b/widgets/CrlDetail.cpp index aefdc04f..af457aa7 100644 --- a/widgets/CrlDetail.cpp +++ b/widgets/CrlDetail.cpp @@ -51,12 +51,13 @@ #include "CrlDetail.h" #include "MainWindow.h" +#include "lib/pki_crl.h" #include #include #include -CrlDetail::CrlDetail(QWidget *parent, const char *name) - :CrlDetail_UI(parent,name,true,0) +CrlDetail::CrlDetail(QWidget *parent, const char *name, bool modal, WFlags f) + :CrlDetail_UI(parent, name, modal, f) { setCaption(tr(XCA_TITLE)); certList->clear(); diff --git a/widgets/CrlDetail.h b/widgets/CrlDetail.h index 1abd1e24..58b4811a 100644 --- a/widgets/CrlDetail.h +++ b/widgets/CrlDetail.h @@ -52,14 +52,15 @@ #define CRLDETAIL_H #include "ui/CrlDetail.h" -#include "lib/pki_crl.h" + +class pki_crl; class CrlDetail: public CrlDetail_UI { Q_OBJECT public: - CrlDetail( QWidget *parent = 0, const char *name = 0); + CrlDetail( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0); void setCrl(pki_crl *crl); }; #endif diff --git a/widgets/ExportCert.cpp b/widgets/ExportCert.cpp index 328e3366..6b004245 100644 --- a/widgets/ExportCert.cpp +++ b/widgets/ExportCert.cpp @@ -50,7 +50,11 @@ #include "ExportCert.h" +#include "lib/base.h" +#include +#include +#include ExportCert::ExportCert(QString fname, bool hasKey, QString dpath, const QString tcafn, QWidget *parent, const char *name ) @@ -99,12 +103,10 @@ void ExportCert::chooseFile() void ExportCert::formatChanged() { - CERR("Export format changed"); char *suffix[] = {"crt", "crt", "crt", "crt", "cer", "p7b", "p7b", "p7b", "p12", "p12"}; int selected = exportFormat->currentItem(); QString fn = filename->text(); QString nfn = fn.left(fn.findRev('.')+1) + suffix[selected]; - CERR(nfn); filename->setText(nfn); } diff --git a/widgets/ExportCert.h b/widgets/ExportCert.h index b3865007..831fabae 100644 --- a/widgets/ExportCert.h +++ b/widgets/ExportCert.h @@ -48,17 +48,11 @@ * */ - -#include "ui/ExportCert.h" -#include -#include -#include -#include -#include "lib/base.h" - #ifndef EXPORTCERT_H #define EXPORTCERT_H +#include "ui/ExportCert.h" + class ExportCert: public ExportCert_UI { Q_OBJECT diff --git a/widgets/ExportKey.cpp b/widgets/ExportKey.cpp index 6323aa44..ae909c7a 100644 --- a/widgets/ExportKey.cpp +++ b/widgets/ExportKey.cpp @@ -50,7 +50,12 @@ #include "ExportKey.h" +#include "lib/base.h" +#include +#include +#include +#include ExportKey::ExportKey(QString fname, bool onlypub, QString dpath, QWidget *parent, const char *name ) diff --git a/widgets/ExportKey.h b/widgets/ExportKey.h index 34b5a4eb..fd2ab57a 100644 --- a/widgets/ExportKey.h +++ b/widgets/ExportKey.h @@ -48,18 +48,10 @@ * */ - -#include "ui/ExportKey.h" -#include -#include -#include -#include -#include "lib/pki_base.h" -#include - #ifndef EXPORTKEY_H #define EXPORTKEY_H +#include "ui/ExportKey.h" class ExportKey: public ExportKey_UI { diff --git a/widgets/Makefile.in b/widgets/Makefile.in index 991a9e1b..a8494ae9 100644 --- a/widgets/Makefile.in +++ b/widgets/Makefile.in @@ -20,7 +20,7 @@ CFLAGS=-Wall @ac_DEBUG@ ############################################## -NAMES= ExportCert ExportKey ExportTinyCA NewX509 CrlDetail \ +NAMES= ExportCert ExportKey ExportTinyCA NewX509 CrlDetail CertDetail \ MainWindow validity distname OBJS=$(patsubst %,moc_%.o,$(NAMES)) $(patsubst %,%.o,$(NAMES)) diff --git a/widgets/NewX509.cpp b/widgets/NewX509.cpp index 63d117cc..b34610ac 100644 --- a/widgets/NewX509.cpp +++ b/widgets/NewX509.cpp @@ -65,26 +65,14 @@ #include "MainWindow.h" #include "lib/x509name.h" -NewX509::NewX509(QWidget *parent , const char *name, db_key *key, db_x509req *req, db_x509 *cert, db_temp *temp, QPixmap *image, QPixmap *ns) - :NewX509_UI(parent, name, true, 0) +NewX509::NewX509(QWidget *parent , const char *name, bool modal, WFlags f) + :NewX509_UI(parent, name, modal, f) { connect( this, SIGNAL(genKey()), parent, SLOT(newKey()) ); connect( parent, SIGNAL(keyDone(QString)), this, SLOT(newKeyDone(QString)) ); setCaption(tr(XCA_TITLE)); - keys = key; - reqs = req; - temps = temp; - certs = cert; fixtemp = NULL; - if (image) { - bigImg1->setPixmap(*image); - bigImg2->setPixmap(*image); - bigImg3->setPixmap(*image); - bigImg4->setPixmap(*image); - bigImg5->setPixmap(*image); - bigImg6->setPixmap(*image); - nsImg->setPixmap(*ns); - } + nsImg->setPixmap(*MainWindow::nsImg); #ifdef qt3 // pretty fat Title :-) QFont tFont;// = getFont(); @@ -98,63 +86,43 @@ NewX509::NewX509(QWidget *parent , const char *name, db_key *key, db_x509req *re serialNr->setValidator( new QIntValidator(0, 32767, this)); QStringList strings; // are there any useable private keys ? - if (keys) { - strings = keys->get0PrivateDesc(); - keyList->insertStringList(strings); - } - else { - keyList->setEnabled(false); - genKeyBUT->setEnabled(false); - } + strings = MainWindow::keys->get0PrivateDesc(); + keyList->insertStringList(strings); // any PKCS#10 requests to be used ? - if (reqs) { - strings = reqs->getDesc(); - if (strings.isEmpty()) { - fromReqCB->setDisabled(true); - } - else { - reqList->insertStringList(strings); - } + strings = MainWindow::reqs->getDesc(); + if (strings.isEmpty()) { + fromReqCB->setDisabled(true); + reqList->setDisabled(true); } else { - reqList->setEnabled(false); - fromReqCB->setEnabled(false); + reqList->insertStringList(strings); } // How about signing certificates ? - if (certs) { - strings = certs->getSignerDesc(); - if (strings.isEmpty()) { - foreignSignRB->setDisabled(true); - certList->setDisabled(true); - } - else { - certList->insertStringList(strings); - } - } - else { + strings = certs->getSignerDesc(); + if (strings.isEmpty()) { foreignSignRB->setDisabled(true); certList->setDisabled(true); } + else { + certList->insertStringList(strings); + } // settings for the templates .... - if (temps) { - strings = temps->getDesc(); - strings.prepend(tr("Server Template")); - strings.prepend(tr("Client Template")); - strings.prepend(tr("CA Template")); - strings.prepend(tr("Empty Template")); - tempList->insertStringList(strings); - } - else { - templateBox->setEnabled(false); - } + strings = MainWindow::temps->getDesc(); + strings.prepend(tr("Server Template")); + strings.prepend(tr("Client Template")); + strings.prepend(tr("CA Template")); + strings.prepend(tr("Empty Template")); + tempList->insertStringList(strings); + setFinishEnabled(page7,true); setNextEnabled(page2,false); signerChanged(); } + void NewX509::setRequest() { setAppropriate(page4, false); @@ -177,6 +145,7 @@ request. The resulting request should be exported and send to an appropriate CA for signing it."); tText=tr("Certificate request"); setup(); + setImage(MainWindow::csrImg); } NewX509::~NewX509() @@ -204,6 +173,9 @@ applied when signing with this CA."); tText += tr(" change"); } setup(); + keyList->setEnabled(false); + genKeyBUT->setEnabled(false); + setImage(MainWindow::tempImg); } @@ -214,6 +186,17 @@ void NewX509::setCert() endText=tr("You are done with entering all parameters for creating a Certificate."); tText=tr("Certificate"); setup(); + setImage(MainWindow::certImg); +} + +void NewX509::setImage(QPixmap *image) +{ + bigImg1->setPixmap(*image); + bigImg2->setPixmap(*image); + bigImg3->setPixmap(*image); + bigImg4->setPixmap(*image); + bigImg5->setPixmap(*image); + bigImg6->setPixmap(*image); } void NewX509::setup() @@ -385,7 +368,6 @@ void NewX509::toggleFromRequest() void NewX509::dataChangeP2() { - CERR( "Data changed" ); if (description->text() != "" && countryName->text().length() !=1 && (keyList->count() > 0 || !keyList->isEnabled())){ setNextEnabled(page2,true); @@ -423,19 +405,15 @@ void NewX509::showPage(QWidget *page) void NewX509::signerChanged() { - CERR("signer Changed"); - if (!certs) return; QString name = certList->currentText(); - CERR( "Certificate: " << name); if (name.isEmpty()) return; - pki_x509 *cert = (pki_x509 *)certs->getByName(name); + pki_x509 *cert = (pki_x509 *)MainWindow::certs->getByName(name); if (!cert) return; QString templ = cert->getTemplate(); if (templ.isEmpty()) return; - CERR( "set Template: " << templ ); templateChanged(templ); @@ -475,7 +453,6 @@ void NewX509::templateChanged() temp = new pki_temp("temp",item); if (temp) { fromTemplate(temp); - CERR("using default template: "<< item); delete (temp); } return; @@ -484,14 +461,12 @@ void NewX509::templateChanged() if (name == "" || !temps) return; temp = (pki_temp *)temps->getByName(name); if (!temp) return; - CERR("CHANGING TEMPLATE"); fromTemplate(temp); } void NewX509::switchExtended() { if ( !appropriate(page1) ) return; - CERR( "SWITCH Extended"); if (changeDefault->isChecked() || !templateBox->isEnabled()) { setAppropriate(page4, true); setAppropriate(page5, true); diff --git a/widgets/NewX509.h b/widgets/NewX509.h index 57b4058e..9f9c0711 100644 --- a/widgets/NewX509.h +++ b/widgets/NewX509.h @@ -64,15 +64,11 @@ class NewX509: public NewX509_UI { Q_OBJECT private: - db_x509req *reqs; - db_x509 *certs; - db_key *keys; - db_temp *temps; pki_temp *fixtemp; QString startText, endText, tText; public: - NewX509(QWidget *parent, const char *name, db_key *key, db_x509req *req, db_x509 *cert, db_temp *temp, QPixmap *image, QPixmap *ns); + NewX509(QWidget *parent, const char *name, bool modal = false, WFlags f = 0); ~NewX509(); void setRequest(); // reduce to request form void setTemp(pki_temp *temp); // reduce to template form @@ -90,6 +86,7 @@ class NewX509: public NewX509_UI void templateChanged(QString templatename); pki_key *getSelectedKey(); x509name getX509name(); + void setImage(QPixmap *image); public slots: void toggleFromRequest(); void newKey(); diff --git a/widgets/ReqDetail.cpp b/widgets/ReqDetail.cpp new file mode 100644 index 00000000..4d1dfabd --- /dev/null +++ b/widgets/ReqDetail.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2001 Christian Hohnstaedt. + * + * All rights reserved. + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This program links to software with different licenses from: + * + * http://www.openssl.org which includes cryptographic software + * written by Eric Young (eay@cryptsoft.com)" + * + * http://www.sleepycat.com + * + * http://www.trolltech.com + * + * + * + * http://www.hohnstaedt.de/xca + * email: christian@hohnstaedt.de + * + * $Id$ + * + */ + + +#include "ReqDetail.h" +#include "MainWindow.h" +#include "distname.h" +#include "lib/pki_x509req.h" +#include +#include +#include + +ReqDetail::ReqDetail(QWidget *parent, const char *name, bool modal, WFlags f ) + :ReqDetail_UI(parent, name, modal, f) +{ + setCaption(tr(XCA_TITLE)); + image->setPixmap(*MainWindow::csrImg); +} + +void ReqDetail::setReq(pki_x509req *req) +{ + // internal name and verification + descr->setText(req->getIntName()); + if (!req->verify() ) { + verify->setDisabled(true); + verify->setText("ERROR"); + } + // look for the private key + pki_key *key =req->getRefKey(); + if (key) { + privKey->setText(key->getIntName()); + privKey->setDisabled(false); + } + // the subject + subject->setX509name(req->getSubject()); + +} + +void ReqDetail::setImport() +{ + // rename the buttons in case of import + but_ok->setText(tr("Import")); + but_cancel->setText(tr("Discard")); +} diff --git a/widgets/ReqDetail.h b/widgets/ReqDetail.h new file mode 100644 index 00000000..37639932 --- /dev/null +++ b/widgets/ReqDetail.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2001 Christian Hohnstaedt. + * + * All rights reserved. + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This program links to software with different licenses from: + * + * http://www.openssl.org which includes cryptographic software + * written by Eric Young (eay@cryptsoft.com)" + * + * http://www.sleepycat.com + * + * http://www.trolltech.com + * + * + * + * http://www.hohnstaedt.de/xca + * email: christian@hohnstaedt.de + * + * $Id$ + * + */ + +#ifndef REQDETAIL_H +#define REQDETAIL_H + +#include "ui/ReqDetail.h" + +class pki_x509req; + +class ReqDetail: public ReqDetail_UI +{ + Q_OBJECT + + public: + ReqDetail( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0); + void setReq(pki_x509req *req); + void setImport(); +}; + +#endif diff --git a/widgets/distname.cpp b/widgets/distname.cpp index d2f66223..965f1b5b 100644 --- a/widgets/distname.cpp +++ b/widgets/distname.cpp @@ -86,7 +86,7 @@ void DistName::setX509name(const x509name &n) if (lb->text().isEmpty()) lb->setText(sl[0]); le->setText(sl[2]); - le->setDisabled(true); + le->setReadOnly(true); DistNameLayout->addWidget( lb, i, 0 ); DistNameLayout->addWidget( le, i, 1 ); } @@ -100,9 +100,9 @@ DistName::~DistName() void DistName::resizeEvent( QResizeEvent *e) { QWidget::resizeEvent(e); - cerr << "W size:" << size().height() << " -- " << size().width() <maximumSize().height() << " -- " << DistNameLayout->maximumSize().width() <maximumSize().height() << " -- " << DistNameLayout->maximumSize().width() < -#include +#include #include class x509name; diff --git a/widgets/validity.h b/widgets/validity.h index efdc3240..a06247f9 100644 --- a/widgets/validity.h +++ b/widgets/validity.h @@ -51,7 +51,6 @@ #ifndef VALIDITY_H #define VALIDITY_H -#include #include class QGridLayout;