From 3fd9a4d42674ebe1cd89cd4defef05100c52d5e6 Mon Sep 17 00:00:00 2001 From: chris2511 Date: Fri, 4 Jul 2003 16:13:21 +0000 Subject: [PATCH] extensions do work now --- view/CertView.cpp | 3 ++- widgets/NewX509_ext.cpp | 18 +++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/view/CertView.cpp b/view/CertView.cpp index 04f27395..a4119b4f 100644 --- a/view/CertView.cpp +++ b/view/CertView.cpp @@ -154,9 +154,10 @@ void CertView::newCert(NewX509 *dlg) // initially create cert cert = new pki_x509(); cert->setIntName(intname); - cert->setPubKey(clientkey); cert->setSubject(subject); + cert->setPubKey(clientkey); dlg->initCtx(cert); + // Step 2 - select Signing if (dlg->foreignSignRB->isChecked()) { signcert = dlg->getSelectedSigner(); diff --git a/widgets/NewX509_ext.cpp b/widgets/NewX509_ext.cpp index 0f6fd805..ca0e266a 100644 --- a/widgets/NewX509_ext.cpp +++ b/widgets/NewX509_ext.cpp @@ -95,7 +95,7 @@ x509v3ext NewX509::getSubKeyIdent() { x509v3ext ext; if (subKey->isChecked()) - ext.create(NID_subject_key_identifier, "hash"); + ext.create(NID_subject_key_identifier, "hash", &ext_ctx); return ext; } @@ -103,7 +103,7 @@ x509v3ext NewX509::getSubKeyIdent() x509v3ext NewX509::getAuthKeyIdent() { x509v3ext ext; - if (subKey->isChecked()) + if (authKey->isChecked()) ext.create(NID_authority_key_identifier, "keyid:always,issuer:always", &ext_ctx); return ext; @@ -153,7 +153,8 @@ x509v3ext NewX509::getSubAltName() x509v3ext ext; if (subAltCp->isChecked() && subAltCp->isEnabled()) cont << (QString)"email:" + emailAddress->text(); - cont << subAltName->text(); + if (!subAltName->text().isEmpty()) + cont << subAltName->text(); ext.create(NID_subject_alt_name, cont.join(", ")); return ext; } @@ -164,7 +165,8 @@ x509v3ext NewX509::getIssAltName() x509v3ext ext; if (issAltCp->isChecked() && issAltCp->isEnabled()) cont << (QString)"issuer:copy"; - cont << subAltName->text(); + if (!issAltName->text().isEmpty()) + cont << issAltName->text(); ext.create(NID_subject_alt_name, cont.join(", "), &ext_ctx); return ext; } @@ -209,11 +211,13 @@ extList NewX509::getNetscapeExt() void NewX509::initCtx(pki_x509 *subj) { pki_x509 *iss = getSelectedSigner(); + //pki_key *key = getSelectedKey(); X509 *s = NULL, *s1 = NULL; + EVP_PKEY *k = NULL; if (iss) s = iss->getCert(); if (subj) s1 = subj->getCert(); - - X509V3_set_ctx(&ext_ctx, s , s1, NULL, NULL, 0); + //if (key) k = key->getKey(); + X509V3_set_ctx(&ext_ctx, s, s1, NULL, NULL, 0); } void NewX509::setExt(const x509v3ext &ext) @@ -226,7 +230,7 @@ void NewX509::setExt(const x509v3ext &ext) QString NewX509::createRequestText() { - + return "---"; extList ne; ne << getBasicConstraints();