Close #72: Add checkbox for OCSP staple feature

Also support them in XCA template and transformation from
certificate and request.
This commit is contained in:
Christian Hohnstaedt 2020-03-23 16:33:26 +01:00
parent 6582c225d2
commit 4f1103a64f
7 changed files with 37 additions and 0 deletions

View File

@ -18,6 +18,10 @@
#include "widgets/XcaWarning.h"
#include "widgets/MainWindow.h"
#ifndef NID_tlsfeature
int NID_tlsfeature = NID_undef;
#endif
int first_additional_oid = 0;
NIDlist extkeyuse_nid;
@ -194,6 +198,10 @@ void initOIDs()
QString dir = getPrefix();
first_additional_oid = OBJ_new_nid(0);
#ifndef NID_tlsfeature
NID_tlsfeature = OBJ_create("1.3.6.1.5.5.7.1.24", "tlsfeature",
"TLS Feature");
#endif
openssl_error();
for (int i=0; i<first_additional_oid;i++)
addToLowerMap(i);

View File

@ -14,6 +14,9 @@ class QString;
typedef QList<int> NIDlist;
#ifndef NID_tlsfeature
extern int NID_tlsfeature;
#endif
extern NIDlist extkeyuse_nid;
extern NIDlist distname_nid;

View File

@ -44,6 +44,7 @@ const QList<QString> pki_temp::tmpl_keys = {
"eKeyUse",
"adv_ext",
"noWellDefinedExpDate",
"OCSPstaple",
};
pki_temp::pki_temp(const pki_temp *pk)
@ -207,6 +208,7 @@ extList pki_temp::fromCert(pki_x509super *cert_or_req)
}
settings["authKey"] = el.delByNid(NID_authority_key_identifier) ? "1" : "0";
settings["subKey"] = el.delByNid(NID_subject_key_identifier) ? "1" : "0";
settings["OCSPstaple"] = el.delByNid(NID_tlsfeature) ? "1" : "0";
int nsCT = bitsToInt(el, NID_netscape_cert_type, NULL);
/* bit 4 is unused. Move higher bits down. */

View File

@ -854,6 +854,13 @@
<item row="2" column="0">
<widget class="DoubleClickLabel" name="crldpLbl"/>
</item>
<item row="4" column="2">
<widget class="QCheckBox" name="OCSPstaple">
<property name="text">
<string notr="true">OCSP Must Staple</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -272,6 +272,7 @@ NewX509::NewX509(QWidget *parent)
MAP_CB(ekuCritical);
MAP_CB(subKey);
MAP_CB(authKey);
MAP_CB(OCSPstaple);
MAP_CB(validMidn);
MAP_CB(noWellDefinedExpDate);
}

View File

@ -91,6 +91,7 @@ class NewX509: public QDialog, public Ui::NewX509
x509v3ext getBasicConstraints();
x509v3ext getSubKeyIdent();
x509v3ext getAuthKeyIdent();
x509v3ext getOCSPstaple();
x509v3ext getKeyUsage();
x509v3ext getEkeyUsage();
x509v3ext getSubAltName();

View File

@ -49,6 +49,20 @@ x509v3ext NewX509::getSubKeyIdent()
}
x509v3ext NewX509::getOCSPstaple()
{
x509v3ext ext;
if (OCSPstaple->isChecked())
ext.create(NID_tlsfeature,
#ifdef NID_tlsfeature
"status_request",
#else
"DER:30:03:02:01:05",
#endif
&ext_ctx);
return ext;
}
x509v3ext NewX509::getAuthKeyIdent()
{
x509v3ext ext;
@ -228,6 +242,7 @@ extList NewX509::getGuiExt()
ne << getIssAltName();
ne << getCrlDist();
ne << getAuthInfAcc();
ne << getOCSPstaple();
openssl_error();
return ne;
}