diff --git a/widgets/NewX509.cpp b/widgets/NewX509.cpp index 8b9f37b3..ced99e9d 100644 --- a/widgets/NewX509.cpp +++ b/widgets/NewX509.cpp @@ -537,7 +537,6 @@ void NewX509::newKeyDone(QString name) { keyList->insertItem(0, name); keyList->setCurrentIndex(0); - //on_keyList_highlighted(name); toggleOkBut(); } @@ -677,14 +676,18 @@ void NewX509::editV3ext(QLineEdit *le, QString types, int n) void NewX509::on_editSubAlt_clicked() { - editV3ext(subAltName, "email,email:copy,RID,URI,DNS,IP,otherName", - NID_subject_alt_name); + QString s = "email,RID,URI,DNS,IP,otherName"; + if (pt != x509_req) + s = QString("email:copy,") + s; + editV3ext(subAltName, s, NID_subject_alt_name); } void NewX509::on_editIssAlt_clicked() { - editV3ext(issAltName, "email,RID,URI,DNS,IP,issuer:copy,otherName", - NID_issuer_alt_name); + QString s = "email,RID,URI,DNS,IP,otherName"; + if (pt != x509_req) + s = QString("issuer:copy,"); + editV3ext(issAltName, s, NID_issuer_alt_name); } void NewX509::on_editCrlDist_clicked() diff --git a/widgets/NewX509_ext.cpp b/widgets/NewX509_ext.cpp index b352553b..bdc8b675 100644 --- a/widgets/NewX509_ext.cpp +++ b/widgets/NewX509_ext.cpp @@ -155,14 +155,32 @@ x509v3ext NewX509::getEkeyUsage() x509v3ext NewX509::getSubAltName() { x509v3ext ext; - ext.create(NID_subject_alt_name, subAltName->text(), &ext_ctx); + QString s = subAltName->text(); + if (pt == x509_req) { + QStringList sn, sl = s.split(','); + foreach (QString str, sl) { + if (str != "email:copy") + sn += str; + } + s = sn.join(","); + } + ext.create(NID_subject_alt_name, s, &ext_ctx); return ext; } x509v3ext NewX509::getIssAltName() { x509v3ext ext; - ext.create(NID_issuer_alt_name, issAltName->text(), &ext_ctx); + QString s = issAltName->text(); + if (pt == x509_req) { + QStringList sn, sl = s.split(','); + foreach (QString str, sl) { + if (str != "issuer:copy") + sn += str; + } + s = sn.join(","); + } + ext.create(NID_issuer_alt_name, s, &ext_ctx); return ext; }