mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
also fixes "#46 AIA, simultaneous OCSP and caIssuers" Move "OCSP/caIssuers" index from a separate drop down into the single dropdown of URI/IP/DNS... This change not only fixes the bug, but also removes some special handling for the AIA extension. Adding features by deleting code is highly appreciated :-)
This commit is contained in:
parent
f244cec5d3
commit
c4eb23f2af
@ -732,14 +732,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="subAltName">
|
||||
<property name="toolTip">
|
||||
<string>DNS: IP: URI: email: RID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="editSubAlt">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
@ -749,14 +749,14 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="DoubleClickLabel" name="ianLbl"/>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="issAltName">
|
||||
<property name="toolTip">
|
||||
<string>DNS: IP: URI: email: RID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="editIssAlt">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
@ -782,14 +782,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="crlDist">
|
||||
<property name="toolTip">
|
||||
<string>URI:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="editCrlDist">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
@ -819,16 +819,13 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="aiaOid"/>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLineEdit" name="authInfAcc">
|
||||
<property name="toolTip">
|
||||
<string>DNS: IP: URI: email: RID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="editAuthInfAcc">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
@ -1288,7 +1285,6 @@
|
||||
<tabstop>editIssAlt</tabstop>
|
||||
<tabstop>crlDist</tabstop>
|
||||
<tabstop>editCrlDist</tabstop>
|
||||
<tabstop>aiaOid</tabstop>
|
||||
<tabstop>authInfAcc</tabstop>
|
||||
<tabstop>editAuthInfAcc</tabstop>
|
||||
<tabstop>kuCritical</tabstop>
|
||||
|
||||
@ -106,7 +106,6 @@ NewX509::NewX509(QWidget *parent)
|
||||
{
|
||||
int i;
|
||||
|
||||
aia_nid << OBJ_sn2nid("OCSP") << OBJ_sn2nid("caIssuers");
|
||||
attr_nid << NID_pkcs9_unstructuredName << NID_pkcs9_challengePassword;
|
||||
QStringList keys;
|
||||
|
||||
@ -174,10 +173,6 @@ NewX509::NewX509(QWidget *parent)
|
||||
foreach(int nid, extkeyuse_nid)
|
||||
ekeyUsage->addItem(OBJ_nid2ln(nid));
|
||||
|
||||
// setup Authority Info Access
|
||||
foreach(int nid, aia_nid)
|
||||
aiaOid->addItem(OBJ_nid2ln(nid));
|
||||
|
||||
// init the X509 v3 context
|
||||
X509V3_set_ctx(&ext_ctx, NULL , NULL, NULL, NULL, 0);
|
||||
X509V3_set_ctx_nodb(&ext_ctx);
|
||||
@ -260,6 +255,7 @@ NewX509::NewX509(QWidget *parent)
|
||||
MAP_LE(subAltName);
|
||||
MAP_LE(issAltName);
|
||||
MAP_LE(crlDist);
|
||||
MAP_LE(authInfAcc);
|
||||
MAP_LE(nsComment);
|
||||
MAP_LE(nsBaseUrl);
|
||||
MAP_LE(nsRevocationUrl);
|
||||
@ -527,7 +523,6 @@ void NewX509::extensionsFromTemplate(pki_temp *temp)
|
||||
QString2lb(ekeyUsage, temp->getSetting("eKeyUse"));
|
||||
validRange->setCurrentIndex(temp->getSettingInt("validM"));
|
||||
nconf_data->document()->setPlainText(temp->getSetting("adv_ext"));
|
||||
setAuthInfAcc_string(temp->getSetting("authInfAcc"));
|
||||
|
||||
on_applyTime_clicked();
|
||||
}
|
||||
@ -554,7 +549,6 @@ void NewX509::toTemplate(pki_temp *temp)
|
||||
temp->setSetting(i.key(), i.value()->isChecked());
|
||||
}
|
||||
|
||||
temp->setSetting("authInfAcc", getAuthInfAcc_string());
|
||||
temp->setSetting("nsCertType", lb2int(nsCertType));
|
||||
temp->setSetting("ca", basicCA->currentIndex());
|
||||
temp->setSetting("keyUse", lb2int(keyUsage));
|
||||
@ -881,14 +875,7 @@ void NewX509::editV3ext(QLineEdit *le, QString types, int n)
|
||||
|
||||
dlg = new v3ext(this);
|
||||
setupTmpCtx();
|
||||
if (n == NID_info_access) {
|
||||
int nid, idx = aiaOid->currentIndex();
|
||||
if (idx >= 0 && idx < aia_nid.size()) {
|
||||
nid = aia_nid[idx];
|
||||
dlg->setPrefix(QString(OBJ_nid2sn(nid)) + ";");
|
||||
}
|
||||
}
|
||||
dlg->addInfo(le, types.split(',' ), n, &ext_ctx);
|
||||
dlg->addInfo(le, types.split(','), n, &ext_ctx);
|
||||
dlg->exec();
|
||||
delete(dlg);
|
||||
}
|
||||
@ -1073,7 +1060,14 @@ void NewX509::on_editCrlDist_clicked()
|
||||
|
||||
void NewX509::on_editAuthInfAcc_clicked()
|
||||
{
|
||||
editV3ext(authInfAcc, "URI,email,RID,DNS,IP", NID_info_access);
|
||||
QStringList permut, groups { "OCSP", "caIssuers" },
|
||||
types{ "URI", "email", "RID", "DNS", "IP" };
|
||||
foreach(QString group, groups) {
|
||||
foreach(QString type, types) {
|
||||
permut << QString("%1;%2").arg(group).arg(type);
|
||||
}
|
||||
}
|
||||
editV3ext(authInfAcc, permut.join(","), NID_info_access);
|
||||
}
|
||||
|
||||
void NewX509::on_tabWidget_currentChanged(int tab)
|
||||
|
||||
@ -88,8 +88,6 @@ class NewX509: public QDialog, public Ui::NewX509
|
||||
pki_x509req *getSelectedReq();
|
||||
x509name getX509name(int _throw = 0);
|
||||
void setX509name(const x509name &n);
|
||||
void setAuthInfAcc_string(QString aia_txt);
|
||||
QString getAuthInfAcc_string();
|
||||
x509v3ext getBasicConstraints();
|
||||
x509v3ext getSubKeyIdent();
|
||||
x509v3ext getAuthKeyIdent();
|
||||
|
||||
@ -141,45 +141,11 @@ x509v3ext NewX509::getCrlDist()
|
||||
return ext;
|
||||
}
|
||||
|
||||
QString NewX509::getAuthInfAcc_string()
|
||||
{
|
||||
QString rval="";
|
||||
QString aia_txt = authInfAcc->text();
|
||||
aia_txt = aia_txt.trimmed();
|
||||
|
||||
if (!aia_txt.isEmpty()) {
|
||||
rval = OBJ_nid2sn(aia_nid[aiaOid->currentIndex()]);
|
||||
rval += ";" + aia_txt;
|
||||
}
|
||||
openssl_error();
|
||||
return rval;
|
||||
}
|
||||
|
||||
void NewX509::setAuthInfAcc_string(QString aia_txt)
|
||||
{
|
||||
int nid, idx;
|
||||
|
||||
idx = aia_txt.indexOf(';');
|
||||
if (idx == -1)
|
||||
return;
|
||||
|
||||
nid = OBJ_txt2nid(CCHAR(aia_txt.left(idx)));
|
||||
|
||||
for (int i=0; i < aia_nid.count(); i++) {
|
||||
if (aia_nid[i] == nid) {
|
||||
aiaOid->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
authInfAcc->setText(aia_txt.mid(idx +1));
|
||||
}
|
||||
|
||||
x509v3ext NewX509::getAuthInfAcc()
|
||||
{
|
||||
x509v3ext ext;
|
||||
QString aia_txt = getAuthInfAcc_string();
|
||||
|
||||
if (!aia_txt.isEmpty()) {
|
||||
ext.create(NID_info_access, aia_txt, &ext_ctx);
|
||||
if (!authInfAcc->text().isEmpty()) {
|
||||
ext.create(NID_info_access, authInfAcc->text(), &ext_ctx);
|
||||
}
|
||||
return ext;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user