Fix uninitialized/Null pointer segfault

This commit is contained in:
Christian Hohnstaedt 2006-12-13 21:37:36 +01:00
parent da95466b5f
commit 141f0e0218
25 changed files with 487 additions and 687 deletions

View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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();
}

View File

@ -49,6 +49,7 @@
#include "pki_crl.h"
#include "widgets/MainWindow.h"
#include <Qt/qdir.h>
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();
}

View File

@ -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) {

View File

@ -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

View File

@ -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);

View File

@ -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));

View File

@ -1,4 +1,7 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>CertDetail</class>
<widget class="QDialog" name="CertDetail" >
<property name="geometry" >
@ -84,9 +87,6 @@
</item>
<item>
<widget class="QTabWidget" name="Widget" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="unnamed" >
<attribute name="title" >
<string>S&amp;tatus</string>
@ -184,469 +184,265 @@
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>223</red>
<green>223</green>
<blue>223</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>160</red>
<green>160</green>
<blue>164</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>223</red>
<green>223</green>
<blue>223</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>160</red>
<green>160</green>
<blue>164</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
<color>
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
<color>
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>223</red>
<green>223</green>
<blue>223</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>160</red>
<green>160</green>
<blue>164</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>223</red>
<green>223</green>
<blue>223</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>160</red>
<green>160</green>
<blue>164</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
<color>
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
<color>
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>223</red>
<green>223</green>
<blue>223</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>160</red>
<green>160</green>
<blue>164</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>223</red>
<green>223</green>
<blue>223</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>160</red>
<green>160</green>
<blue>164</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
<color>
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
<color>
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</disabled>
</palette>
</property>
@ -885,7 +681,7 @@
<number>6</number>
</property>
<item>
<widget class="DistName" native="1" name="subject" />
<widget class="DistName" name="subject" />
</item>
</layout>
</widget>
@ -901,7 +697,7 @@
<number>6</number>
</property>
<item>
<widget class="DistName" native="1" name="issuer" />
<widget class="DistName" name="issuer" />
</item>
</layout>
</widget>
@ -917,18 +713,14 @@
<number>6</number>
</property>
<item>
<widget class="QTextEdit" name="v3extensions" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="v3extensions" />
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QWidget" native="1" name="widget" />
<widget class="QWidget" name="widget" />
</item>
<item>
<layout class="QHBoxLayout" >
@ -983,17 +775,21 @@
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>ClickLabel</class>
<extends>QLabel</extends>
<header>widgets/clicklabel.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>DistName</class>
<extends>QWidget</extends>
<extends></extends>
<header>widgets/distname.h</header>
<container>1</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
<resources/>

View File

@ -1,4 +1,7 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>CertExtend</class>
<widget class="QDialog" name="CertExtend" >
<property name="geometry" >
@ -143,10 +146,10 @@
</widget>
</item>
<item row="0" column="1" >
<widget class="Validity" native="1" name="notBefore" />
<widget class="Validity" name="notBefore" />
</item>
<item row="1" column="1" >
<widget class="Validity" native="1" name="notAfter" />
<widget class="Validity" name="notAfter" />
</item>
</layout>
</item>
@ -302,22 +305,16 @@
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>Validity</class>
<extends>QWidget</extends>
<extends></extends>
<header>widgets/validity.h</header>
<container>1</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>validNumber</tabstop>
<tabstop>validRange</tabstop>
<tabstop>midnightCB</tabstop>
<tabstop>applyTime</tabstop>
<tabstop>PushButton2</tabstop>
<tabstop>PushButton3</tabstop>
</tabstops>
<resources/>
<connections>
<connection>

View File

@ -350,11 +350,8 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<tabstops>
<tabstop>filename</tabstop>
<tabstop>fileBut</tabstop>
<tabstop>exportFormat</tabstop>
<tabstop>PushButton7</tabstop>
<tabstop>PushButton9</tabstop>
<tabstop>tinyCaName</tabstop>
</tabstops>
<resources/>
<connections>

View File

@ -252,8 +252,6 @@ p, li { white-space: pre-wrap; }
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<tabstops>
<tabstop>filename</tabstop>
<tabstop>fileBut</tabstop>
<tabstop>exportFormat</tabstop>
<tabstop>PushButton7</tabstop>
<tabstop>PushButton9</tabstop>
</tabstops>

View File

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>419</width>
<height>404</height>
<height>396</height>
</rect>
</property>
<property name="windowTitle" >
@ -274,10 +274,7 @@ PKCS#8 is an encrypted official Key-exchange format</string>
</widget>
<tabstops>
<tabstop>filename</tabstop>
<tabstop>fileBut</tabstop>
<tabstop>exportFormat</tabstop>
<tabstop>exportPrivate</tabstop>
<tabstop>exportPkcs8</tabstop>
<tabstop>encryptKey</tabstop>
<tabstop>PushButton7</tabstop>
<tabstop>PushButton9</tabstop>

View File

@ -119,10 +119,10 @@
</widget>
</item>
<item row="0" column="1" >
<widget class="Validity" native="1" name="lastUpdate" />
<widget class="Validity" name="lastUpdate" />
</item>
<item row="1" column="1" >
<widget class="Validity" native="1" name="nextUpdate" />
<widget class="Validity" name="nextUpdate" />
</item>
</layout>
</widget>
@ -247,18 +247,10 @@
<customwidgets>
<customwidget>
<class>Validity</class>
<extends>QWidget</extends>
<extends>QDateTimeEdit</extends>
<header>widgets/validity.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>hashAlgo</tabstop>
<tabstop>authKeyId</tabstop>
<tabstop>subAltName</tabstop>
<tabstop>okButton</tabstop>
<tabstop>cancelButton</tabstop>
</tabstops>
<resources/>
<connections>
<connection>

View File

@ -77,7 +77,7 @@
<item>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>4</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_0" >
<attribute name="title" >
@ -1477,69 +1477,6 @@ Example:
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>fromReqCB</tabstop>
<tabstop>reqList</tabstop>
<tabstop>copyReqExtCB</tabstop>
<tabstop>showReqBut</tabstop>
<tabstop>selfSignRB</tabstop>
<tabstop>serialNr</tabstop>
<tabstop>selfQASignRB</tabstop>
<tabstop>foreignSignRB</tabstop>
<tabstop>certList</tabstop>
<tabstop>tempList</tabstop>
<tabstop>applyTemplate</tabstop>
<tabstop>description</tabstop>
<tabstop>countryName</tabstop>
<tabstop>stateOrProvinceName</tabstop>
<tabstop>localityName</tabstop>
<tabstop>organisationName</tabstop>
<tabstop>organisationalUnitName</tabstop>
<tabstop>commonName</tabstop>
<tabstop>emailAddress</tabstop>
<tabstop>extDNobj</tabstop>
<tabstop>extDNname</tabstop>
<tabstop>extDNadd</tabstop>
<tabstop>extDNdel</tabstop>
<tabstop>extDNlist</tabstop>
<tabstop>keyList</tabstop>
<tabstop>hashAlgo</tabstop>
<tabstop>genKeyBUT</tabstop>
<tabstop>basicCA</tabstop>
<tabstop>basicPath</tabstop>
<tabstop>bcCritical</tabstop>
<tabstop>subKey</tabstop>
<tabstop>authKey</tabstop>
<tabstop>validNumber</tabstop>
<tabstop>validRange</tabstop>
<tabstop>midnightCB</tabstop>
<tabstop>applyTime</tabstop>
<tabstop>subAltName</tabstop>
<tabstop>editSubAlt</tabstop>
<tabstop>issAltName</tabstop>
<tabstop>editIssAlt</tabstop>
<tabstop>crlDist</tabstop>
<tabstop>editCrlDist</tabstop>
<tabstop>aiaOid</tabstop>
<tabstop>authInfAcc</tabstop>
<tabstop>editAuthInfAcc</tabstop>
<tabstop>kuCritical</tabstop>
<tabstop>keyUsage</tabstop>
<tabstop>ekuCritical</tabstop>
<tabstop>ekeyUsage</tabstop>
<tabstop>certPol</tabstop>
<tabstop>nsCertType</tabstop>
<tabstop>nsBaseUrl</tabstop>
<tabstop>nsRevocationUrl</tabstop>
<tabstop>nsCARevocationUrl</tabstop>
<tabstop>nsRenewalUrl</tabstop>
<tabstop>nsCaPolicyUrl</tabstop>
<tabstop>nsSslServerName</tabstop>
<tabstop>nsComment</tabstop>
<tabstop>okButton</tabstop>
<tabstop>cancelButton</tabstop>
</tabstops>
<resources/>
<connections>
<connection>

View File

@ -1,4 +1,7 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>TrustState</class>
<widget class="QDialog" name="TrustState" >
<property name="geometry" >
@ -192,20 +195,16 @@
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>ClickLabel</class>
<extends>QLabel</extends>
<extends></extends>
<header>widgets/clicklabel.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>trust0</tabstop>
<tabstop>trust1</tabstop>
<tabstop>trust2</tabstop>
<tabstop>PushButton4</tabstop>
<tabstop>PushButton5</tabstop>
</tabstops>
<resources/>
<connections>
<connection>

View File

@ -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; i<numc; i++) {
QTreeWidgetItem *current;
revit = crl->getRev(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());
}

View File

@ -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();