diff --git a/lib/asn1time.cpp b/lib/asn1time.cpp index f6073489..de8ba5e1 100644 --- a/lib/asn1time.cpp +++ b/lib/asn1time.cpp @@ -268,30 +268,74 @@ int a1time::derSize() const ASN1_UTCTIME *a1time::toUTCtime() const -{ - ASN1_UTCTIME *ret; - int year=0,i ; - // if (!ASN1_TIME_check(t)) return NULL; - for (i=0; i<4; i++) { - year *= 10; - year += time->data[i] - '0'; - } - if (year > 2049 || year <1950) - return NULL; - - if (!(ret = ASN1_UTCTIME_new ())) - return NULL; - - /* If already UTC Time just copy across */ - if (time->type == V_ASN1_UTCTIME) { - if(!ASN1_STRING_set(ret, time->data, time->length)) + { + ASN1_UTCTIME *ret; + int year=0,i ; + // if (!ASN1_TIME_check(t)) return NULL; + for (i=0; i<4; i++){ + year *= 10; + year += time->data[i] - '0'; + } + if (year > 2049 || year <1950) return NULL; - return ret; - } - /* copy w/o 19 or 20 */ - if (!ASN1_STRING_set(ret, time->data+2, time->length - 2)) - return NULL; + if (!(ret = ASN1_UTCTIME_new ())) + return NULL; - return ret; -} + /* If already UTC Time just copy across */ + if (time->type == V_ASN1_UTCTIME) + { + if(!ASN1_STRING_set(ret, time->data, time->length)) + return NULL; + return ret; + } + + /* copy w/o 19 or 20 */ + if (!ASN1_STRING_set(ret, time->data+2, time->length - 2)) + return NULL; + + return ret; + } + +/* this was happily copied from OpenSSL 0.9.7 + * and is used if linking against 0.9.6 + */ + +#if OPENSSL_VERSION_NUMBER < 0x00907000L +/* Convert an ASN1_TIME structure to GeneralizedTime */ +ASN1_GENERALIZEDTIME *a1time::ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out) + { + ASN1_GENERALIZEDTIME *ret; + char *str; + + // if (!ASN1_TIME_check(t)) return NULL; + + if (!out || !*out) + { + if (!(ret = ASN1_GENERALIZEDTIME_new ())) + return NULL; + if (out) *out = ret; + } + else ret = *out; + + /* If already GeneralizedTime just copy across */ + if (t->type == V_ASN1_GENERALIZEDTIME) + { + if(!ASN1_STRING_set(ret, t->data, t->length)) + return NULL; + return ret; + } + + /* grow the string */ + if (!ASN1_STRING_set(ret, NULL, t->length + 2)) + return NULL; + str = (char *)ret->data; + /* Work out the century and prepend */ + if (t->data[0] >= '5') strcpy(str, "19"); + else strcpy(str, "20"); + + strncat(str, (char *)t->data, t->length); + + return ret; + } +#endif diff --git a/lib/asn1time.h b/lib/asn1time.h index 6f467f94..1efe2c58 100644 --- a/lib/asn1time.h +++ b/lib/asn1time.h @@ -56,6 +56,9 @@ class a1time { private: ASN1_TIME *time; +#if OPENSSL_VERSION_NUMBER < 0x00907000L + ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); +#endif ASN1_UTCTIME *toUTCtime() const; public: a1time(); diff --git a/lib/db_base.h b/lib/db_base.h index e4a5bafe..a4f9c6b8 100644 --- a/lib/db_base.h +++ b/lib/db_base.h @@ -95,6 +95,9 @@ class db_base: public QAbstractItemModel virtual void loadContainer(); QStringList getDesc(); virtual pki_base* insert(pki_base *item); + /* preprocess should be implemented once to speed up updateView() + * i.e search for signers and keys */ + virtual void preprocess(){}; virtual void inToCont(pki_base *pki); virtual void remFromCont(QModelIndex &idx); diff --git a/lib/db_crl.cpp b/lib/db_crl.cpp index af89141b..ec9a645d 100644 --- a/lib/db_crl.cpp +++ b/lib/db_crl.cpp @@ -61,8 +61,7 @@ db_crl::db_crl(QString db, MainWindow *mw) { delete rootItem; rootItem = newPKI(); - headertext << tr("Name") << tr("Signer") << tr("Common name") << - tr("No. revoked") << tr("Next update"); + headertext << "Name" << "Common name" << "revoked"; delete_txt = tr("Delete the revokation list(s)"); view = mw->crlView; class_name = "crls"; @@ -73,6 +72,18 @@ pki_base *db_crl::newPKI(){ return new pki_crl(); } +void db_crl::preprocess() +{ +#if 0 + if ( container.isEmpty() ) return ; + FOR_ALL_pki(crl, pki_crl) { + pki_x509 *iss = MainWindow::certs->getBySubject(crl->getIssuerName()); + crl->setIssuer(iss); + revokeCerts(crl); + } +#endif +} + void db_crl::load() { load_crl l; @@ -100,22 +111,7 @@ void db_crl::revokeCerts(pki_crl *crl) void db_crl::inToCont(pki_base *pki) { - pki_crl *crl = (pki_crl *)pki; - revokeCerts(crl); - if (crl->getIssuer() == NULL) { - pki_x509 *iss = NULL, *last = NULL; - x509name issname = crl->getIssuerName(); - while ((iss = mainwin->certs->getBySubject(issname, last)) != NULL) { - pki_key *key = iss->getPubKey(); - if (crl->verify(key)) { - delete key; - break; - } - delete key; - last = iss; - } - crl->setIssuer(iss); - } + revokeCerts((pki_crl *)pki); db_base::inToCont(pki); } @@ -243,7 +239,7 @@ pki_crl *db_crl::newItem(pki_x509 *cert) crl->setLastUpdate(ui.lastUpdate->getDate()); crl->setNextUpdate(ui.nextUpdate->getDate()); - cert->setCrlExpiry(ui.nextUpdate->getDate()); + cert->setLastCrl(ui.nextUpdate->getDate()); if (cert->getRefKey()->getType() == EVP_PKEY_DSA) dgst = EVP_dss1(); else @@ -251,6 +247,7 @@ pki_crl *db_crl::newItem(pki_x509 *cert) crl->sign(cert->getRefKey(), dgst); mainwin->certs->updatePKI(cert); +#warning FIXME: set Last update insert(crl); } catch (errorEx &err) { diff --git a/lib/db_crl.h b/lib/db_crl.h index 17d33196..a58a1dae 100644 --- a/lib/db_crl.h +++ b/lib/db_crl.h @@ -67,6 +67,7 @@ class db_crl: public db_base db_crl(QString db, MainWindow *mw); pki_base *newPKI(); void revokeCerts(pki_crl *crl); + void preprocess(); void inToCont(pki_base *pki); pki_base *insert(pki_base *item); void showItem(const QModelIndex &index); diff --git a/lib/db_x509.cpp b/lib/db_x509.cpp index 0424e5ab..4669078d 100644 --- a/lib/db_x509.cpp +++ b/lib/db_x509.cpp @@ -142,6 +142,16 @@ void db_x509::remFromCont(QModelIndex &idx) return; } +void db_x509::preprocess() +{ + FOR_ALL_pki(pki, pki_x509) { + findSigner(pki); + findKey(pki); + } + calcEffTrust(); + +} + void db_x509::changeView() { pki_base *temproot = new pki_base(); diff --git a/lib/db_x509.h b/lib/db_x509.h index a2e00b26..e8013843 100644 --- a/lib/db_x509.h +++ b/lib/db_x509.h @@ -77,6 +77,7 @@ class db_x509: public db_x509super void updateViewAll(); void updateViewPKI(pki_base *pki); void remFromCont(QModelIndex &idx); + void preprocess(); QStringList getPrivateDesc(); QStringList getSignerDesc(); void calcEffTrust(); diff --git a/lib/db_x509super.cpp b/lib/db_x509super.cpp index fd1d08b0..da5ec36f 100644 --- a/lib/db_x509super.cpp +++ b/lib/db_x509super.cpp @@ -63,6 +63,11 @@ void db_x509super::newKey(pki_key *newkey) FOR_ALL_pki(pki,pki_x509super) { pki->setRefKey(newkey); } } +void db_x509super::preprocess() +{ + FOR_ALL_pki(pki,pki_x509super) { findKey(pki); } +} + pki_key *db_x509super::findKey(pki_x509super *ref) { pki_key *key, *refkey; diff --git a/lib/db_x509super.h b/lib/db_x509super.h index e81a1393..c041e87a 100644 --- a/lib/db_x509super.h +++ b/lib/db_x509super.h @@ -61,6 +61,7 @@ class db_x509super: public db_base public: db_x509super(QString db, MainWindow *mw); + void preprocess(); pki_key *findKey(pki_x509super *ref); void inToCont(pki_base *pki); diff --git a/lib/pki_base.cpp b/lib/pki_base.cpp index dd423d13..7e0f644a 100644 --- a/lib/pki_base.cpp +++ b/lib/pki_base.cpp @@ -149,7 +149,7 @@ bool pki_base::ign_openssl_error() const QString errtxt; while (int i = ERR_get_error() ) { errtxt = ERR_error_string(i ,NULL); - //fprintf(stderr,"IGNORED: %s\n", CCHAR(errtxt)); + fprintf(stderr,"IGNORED: %s\n", CCHAR(errtxt)); } return !errtxt.isEmpty(); } diff --git a/lib/pki_crl.cpp b/lib/pki_crl.cpp index 01ade08f..65318910 100644 --- a/lib/pki_crl.cpp +++ b/lib/pki_crl.cpp @@ -49,6 +49,7 @@ #include "pki_crl.h" +#include "widgets/MainWindow.h" #include QPixmap *pki_crl::icon = NULL; @@ -78,6 +79,11 @@ void pki_crl::fload(const QString fname ) fclose(fp); setIntName(rmslashdot(fname)); openssl_error(); + if (MainWindow::certs) { + issuer = MainWindow::certs->getBySubject(getIssuerName()); + } + else + issuer = NULL; } else fopen_error(fname); } @@ -214,16 +220,16 @@ void pki_crl::setIssuer(pki_x509 *iss) { issuer = iss; } a1time pki_crl::getLastUpdate() { a1time a; - if (crl && crl->crl) - a.set(crl->crl->lastUpdate); + if (!crl || !crl->crl) return a; + a.set(crl->crl->lastUpdate); return a; } a1time pki_crl::getNextUpdate() { a1time a; - if (crl && crl->crl) - a.set(crl->crl->nextUpdate); + if (!crl || !crl->crl) return a; + a.set(crl->crl->nextUpdate); return a; } @@ -291,16 +297,9 @@ QVariant pki_crl::column_data(int col) case 0: return QVariant(getIntName()); case 1: - if (issuer) - return QVariant(getIssuer()->getIntName()); - else - return QVariant(tr("unknown")); - case 2: return QVariant(getIssuerName().getEntryByNid(NID_commonName)); - case 3: + case 2: return QVariant(numRev()); - case 4: - return QVariant(getNextUpdate().toSortable()); } return QVariant(); } diff --git a/lib/pki_key.cpp b/lib/pki_key.cpp index 9628bf2a..1e5e9f2b 100644 --- a/lib/pki_key.cpp +++ b/lib/pki_key.cpp @@ -151,7 +151,7 @@ QString pki_key::removeTypeFromIntName(QString n) void pki_key::setOwnPass(enum passType x) { EVP_PKEY *pk, *pk_back; - int oldOwnPass = ownPass; + int oldOwnPass = x; if (ownPass == x || isPubKey()) return; @@ -324,6 +324,9 @@ EVP_PKEY *pki_key::decryptKey() const char ownPassBuf[MAX_PASS_LENGTH] = ""; if (isPubKey()) { +#if OPENSSL_VERSION_NUMBER >= 0x00908000L + return ASN1_dup_of_const(EVP_PKEY, i2d_PublicKey, d21_PublicKey, pkey); +#else unsigned char *q; outl = i2d_PublicKey(key, NULL); q = (unsigned char *)OPENSSL_malloc(outl); @@ -333,6 +336,7 @@ EVP_PKEY *pki_key::decryptKey() const tmpkey = D2I_CLASHT(d2i_PublicKey, key->type, NULL, &p, outl); OPENSSL_free(q); return tmpkey; +#endif } /* This key has its own password */ if (ownPass == ptPrivate) { diff --git a/lib/pki_x509.cpp b/lib/pki_x509.cpp index 385b477e..0d888e4d 100644 --- a/lib/pki_x509.cpp +++ b/lib/pki_x509.cpp @@ -76,7 +76,7 @@ pki_x509::pki_x509(const pki_x509 *crt) caSerial = crt->caSerial; caTemplate = crt->caTemplate; crlDays = crt->crlDays; - crlExpiry = crt->crlExpiry; + lastCrl = crt->lastCrl; isrevoked = isrevoked; openssl_error(); } @@ -133,7 +133,7 @@ void pki_x509::init() caSerial = 1; caTemplate = ""; crlDays = 30; - crlExpiry.now(); + lastCrl.now(); class_name = "pki_x509"; cert = NULL; isrevoked = false; @@ -315,7 +315,7 @@ void pki_x509::fromData(const unsigned char *p, db_header_t *head) caSerial.setHex(db::stringFromData(&p1)); caTemplate = db::stringFromData(&p1); crlDays = db::intFromData(&p1); - crlExpiry.d2i(p1, size - (p1-p)); + lastCrl.d2i(p1, size - (p1-p)); if (cert) X509_free(cert_sik); @@ -331,7 +331,7 @@ unsigned char *pki_x509::toData(int *size) // calculate the needed size *size = i2d_X509(cert, NULL) + 11 + caSerial.toHex().length() + - caTemplate.length() + crlExpiry.derSize() + revoked.derSize(); + caTemplate.length() + lastCrl.derSize() + revoked.derSize(); openssl_error(); p = (unsigned char*)OPENSSL_malloc(*size); p1 = p; @@ -347,7 +347,7 @@ unsigned char *pki_x509::toData(int *size) db::stringToData(&p1, caTemplate); // version 3 db::intToData(&p1, crlDays); // the CRL period - p1 = crlExpiry.i2d(p1); // last CRL date + p1 = lastCrl.i2d(p1); // last CRL date openssl_error(); if (*size != p1-p) { printf("pki_x509::toData: Size = %d, real size=%d\n", *size, p1-p); @@ -605,9 +605,9 @@ QString pki_x509::getTemplate(){ return caTemplate; } void pki_x509::setTemplate(QString s) {if (s.length()>0) caTemplate = s; } -void pki_x509::setCrlExpiry(const a1time &time) +void pki_x509::setLastCrl(const a1time &time) { - crlExpiry = time; + lastCrl = time; openssl_error(); } @@ -669,8 +669,7 @@ QVariant pki_x509::column_data(int col) case 5: if (isRevoked()) return QVariant(getRevoked().toSortable()); - else if (canSign()) - return QVariant(tr("CRL expires: ")+ crlExpiry.toSortable()); + break; } return QVariant(); @@ -723,7 +722,7 @@ void pki_x509::oldFromData(unsigned char *p, int size) if (version == 1) { caTemplate=""; caSerial=1; - crlExpiry.now(); + lastCrl = NULL; crlDays=30; } @@ -745,7 +744,7 @@ void pki_x509::oldFromData(unsigned char *p, int size) crlDays = intFromData(&p1); sLastCrl = intFromData(&p1); if (sLastCrl) { - crlExpiry.d2i(p1, sLastCrl); + lastCrl.d2i(p1, sLastCrl); } } // version 4 saves a NULL as revoked diff --git a/lib/pki_x509.h b/lib/pki_x509.h index 1d6484df..b06ff8d0 100644 --- a/lib/pki_x509.h +++ b/lib/pki_x509.h @@ -67,7 +67,7 @@ class pki_x509 : public pki_x509super //friend class db_x509; private: pki_x509 *psigner; - a1time revoked, crlExpiry; + a1time revoked, lastCrl; bool isrevoked; int trust; int efftrust; @@ -132,7 +132,7 @@ class pki_x509 : public pki_x509super QString getTemplate(); void setCrlDays(int s); int getCrlDays(); - void setCrlExpiry(const a1time &time); + void setLastCrl(const a1time &time); int resetTimes(pki_x509 *signer); bool hasExtension(int nid); bool cmpIssuerAndSerial(pki_x509 *refcert); diff --git a/lib/pki_x509req.cpp b/lib/pki_x509req.cpp index 648a536f..25b9df0e 100644 --- a/lib/pki_x509req.cpp +++ b/lib/pki_x509req.cpp @@ -293,9 +293,13 @@ extList pki_x509req::getV3Ext() */ void pki_x509req::setSPKIFromData(const unsigned char *p, int size) { - NETSCAPE_SPKI *spki = D2I_CLASH(d2i_NETSCAPE_SPKI, NULL, &p, size); - if (spki) - set_spki (spki); + NETSCAPE_SPKI *spki = NULL; + + spki = D2I_CLASH(d2i_NETSCAPE_SPKI, NULL, &p, size); + if (spki == NULL) goto err; + + set_spki (spki); + err: openssl_error(); } @@ -306,9 +310,13 @@ void pki_x509req::setSPKIFromData(const unsigned char *p, int size) */ void pki_x509req::setSPKIBase64(const char *p) { - NETSCAPE_SPKI *spki = NETSCAPE_SPKI_b64_decode(p, -1); - if (spki) - set_spki (spki); + NETSCAPE_SPKI *spki = NULL; + + spki = NETSCAPE_SPKI_b64_decode(p, -1); + if (spki == NULL) goto err; + + set_spki (spki); + err: openssl_error(); } @@ -327,26 +335,22 @@ void pki_x509req::set_spki(NETSCAPE_SPKI *_spki) Now extract the key from the SPKI structure and check the signature. */ - openssl_error(); + pktmp=NETSCAPE_SPKI_get_pubkey(_spki); - if (pktmp == NULL) - goto err; + if (pktmp == NULL) goto err; - if (NETSCAPE_SPKI_verify(_spki, pktmp) <= 0) - goto err; + if (NETSCAPE_SPKI_verify(_spki, pktmp) <= 0) goto err; - X509_REQ_set_pubkey(request, pktmp); + X509_REQ_set_pubkey(request,pktmp); // replace the internally stored spki structure. if (spki) NETSCAPE_SPKI_free(spki); spki=_spki; - openssl_error(); return; err: NETSCAPE_SPKI_free(_spki); - if (pktmp != NULL) - EVP_PKEY_free(pktmp); + if (pktmp != NULL) EVP_PKEY_free(pktmp); openssl_error(); } @@ -379,14 +383,15 @@ void pki_x509req::load_spkac(const QString filename) sk=CONF_get_section(parms, "default"); if (sk_CONF_VALUE_num(sk) == 0) - openssl_error(tr("no key/value pairs found in %1\n").arg(filename)); + openssl_error(QString("no name/value pairs found in %1\n").arg(filename)); /* * Build up the subject name set. */ - for (i = 0; ; i++) { - if (sk_CONF_VALUE_num(sk) <= i) - break; + for (i = 0; ; i++) + { + if (sk_CONF_VALUE_num(sk) <= i) break; + cv=sk_CONF_VALUE_value(sk,i); type=cv->name; /* Skip past any leading X. X: X, etc to allow for @@ -404,7 +409,6 @@ void pki_x509req::load_spkac(const QString filename) // check for a valid DN component. if ((nid=OBJ_txt2nid(type)) == NID_undef) { - ign_openssl_error(); // ... or a SPKAC tag. if (strcmp(type, "SPKAC") == 0) setSPKIBase64(cv->value); @@ -417,7 +421,7 @@ void pki_x509req::load_spkac(const QString filename) else // gather all values in the x509name subject. subject.addEntryByNid(nid,cv->value); - } + } if (!spki_found) openssl_error(QString("No Netscape SPKAC structure found in %1\n").arg(filename)); diff --git a/ui/CertDetail.ui b/ui/CertDetail.ui index 1a416001..199e7d37 100644 --- a/ui/CertDetail.ui +++ b/ui/CertDetail.ui @@ -1,4 +1,7 @@ + + + CertDetail @@ -84,9 +87,6 @@ - - 0 - S&tatus @@ -184,469 +184,265 @@ - - - - 128 - 128 - 128 - - - - - - - 192 - 192 - 192 - - - - - - - 255 - 255 - 255 - - - - - - - 223 - 223 - 223 - - - - - - - 128 - 128 - 128 - - - - - - - 160 - 160 - 164 - - - - - - - 128 - 128 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 128 - 128 - 128 - - - - - - - 192 - 192 - 192 - - - - - - - 192 - 192 - 192 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - + + 128 + 128 + 128 + + + 192 + 192 + 192 + + + 255 + 255 + 255 + + + 223 + 223 + 223 + + + 128 + 128 + 128 + + + 160 + 160 + 164 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 192 + 192 + 192 + + + 192 + 192 + 192 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 255 + + + 255 + 0 + 255 + + + 231 + 231 + 231 + - - - - 128 - 128 - 128 - - - - - - - 192 - 192 - 192 - - - - - - - 255 - 255 - 255 - - - - - - - 223 - 223 - 223 - - - - - - - 128 - 128 - 128 - - - - - - - 160 - 160 - 164 - - - - - - - 128 - 128 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 128 - 128 - 128 - - - - - - - 192 - 192 - 192 - - - - - - - 192 - 192 - 192 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - + + 128 + 128 + 128 + + + 192 + 192 + 192 + + + 255 + 255 + 255 + + + 223 + 223 + 223 + + + 128 + 128 + 128 + + + 160 + 160 + 164 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 192 + 192 + 192 + + + 192 + 192 + 192 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 255 + + + 255 + 0 + 255 + + + 231 + 231 + 231 + - - - - 128 - 128 - 128 - - - - - - - 192 - 192 - 192 - - - - - - - 255 - 255 - 255 - - - - - - - 223 - 223 - 223 - - - - - - - 128 - 128 - 128 - - - - - - - 160 - 160 - 164 - - - - - - - 128 - 128 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 128 - 128 - 128 - - - - - - - 192 - 192 - 192 - - - - - - - 192 - 192 - 192 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - + + 128 + 128 + 128 + + + 192 + 192 + 192 + + + 255 + 255 + 255 + + + 223 + 223 + 223 + + + 128 + 128 + 128 + + + 160 + 160 + 164 + + + 128 + 128 + 128 + + + 255 + 255 + 255 + + + 128 + 128 + 128 + + + 192 + 192 + 192 + + + 192 + 192 + 192 + + + 0 + 0 + 0 + + + 0 + 0 + 128 + + + 255 + 255 + 255 + + + 0 + 0 + 255 + + + 255 + 0 + 255 + + + 231 + 231 + 231 + @@ -885,7 +681,7 @@ 6 - + @@ -901,7 +697,7 @@ 6 - + @@ -917,18 +713,14 @@ 6 - - - true - - + - + @@ -983,17 +775,21 @@ + ClickLabel QLabel
widgets/clicklabel.h
+ 0 +
DistName - QWidget +
widgets/distname.h
1 +
diff --git a/ui/CertExtend.ui b/ui/CertExtend.ui index 0694827c..c572b2cc 100644 --- a/ui/CertExtend.ui +++ b/ui/CertExtend.ui @@ -1,4 +1,7 @@ + + + CertExtend @@ -143,10 +146,10 @@ - + - + @@ -302,22 +305,16 @@ + Validity - QWidget +
widgets/validity.h
1 +
- - validNumber - validRange - midnightCB - applyTime - PushButton2 - PushButton3 - diff --git a/ui/ExportCert.ui b/ui/ExportCert.ui index d043dfd2..c127b768 100644 --- a/ui/ExportCert.ui +++ b/ui/ExportCert.ui @@ -350,11 +350,8 @@ qPixmapFromMimeSource filename - fileBut - exportFormat PushButton7 PushButton9 - tinyCaName diff --git a/ui/ExportDer.ui b/ui/ExportDer.ui index 99682a7e..605f75c2 100644 --- a/ui/ExportDer.ui +++ b/ui/ExportDer.ui @@ -252,8 +252,6 @@ p, li { white-space: pre-wrap; } qPixmapFromMimeSource filename - fileBut - exportFormat PushButton7 PushButton9 diff --git a/ui/ExportKey.ui b/ui/ExportKey.ui index f25f47ea..3bd3e80d 100644 --- a/ui/ExportKey.ui +++ b/ui/ExportKey.ui @@ -6,7 +6,7 @@ 0 0 419 - 404 + 396 @@ -274,10 +274,7 @@ PKCS#8 is an encrypted official Key-exchange format filename - fileBut - exportFormat exportPrivate - exportPkcs8 encryptKey PushButton7 PushButton9 diff --git a/ui/NewCrl.ui b/ui/NewCrl.ui index c99142e8..24a74401 100644 --- a/ui/NewCrl.ui +++ b/ui/NewCrl.ui @@ -119,10 +119,10 @@ - + - + @@ -247,18 +247,10 @@ Validity - QWidget + QDateTimeEdit
widgets/validity.h
- 1
- - hashAlgo - authKeyId - subAltName - okButton - cancelButton - diff --git a/ui/NewX509.ui b/ui/NewX509.ui index ac2025a4..2b70f4f9 100644 --- a/ui/NewX509.ui +++ b/ui/NewX509.ui @@ -77,7 +77,7 @@ - 4 + 0 @@ -1477,69 +1477,6 @@ Example: 1 - - tabWidget - fromReqCB - reqList - copyReqExtCB - showReqBut - selfSignRB - serialNr - selfQASignRB - foreignSignRB - certList - tempList - applyTemplate - description - countryName - stateOrProvinceName - localityName - organisationName - organisationalUnitName - commonName - emailAddress - extDNobj - extDNname - extDNadd - extDNdel - extDNlist - keyList - hashAlgo - genKeyBUT - basicCA - basicPath - bcCritical - subKey - authKey - validNumber - validRange - midnightCB - applyTime - subAltName - editSubAlt - issAltName - editIssAlt - crlDist - editCrlDist - aiaOid - authInfAcc - editAuthInfAcc - kuCritical - keyUsage - ekuCritical - ekeyUsage - certPol - nsCertType - nsBaseUrl - nsRevocationUrl - nsCARevocationUrl - nsRenewalUrl - nsCaPolicyUrl - nsSslServerName - nsComment - okButton - cancelButton - diff --git a/ui/TrustState.ui b/ui/TrustState.ui index ec851bbb..884669ba 100644 --- a/ui/TrustState.ui +++ b/ui/TrustState.ui @@ -1,4 +1,7 @@ + + + TrustState @@ -192,20 +195,16 @@ + ClickLabel - QLabel +
widgets/clicklabel.h
+ 0 +
- - trust0 - trust1 - trust2 - PushButton4 - PushButton5 - diff --git a/widgets/CrlDetail.cpp b/widgets/CrlDetail.cpp index 1177c18d..bf7193ac 100644 --- a/widgets/CrlDetail.cpp +++ b/widgets/CrlDetail.cpp @@ -78,36 +78,51 @@ CrlDetail::CrlDetail(MainWindow *mainwin) void CrlDetail::setCrl(pki_crl *crl) { int numc, i; - pki_x509 *iss, *rev; + pki_x509 *iss, *last, *rev; x509rev revit; x509v3ext e1, e2; QStringList sl; - iss = crl->getIssuer(); + last = NULL; + iss = NULL; + if (mw->certs != NULL) { + while ((iss = mw->certs->getBySubject(crl->getIssuerName(), + last)) != NULL) { + pki_key *key = iss->getPubKey(); + if (crl->verify(key)) { + delete key; + break; + } + delete key; + last = iss; + } + } // page 1 if (iss != NULL) { issuerIntName->setText(iss->getIntName()); pki_key *key = iss->getPubKey(); if (crl->verify(key)) { signCheck->setText(tr("Ok")); - signCheck->setGreen(); - } else { + signCheck->setGreen(); + } + else { signCheck->setText(tr("Failed")); - signCheck->setRed(); + signCheck->setRed(); } if (key) delete key; - } else { + } + else { issuerIntName->setText(tr("Unknown signer")); issuerIntName->setDisabled(true); - signCheck->setText(tr("Verification not possible")); - signCheck->setDisabled(true); + signCheck->setText(tr("Verification not possible")); + signCheck->setDisabled(true); } descr->setText(crl->getIntName()); - lUpdate->setText(crl->getLastUpdate().toPretty()); - nUpdate->setText(crl->getNextUpdate().toPretty()); - version->setText((++crl->getVersion()).toHex()); + lUpdate->setText(crl->getLastUpdate().toPretty()); + nUpdate->setText(crl->getNextUpdate().toPretty()); + version->setText((++crl->getVersion()).toHex()); // page 2 issuer->setX509name(crl->getIssuerName()); @@ -117,17 +132,17 @@ void CrlDetail::setCrl(pki_crl *crl) for (i=0; igetRev(i); - rev = mw->certs->getByIssSerial(iss, revit.getSerial()); - current = new QTreeWidgetItem(certList); - if (rev != NULL) { - current->setText(0, rev->getIntName() ); - } else { - current->setText(0, tr("Unknown certificate")); - } - current->setIcon(0, *pki_x509::icon[2]); - current->setText(1, revit.getSerial().toHex()) ; - current->setText(2, revit.getDate().toSortable()); - } + rev = mw->certs->getByIssSerial(iss, revit.getSerial()); + current = new QTreeWidgetItem(certList); + if (rev != NULL) { + current->setText(0, rev->getIntName() ); + } else { + current->setText(0, tr("Unknown certificate")); + } + current->setIcon(0, *pki_x509::icon[2]); + current->setText(1, revit.getSerial().toHex()) ; + current->setText(2, revit.getDate().toSortable()); + } // page 4 v3extensions->document()->setHtml(crl->printV3ext()); } diff --git a/widgets/MW_help.cpp b/widgets/MW_help.cpp index c470c87f..348e37d0 100644 --- a/widgets/MW_help.cpp +++ b/widgets/MW_help.cpp @@ -117,6 +117,7 @@ void MainWindow::help() ui.setupUi(h); path = QString("file://" + getPrefix() + QDir::separator() +"xca.html"); + printf("Help URI = '%s'\n", CCHAR(path)); ui.textbox->setSource(QUrl(path)); h->setWindowTitle(tr(XCA_TITLE)); h->exec();