Consolidate more "established x509 terms"

like basic constraints, key usage and netscape-thingies
This commit is contained in:
Christian Hohnstaedt 2014-11-14 19:31:08 +01:00
parent bf322290ed
commit b131e1d293
6 changed files with 113 additions and 209 deletions

View File

@ -651,13 +651,14 @@ void db_base::showHeaderMenu(QContextMenuEvent *e, int sect)
void db_base::contextMenu(QContextMenuEvent *e, QMenu *parent, int)
{
int shown = 0;
tipMenu *menu, *dn, *v3ext, *current;
tipMenu *menu, *dn, *v3ext, *current, *v3ns;
QAction *a, *sep;
dbheader *hd;
menu = new tipMenu(QString(), mainwin);
dn = new tipMenu(tr("Subject entries"), mainwin);
v3ext = new tipMenu(tr("X509v3 Extensions"), mainwin);
v3ns = new tipMenu(tr("Netscape extensions"), mainwin);
menu->addAction(tr("Reset"), this, SLOT(columnResetDefaults()));
sep = menu->addSeparator();
foreach(hd, allHeaders) {
@ -668,6 +669,9 @@ void db_base::contextMenu(QContextMenuEvent *e, QMenu *parent, int)
case dbheader::hd_v3ext:
current = v3ext;
break;
case dbheader::hd_v3ext_ns:
current = v3ns;
break;
default:
current = menu;
break;
@ -686,11 +690,18 @@ void db_base::contextMenu(QContextMenuEvent *e, QMenu *parent, int)
else
delete dn;
if (!v3ext->isEmpty())
if (!v3ext->isEmpty()) {
if (!v3ns->isEmpty()) {
v3ext->addSeparator();
v3ext->addMenu(v3ns);
} else {
delete v3ns;
}
menu->insertMenu(sep, v3ext);
else
} else {
delete v3ext;
delete v3ns;
}
if (parent) {
parent->addAction(tr("Paste PEM data"), mainwin,
SLOT(pastePem()));

View File

@ -43,6 +43,7 @@ db_x509name::db_x509name(QString db, MainWindow *mw)
dn_translations[NID_pkcs9_unstructuredName] = tr("Unstructured name");
dn_translations[NID_pkcs9_challengePassword] = tr("Challenge password");
dn_translations[NID_basic_constraints] = tr("Basic Constraints");
dn_translations[NID_subject_alt_name] = tr("subject alternative name");
dn_translations[NID_issuer_alt_name] = tr("issuer alternative name");
dn_translations[NID_subject_key_identifier] = tr("Subject key identifier");
@ -61,13 +62,13 @@ db_x509name::db_x509name(QString db, MainWindow *mw)
dn_translations[NID_netscape_comment] = tr("Comment");
}
foreach(int nid, *MainWindow::dn_nid)
allHeaders << new dn_dbheader(nid);
allHeaders << new nid_dbheader(nid, dbheader::hd_x509name);
}
db_x509super::db_x509super(QString db, MainWindow *mw)
:db_x509name(db, mw)
{
NIDlist v3nid;
NIDlist v3nid, v3ns_nid;
v3nid <<
NID_subject_alt_name <<
NID_issuer_alt_name <<
@ -76,7 +77,8 @@ db_x509super::db_x509super(QString db, MainWindow *mw)
NID_key_usage <<
NID_ext_key_usage <<
NID_crl_distribution_points <<
NID_info_access <<
NID_info_access;
v3ns_nid <<
NID_netscape_cert_type <<
NID_netscape_base_url <<
NID_netscape_revocation_url <<
@ -90,7 +92,10 @@ db_x509super::db_x509super(QString db, MainWindow *mw)
tr("Internal name of the key"));
foreach(int nid, v3nid)
allHeaders << new v3e_dbheader(nid);
allHeaders << new nid_dbheader(nid, dbheader::hd_v3ext);
foreach(int nid, v3ns_nid)
allHeaders << new nid_dbheader(nid, dbheader::hd_v3ext_ns);
}
void db_x509super::delKey(pki_key *delkey)

View File

@ -68,6 +68,7 @@ class dbheader
hd_default,
hd_x509name,
hd_v3ext,
hd_v3ext_ns,
};
int id;
bool show;
@ -164,15 +165,16 @@ class dbheader
}
};
class dn_dbheader : public dbheader
class nid_dbheader : public dbheader
{
private:
QString sn;
public:
dn_dbheader(int aid) : dbheader(aid, aid == NID_commonName)
nid_dbheader(int aid, enum hdr_type atype)
: dbheader(aid, aid == NID_commonName)
{
type = hd_x509name;
type = atype;
tooltip = dn_translations[id];
name = OBJ_nid2ln(id);
sn = OBJ_nid2sn(id);
@ -190,15 +192,6 @@ class dn_dbheader : public dbheader
}
};
class v3e_dbheader : public dn_dbheader
{
public:
v3e_dbheader(int aid) : dn_dbheader(aid)
{
type = hd_v3ext;
}
};
class dbheaderList: public QList<dbheader*>
{
public:

View File

@ -57,7 +57,7 @@ QVariant pki_x509super::column_data(dbheader *hd)
return QVariant("");
return QVariant(privkey->getIntName());
}
if (hd->type == dbheader::hd_v3ext) {
if (hd->type == dbheader::hd_v3ext || hd->type == dbheader::hd_v3ext_ns) {
extList el = getV3ext();
int idx = el.idxByNid(hd->id);
if (idx == -1)

View File

@ -68,7 +68,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_0">
<attribute name="title">
@ -523,12 +523,6 @@
<layout class="QHBoxLayout" name="_6">
<item>
<widget class="QGroupBox" name="bcBox">
<property name="toolTip">
<string>Basic constraints</string>
</property>
<property name="title">
<string notr="true">Basic constraints</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QLabel" name="TextLabel2_2_3">
@ -775,14 +769,7 @@
<item>
<layout class="QGridLayout" name="gridLayout_12">
<item row="0" column="0">
<widget class="QLabel" name="sanLbl">
<property name="toolTip">
<string>subject alternative name</string>
</property>
<property name="text">
<string notr="true">subject alternative name</string>
</property>
</widget>
<widget class="QLabel" name="sanLbl"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="subAltIco">
@ -818,14 +805,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="ianLbl">
<property name="toolTip">
<string>issuer alternative name</string>
</property>
<property name="text">
<string notr="true">issuer alternative name</string>
</property>
</widget>
<widget class="QLabel" name="ianLbl"/>
</item>
<item row="1" column="2" colspan="2">
<widget class="QLineEdit" name="issAltName">
@ -875,14 +855,7 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="aiaLbl">
<property name="toolTip">
<string>Authority Info Access</string>
</property>
<property name="text">
<string notr="true">Authority Info Access</string>
</property>
</widget>
<widget class="QLabel" name="aiaLbl"/>
</item>
<item row="3" column="1">
<widget class="QLabel" name="authInfAccIco">
@ -944,14 +917,7 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="crldpLbl">
<property name="toolTip">
<string>CRL distribution point</string>
</property>
<property name="text">
<string notr="true">CRL distribution point</string>
</property>
</widget>
<widget class="QLabel" name="crldpLbl"/>
</item>
</layout>
</item>
@ -978,12 +944,6 @@
</property>
<item>
<widget class="QGroupBox" name="kuBox">
<property name="toolTip">
<string>Key usage</string>
</property>
<property name="title">
<string notr="true">Key usage</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
@ -1058,12 +1018,6 @@
</item>
<item>
<widget class="QGroupBox" name="ekuBox">
<property name="toolTip">
<string>Extended key usage</string>
</property>
<property name="title">
<string notr="true">Extended key usage</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
@ -1099,61 +1053,55 @@
<attribute name="title">
<string>Netscape</string>
</attribute>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>8</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QListWidget" name="nsCertType">
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
<item>
<property name="text">
<string notr="true">SSL Client</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">SSL Server</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">S/MIME</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Object Signing</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">SSL CA</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">S/MIME CA</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Object Signing CA</string>
</property>
</item>
<widget class="QGroupBox" name="nsCertTypeBox">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QListWidget" name="nsCertType">
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
<item>
<property name="text">
<string notr="true">SSL Client</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">SSL Server</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">S/MIME</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Object Signing</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">SSL CA</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">S/MIME CA</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Object Signing CA</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
@ -1228,37 +1176,16 @@
<widget class="QLineEdit" name="nsCaPolicyUrl"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="nsCaRevLbl">
<property name="toolTip">
<string>CA Revocation URL</string>
</property>
<property name="text">
<string notr="true">CA Revocation URL</string>
</property>
</widget>
<widget class="QLabel" name="nsCaRevLbl"/>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="nsSslServerName"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="nsRevLbl">
<property name="toolTip">
<string>Revocation URL</string>
</property>
<property name="text">
<string notr="true">Revocation URL</string>
</property>
</widget>
<widget class="QLabel" name="nsRevLbl"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="nsSslServerLbl">
<property name="toolTip">
<string>SSL server name</string>
</property>
<property name="text">
<string notr="true">SSL server name</string>
</property>
</widget>
<widget class="QLabel" name="nsSslServerLbl"/>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nsBaseUrl"/>
@ -1267,44 +1194,16 @@
<widget class="QLineEdit" name="nsCARevocationUrl"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="nsRenewLbl">
<property name="toolTip">
<string>Certificate renewal URL</string>
</property>
<property name="text">
<string notr="true">Certificate renewal URL</string>
</property>
</widget>
<widget class="QLabel" name="nsRenewLbl"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="nsCommentLbl">
<property name="toolTip">
<string>Comment</string>
</property>
<property name="text">
<string notr="true">Comment</string>
</property>
</widget>
<widget class="QLabel" name="nsCommentLbl"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="nsCaPolicyLbl">
<property name="toolTip">
<string>CA policy URL</string>
</property>
<property name="text">
<string notr="true">CA policy URL</string>
</property>
</widget>
<widget class="QLabel" name="nsCaPolicyLbl"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="nsBaseLbl">
<property name="toolTip">
<string>Base URL</string>
</property>
<property name="text">
<string notr="true">Base URL</string>
</property>
</widget>
<widget class="QLabel" name="nsBaseLbl"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="nsRevocationUrl"/>
@ -1319,26 +1218,6 @@
</layout>
</item>
</layout>
<widget class="QWidget" name="widget_3_2" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QWidget" name="widget_5" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="Seite">
<attribute name="title">

View File

@ -227,22 +227,38 @@ NewX509::NewX509(QWidget *parent)
foreach(int nid, nidLabel.keys()) {
QLabel *l = nidLabel[nid];
l->setText(OBJ_nid2ln(nid));
l->setToolTip(dn_translations[nid]);
l->setText(translate_dn ?
dn_translations[nid] : OBJ_nid2ln(nid));
if (l->toolTip().isEmpty()) {
l->setToolTip(translate_dn ?
OBJ_nid2ln(nid) : dn_translations[nid]);
}
}
QMap<int, QGroupBox*> nidGroupBox;
nidGroupBox[NID_basic_constraints] = bcBox;
nidGroupBox[NID_key_usage] = kuBox;
nidGroupBox[NID_ext_key_usage] = ekuBox;
nidGroupBox[NID_netscape_cert_type] = nsCertTypeBox;
foreach(int nid, nidGroupBox.keys()) {
QGroupBox *g = nidGroupBox[nid];
g->setTitle(translate_dn ?
dn_translations[nid] : OBJ_nid2ln(nid));
if (g->toolTip().isEmpty()) {
g->setToolTip(translate_dn ?
OBJ_nid2ln(nid) : dn_translations[nid]);
}
}
if (translate_dn) {
QList<QGroupBox*> gb;
gb << distNameBox << bcBox << keyIdentBox << kuBox << ekuBox;
gb << distNameBox << keyIdentBox;
foreach(QGroupBox *g, gb) {
QString tt = g->toolTip();
g->setToolTip(g->title());
g->setTitle(tt);
}
foreach(QLabel *l, nidLabel.values()) {
QString tt = l->toolTip();
l->setToolTip(l->text());
l->setText(tt);
}
QList<QCheckBox*> cbList;
cbList << bcCritical << kuCritical << ekuCritical;
foreach(QCheckBox* cb, cbList) {