mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Select whether to translate established x509 terms
This commit is contained in:
parent
7b4ea0c130
commit
a97b8f9add
@ -11,6 +11,9 @@
|
||||
#include "ui_About.h"
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
bool db_x509name::translate_dn = false;
|
||||
QMap<int, QString> db_x509name::dn_translations;
|
||||
|
||||
db_x509name::db_x509name(QString db, MainWindow *mw)
|
||||
:db_base(db, mw)
|
||||
{
|
||||
@ -20,9 +23,33 @@ db_x509name::db_x509name(QString db, MainWindow *mw)
|
||||
new dbheader(HD_subject_hash, false, tr("Subject hash"),
|
||||
tr("Hash to lookup certs in directories"));
|
||||
|
||||
if (dn_translations.size() == 0) {
|
||||
dn_translations[NID_countryName] = tr("Country code");
|
||||
dn_translations[NID_stateOrProvinceName] = tr("State or Province");
|
||||
dn_translations[NID_localityName] = tr("Locality");
|
||||
dn_translations[NID_organizationName] = tr("Organisation");
|
||||
dn_translations[NID_organizationalUnitName] = tr("Organisational unit");
|
||||
dn_translations[NID_commonName] = tr("Common name");
|
||||
dn_translations[NID_pkcs9_emailAddress] = tr("E-Mail address");
|
||||
dn_translations[NID_serialNumber] = tr("Serial number");
|
||||
dn_translations[NID_givenName] = tr("Given name");
|
||||
dn_translations[NID_surname] = tr("Surname");
|
||||
dn_translations[NID_title] = tr("Title");
|
||||
dn_translations[NID_initials] = tr("Initials");
|
||||
dn_translations[NID_description] = tr("Description");
|
||||
dn_translations[NID_role] = tr("Role");
|
||||
dn_translations[NID_pseudonym] = tr("Pseudonym");
|
||||
dn_translations[NID_generationQualifier] = tr("Generation Qualifier");
|
||||
dn_translations[NID_x500UniqueIdentifier] = tr("x500 Unique Identifier");
|
||||
dn_translations[NID_name] = tr("Name");
|
||||
dn_translations[NID_dnQualifier] = tr("DN Qualifier");
|
||||
dn_translations[NID_pkcs9_unstructuredName] = tr("Unstructured name");
|
||||
dn_translations[NID_pkcs9_challengePassword] = tr("Challenge password");
|
||||
}
|
||||
|
||||
for (int i=0; i < dn_nid.count(); i++) {
|
||||
int nid = dn_nid[i];
|
||||
dbheader *h = new dbheader(nid, nid == NID_commonName);
|
||||
dbheader *h = new dbheader(nid, nid == NID_commonName, QString(), dn_translations[nid]);
|
||||
h->type = dbheader::hd_x509name;
|
||||
allHeaders << h;
|
||||
}
|
||||
|
||||
@ -12,11 +12,14 @@
|
||||
#include "db_key.h"
|
||||
#include "pki_x509super.h"
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
|
||||
class db_x509name: public db_base
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static bool translate_dn;
|
||||
static QMap<int, QString> dn_translations;
|
||||
db_x509name(QString db, MainWindow *mw);
|
||||
};
|
||||
|
||||
|
||||
@ -89,7 +89,8 @@ class dbheader
|
||||
tooltip = atip;
|
||||
if (id > 0 && name.isEmpty()) {
|
||||
name = OBJ_nid2ln(aid);
|
||||
tooltip = OBJ_nid2sn(aid);
|
||||
tooltip = QString("[%1] %2").arg(OBJ_nid2sn(aid))
|
||||
.arg(tooltip);
|
||||
}
|
||||
show = showDefault = ashow;
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ pk11_attlist pki_scard::objectAttributesNoId(EVP_PKEY *pk, bool priv) const
|
||||
pk11_attr_data(CKA_EC_PARAMS, ba);
|
||||
break;
|
||||
default:
|
||||
throw errorEx(tr("Only RSA and EC keys can be stored on tokens"));
|
||||
throw errorEx(QString("Unkown Keytype %d").arg(pk->type));
|
||||
|
||||
}
|
||||
return attrs;
|
||||
@ -410,7 +410,7 @@ void pki_scard::store_token(slotid slot, EVP_PKEY *pkey)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw errorEx(tr("Only RSA, DSA and EC keys can be stored on tokens"));
|
||||
throw errorEx(QString("Unkown Keytype %d").arg(pkey->type));
|
||||
|
||||
}
|
||||
|
||||
|
||||
14
misc/dn.txt
14
misc/dn.txt
@ -6,15 +6,15 @@ O
|
||||
OU
|
||||
CN
|
||||
emailAddress
|
||||
SN
|
||||
title
|
||||
description
|
||||
name
|
||||
serialNumber
|
||||
givenName
|
||||
surname
|
||||
title
|
||||
initials
|
||||
dnQualifier
|
||||
description
|
||||
role
|
||||
pseudonym
|
||||
name
|
||||
dnQualifier
|
||||
generationQualifier
|
||||
x500UniqueIdentifier
|
||||
pseudonym
|
||||
serialNumber
|
||||
|
||||
@ -26,9 +26,6 @@
|
||||
<strikeout>false</strikeout>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -71,7 +68,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_0">
|
||||
<attribute name="title">
|
||||
@ -525,7 +522,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="_6">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_8">
|
||||
<widget class="QGroupBox" name="bcBox">
|
||||
<property name="toolTip">
|
||||
<string>Basic constraints</string>
|
||||
</property>
|
||||
@ -582,7 +579,7 @@
|
||||
<string>The basic constraints should always be critical</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">&Critical</string>
|
||||
<string notr="true">Critical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -778,7 +775,7 @@
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="TextLabel1_2_2_3">
|
||||
<widget class="QLabel" name="sanLbl">
|
||||
<property name="toolTip">
|
||||
<string>subject alternative name</string>
|
||||
</property>
|
||||
@ -821,7 +818,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="TextLabel1_2_2_2">
|
||||
<widget class="QLabel" name="ianLbl">
|
||||
<property name="toolTip">
|
||||
<string>issuer alternative name</string>
|
||||
</property>
|
||||
@ -878,7 +875,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="TextLabel1_2_3_2_2_3">
|
||||
<widget class="QLabel" name="aiaLbl">
|
||||
<property name="toolTip">
|
||||
<string>Authority Info Access</string>
|
||||
</property>
|
||||
@ -947,7 +944,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="TextLabel1_2_3_2_3">
|
||||
<widget class="QLabel" name="crldpLbl">
|
||||
<property name="toolTip">
|
||||
<string>CRL distribution point</string>
|
||||
</property>
|
||||
@ -980,7 +977,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_12">
|
||||
<widget class="QGroupBox" name="kuBox">
|
||||
<property name="toolTip">
|
||||
<string>Key usage</string>
|
||||
</property>
|
||||
@ -997,7 +994,7 @@
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kuCritical">
|
||||
<property name="text">
|
||||
<string notr="true">&Critical</string>
|
||||
<string notr="true">Critical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1060,7 +1057,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_11">
|
||||
<widget class="QGroupBox" name="ekuBox">
|
||||
<property name="toolTip">
|
||||
<string>Extended key usage</string>
|
||||
</property>
|
||||
@ -1077,7 +1074,7 @@
|
||||
<item>
|
||||
<widget class="QCheckBox" name="ekuCritical">
|
||||
<property name="text">
|
||||
<string notr="true">C&ritical</string>
|
||||
<string notr="true">Critical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1231,7 +1228,7 @@
|
||||
<widget class="QLineEdit" name="nsCaPolicyUrl"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="TextLabel2_2_4">
|
||||
<widget class="QLabel" name="nsCaRevLbl">
|
||||
<property name="toolTip">
|
||||
<string>CA Revocation URL</string>
|
||||
</property>
|
||||
@ -1244,7 +1241,7 @@
|
||||
<widget class="QLineEdit" name="nsSslServerName"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="TextLabel4_2_2_3">
|
||||
<widget class="QLabel" name="nsRevLbl">
|
||||
<property name="toolTip">
|
||||
<string>Revocation URL</string>
|
||||
</property>
|
||||
@ -1254,7 +1251,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="TextLabel7_2_3">
|
||||
<widget class="QLabel" name="nsSslServerLbl">
|
||||
<property name="toolTip">
|
||||
<string>SSL server name</string>
|
||||
</property>
|
||||
@ -1270,7 +1267,7 @@
|
||||
<widget class="QLineEdit" name="nsCARevocationUrl"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="TextLabel3_2_4">
|
||||
<widget class="QLabel" name="nsRenewLbl">
|
||||
<property name="toolTip">
|
||||
<string>Certificate renewal URL</string>
|
||||
</property>
|
||||
@ -1280,7 +1277,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="TextLabel8">
|
||||
<widget class="QLabel" name="nsCommentLbl">
|
||||
<property name="toolTip">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
@ -1290,7 +1287,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="TextLabel6_2_3">
|
||||
<widget class="QLabel" name="nsCaPolicyLbl">
|
||||
<property name="toolTip">
|
||||
<string>CA policy URL</string>
|
||||
</property>
|
||||
@ -1300,7 +1297,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="TextLabel1_3_2_3">
|
||||
<widget class="QLabel" name="nsBaseLbl">
|
||||
<property name="toolTip">
|
||||
<string>Base URL</string>
|
||||
</property>
|
||||
@ -1315,7 +1312,7 @@
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="nsComment">
|
||||
<property name="toolTip">
|
||||
<string>If you know a more pretty one tell me</string>
|
||||
<string notr="true">If you know a more pretty one tell me</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1402,6 +1399,11 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>hashBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>widgets/hashBox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Validity</class>
|
||||
<extends>QDateTimeEdit</extends>
|
||||
@ -1412,11 +1414,6 @@
|
||||
<slot>localTime(int)</slot>
|
||||
</slots>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>hashBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>widgets/hashBox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>kvView</class>
|
||||
<extends>QTableView</extends>
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@ -96,6 +96,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="transDnEntries">
|
||||
<property name="text">
|
||||
<string>Translate established x509 terms (%1 -> %2)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
@ -243,7 +250,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string notr="true">PKCS#11 provider</string>
|
||||
<string>PKCS#11 provider</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
|
||||
@ -186,12 +186,23 @@ void CertDetail::setReq(pki_x509req *req)
|
||||
for (int i = 0; i<cnt; i++) {
|
||||
int nid;
|
||||
QLabel *label;
|
||||
QString trans;
|
||||
X509_ATTRIBUTE *att = X509_REQ_get_attr(req->getReq(), i);
|
||||
|
||||
nid = OBJ_obj2nid(att->object);
|
||||
if (X509_REQ_extension_nid(nid)) {
|
||||
continue;
|
||||
}
|
||||
label = new QLabel(this);
|
||||
trans = db_x509name::dn_translations[nid];
|
||||
if (db_x509name::translate_dn && !trans.isEmpty()) {
|
||||
label->setText(trans);
|
||||
label->setToolTip(QString(OBJ_nid2sn(nid)));
|
||||
} else {
|
||||
label->setText(QString(OBJ_nid2ln(nid)));
|
||||
label->setToolTip(trans);
|
||||
}
|
||||
|
||||
label->setText(QString(OBJ_nid2ln(nid)));
|
||||
label->setToolTip(QString(OBJ_nid2sn(nid)));
|
||||
attrLayout->addWidget(label, i, 0);
|
||||
|
||||
@ -149,11 +149,24 @@ int MainWindow::init_database()
|
||||
}
|
||||
}
|
||||
mydb.first();
|
||||
if (!mydb.find(setting, "optionflags")) {
|
||||
if (!mydb.find(setting, "optionflags1")) {
|
||||
if ((p = (char *)mydb.load(NULL))) {
|
||||
setOptFlags((QString(p)));
|
||||
free(p);
|
||||
}
|
||||
} else {
|
||||
/* Different optionflags, since setOptFlags()
|
||||
* does an abort() for unknown flags in
|
||||
* older versions. *Another stupid idea*
|
||||
* This is for backward compatibility
|
||||
*/
|
||||
mydb.first();
|
||||
if (!mydb.find(setting, "optionflags")) {
|
||||
if ((p = (char *)mydb.load(NULL))) {
|
||||
setOptFlags_old((QString(p)));
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
mydb.first();
|
||||
if (!mydb.find(setting, "defaultkey")) {
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include "lib/pki_evp.h"
|
||||
#include "lib/pki_scard.h"
|
||||
#include "lib/func.h"
|
||||
#include "lib/db_x509super.h"
|
||||
#include "ui_Options.h"
|
||||
#include "widgets/hashBox.h"
|
||||
#include <QtGui/QApplication>
|
||||
@ -197,6 +198,8 @@ void MainWindow::setOptions()
|
||||
pki_base::suppress_messages ? Qt::Checked : Qt::Unchecked);
|
||||
opt->noColorize->setCheckState(
|
||||
pki_x509::dont_colorize_expiries ? Qt::Checked : Qt::Unchecked);
|
||||
opt->transDnEntries->setCheckState(
|
||||
db_x509name::translate_dn ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
if (!opt->exec()) {
|
||||
delete opt;
|
||||
@ -227,11 +230,12 @@ void MainWindow::setOptions()
|
||||
QString flags = getOptFlags();
|
||||
pki_base::suppress_messages = opt->suppress->checkState();
|
||||
pki_x509::dont_colorize_expiries = opt->noColorize->checkState();
|
||||
db_x509name::translate_dn = opt->transDnEntries->checkState();
|
||||
|
||||
if (flags != getOptFlags()) {
|
||||
flags = getOptFlags();
|
||||
mydb.set((const unsigned char *)(CCHAR(flags)),
|
||||
flags.length()+1, 1, setting, "optionflags");
|
||||
flags.length()+1, 1, setting, "optionflags1");
|
||||
mydb.first();
|
||||
if (!mydb.find(setting, "suppress"))
|
||||
mydb.erase();
|
||||
@ -257,13 +261,14 @@ void MainWindow::setOptions()
|
||||
* S: Suppress success messages
|
||||
* C: Don't colorize success messages
|
||||
*/
|
||||
void MainWindow::setOptFlags(QString flags)
|
||||
void MainWindow::setOptFlags_old(QString flags)
|
||||
{
|
||||
int s = flags.size(), i;
|
||||
QByteArray b = flags.toAscii();
|
||||
|
||||
pki_base::suppress_messages = false;
|
||||
pki_x509::dont_colorize_expiries = false;
|
||||
db_x509name::translate_dn = false;
|
||||
|
||||
for (i=0; i<s; i++) {
|
||||
switch (b[i]) {
|
||||
@ -273,20 +278,40 @@ void MainWindow::setOptFlags(QString flags)
|
||||
case 'C':
|
||||
pki_x509::dont_colorize_expiries = true;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
case 'T':
|
||||
db_x509name::translate_dn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setOptFlags(QString flags)
|
||||
{
|
||||
pki_base::suppress_messages = false;
|
||||
pki_x509::dont_colorize_expiries = false;
|
||||
db_x509name::translate_dn = false;
|
||||
|
||||
foreach(QString flag, flags.split(",")) {
|
||||
if (flag == "suppress_messages")
|
||||
pki_base::suppress_messages = true;
|
||||
else if (flag == "dont_colorize_expiries")
|
||||
pki_x509::dont_colorize_expiries = true;
|
||||
else if (flag == "translate_dn")
|
||||
db_x509name::translate_dn = true;
|
||||
else if (!flag.isEmpty())
|
||||
fprintf(stderr, "Unkown flag '%s'\n", CCHAR(flag));
|
||||
}
|
||||
}
|
||||
|
||||
QString MainWindow::getOptFlags()
|
||||
{
|
||||
QString flags;
|
||||
QStringList flags;
|
||||
|
||||
if (pki_base::suppress_messages)
|
||||
flags += "S";
|
||||
flags << "suppress_messages";
|
||||
if (pki_x509::dont_colorize_expiries)
|
||||
flags += "C";
|
||||
|
||||
return flags;
|
||||
flags << "dont_colorize_expiries";
|
||||
if (db_x509name::translate_dn)
|
||||
flags += "translate_dn";
|
||||
return flags.join(",");
|
||||
}
|
||||
|
||||
@ -85,6 +85,7 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
QString homedir;
|
||||
int changeDB(QString fname);
|
||||
void setOptFlags(QString flags);
|
||||
void setOptFlags_old(QString flags);
|
||||
QString getOptFlags();
|
||||
|
||||
public:
|
||||
|
||||
@ -44,8 +44,8 @@ NewX509::NewX509(QWidget *parent)
|
||||
/* temporary storage for creating temporary X509V3_CTX */
|
||||
ctx_cert = NULL;
|
||||
|
||||
for (i=0; i < dn_nid.count(); i++)
|
||||
keys << QString(OBJ_nid2ln(dn_nid[i]));
|
||||
foreach(int nid, dn_nid)
|
||||
keys << QString(OBJ_nid2ln(nid));
|
||||
|
||||
extDNlist->setKeys(keys);
|
||||
extDNlist->setInfoLabel(extDNinfo);
|
||||
@ -112,27 +112,18 @@ NewX509::NewX509(QWidget *parent)
|
||||
tempList->insertItems(0, strings);
|
||||
|
||||
// setup Extended keyusage
|
||||
for (i=0; i < eku_nid.count(); i++)
|
||||
ekeyUsage->addItem(OBJ_nid2ln(eku_nid[i]));
|
||||
foreach(int nid, eku_nid)
|
||||
ekeyUsage->addItem(OBJ_nid2ln(nid));
|
||||
|
||||
// setup Authority Info Access
|
||||
for (i=0; i < aia_nid.count(); i++)
|
||||
aiaOid->addItem(OBJ_nid2ln(aia_nid[i]));
|
||||
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);
|
||||
|
||||
// Setup dnWidget
|
||||
QMap<int, QString> tooltips;
|
||||
tooltips[NID_countryName] = tr("Country code");
|
||||
tooltips[NID_stateOrProvinceName] = tr("State or Province");
|
||||
tooltips[NID_localityName] = tr("Locality");
|
||||
tooltips[NID_organizationName] = tr("Organisation");
|
||||
tooltips[NID_organizationalUnitName] = tr("Organisational unit");
|
||||
tooltips[NID_commonName] = tr("Common name");
|
||||
tooltips[NID_pkcs9_emailAddress] = tr("E-Mail address");
|
||||
|
||||
if (dnWidget->layout())
|
||||
delete dnWidget->layout();
|
||||
QGridLayout *dnLayout = new QGridLayout(dnWidget);
|
||||
@ -149,16 +140,22 @@ NewX509::NewX509(QWidget *parent)
|
||||
dnLayout->addWidget(description, 0, 1);
|
||||
|
||||
QWidget::setTabOrder(description, extDNlist);
|
||||
QLineEdit *old = description;
|
||||
QWidget *old = description;
|
||||
foreach(int nid, expl_dn_nid) {
|
||||
QLabel *label;
|
||||
QLineEdit *edit;
|
||||
QString trans = db_x509name::dn_translations[nid];
|
||||
|
||||
label = new QLabel(this);
|
||||
label->setText(OBJ_nid2ln(nid));
|
||||
label->setToolTip(QString("[%1] %2").
|
||||
arg(OBJ_nid2sn(nid)).arg(tooltips[nid]));
|
||||
|
||||
if (db_x509name::translate_dn && !trans.isEmpty()) {
|
||||
label->setText(trans);
|
||||
label->setToolTip(QString("[%1] %2")
|
||||
.arg(OBJ_nid2sn(nid)).arg(OBJ_nid2ln(nid)));
|
||||
} else {
|
||||
label->setText(OBJ_nid2ln(nid));
|
||||
label->setToolTip(QString("[%1] %2")
|
||||
.arg(OBJ_nid2sn(nid)).arg(trans));
|
||||
}
|
||||
edit = new QLineEdit(this);
|
||||
setupLineEditByNid(nid, edit);
|
||||
nameEdits << nameEdit(nid, edit, label);
|
||||
@ -181,19 +178,31 @@ NewX509::NewX509(QWidget *parent)
|
||||
attrLayout->setAlignment(Qt::AlignTop);
|
||||
attrLayout->setSpacing(6);
|
||||
attrLayout->setMargin(0);
|
||||
attr_edit.clear();
|
||||
for (i=0; i < attr_nid.count(); i++) {
|
||||
old = reqSubChange;
|
||||
n = 0;
|
||||
foreach(int nid, attr_nid) {
|
||||
QLabel *label;
|
||||
QLineEdit *edit;
|
||||
int nid = attr_nid[i];
|
||||
QString trans = db_x509name::dn_translations[nid];
|
||||
|
||||
label = new QLabel(this);
|
||||
label->setText(QString(OBJ_nid2ln(nid)));
|
||||
label->setToolTip(QString(OBJ_nid2sn(nid)));
|
||||
if (db_x509name::translate_dn && !trans.isEmpty()) {
|
||||
label->setText(trans);
|
||||
label->setToolTip(QString(OBJ_nid2sn(nid)));
|
||||
} else {
|
||||
label->setText(QString(OBJ_nid2ln(nid)));
|
||||
label->setToolTip(trans);
|
||||
}
|
||||
edit = new QLineEdit(this);
|
||||
attr_edit << edit;
|
||||
attrLayout->addWidget(label, i, 0);
|
||||
attrLayout->addWidget(edit, i, 1);
|
||||
attrEdits << nameEdit(nid, edit, label);
|
||||
setupLineEditByNid(nid, edit);
|
||||
|
||||
attrLayout->addWidget(label, n, 0);
|
||||
attrLayout->addWidget(edit, n, 1);
|
||||
|
||||
QWidget::setTabOrder(old, edit);
|
||||
old = edit;
|
||||
n++;
|
||||
}
|
||||
// last polish
|
||||
on_certList_currentIndexChanged(0);
|
||||
@ -202,6 +211,29 @@ NewX509::NewX509(QWidget *parent)
|
||||
attrWidget->hide();
|
||||
pt = none;
|
||||
notAfter->setEndDate(true);
|
||||
if (db_x509name::translate_dn) {
|
||||
QList<QGroupBox*> gb;
|
||||
gb << distNameBox << bcBox << keyIdentBox << kuBox << ekuBox;
|
||||
foreach(QGroupBox *g, gb) {
|
||||
QString tt = g->toolTip();
|
||||
g->setToolTip(g->title());
|
||||
g->setTitle(tt);
|
||||
}
|
||||
QList<QLabel*> labels;
|
||||
labels << sanLbl << ianLbl << crldpLbl << aiaLbl <<
|
||||
nsBaseLbl << nsRevLbl << nsCaRevLbl << nsRenewLbl <<
|
||||
nsCaPolicyLbl << nsSslServerLbl << nsCommentLbl;
|
||||
foreach(QLabel *l, labels) {
|
||||
QString tt = l->toolTip();
|
||||
l->setToolTip(l->text());
|
||||
l->setText(tt);
|
||||
}
|
||||
QList<QCheckBox*> cbList;
|
||||
cbList << bcCritical << kuCritical << ekuCritical;
|
||||
foreach(QCheckBox* cb, cbList) {
|
||||
cb->setText(tr("Critical"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NewX509::setRequest()
|
||||
@ -255,8 +287,8 @@ void NewX509::setupLineEditByNid(int nid, QLineEdit *l)
|
||||
|
||||
void NewX509::addReqAttributes(pki_x509req *req)
|
||||
{
|
||||
for (int i=0; i < attr_nid.count(); i++) {
|
||||
req->addAttribute(attr_nid[i], attr_edit[i]->text());
|
||||
foreach(nameEdit e, attrEdits) {
|
||||
req->addAttribute(e.nid, e.edit->text());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class NewX509: public QDialog, public Ui::NewX509
|
||||
NIDlist aia_nid;
|
||||
NIDlist attr_nid;
|
||||
NIDlist expl_dn_nid;
|
||||
QList<QLineEdit*> attr_edit;
|
||||
QList<nameEdit> attrEdits;
|
||||
QList<nameEdit> nameEdits;
|
||||
X509V3_CTX ext_ctx;
|
||||
void editV3ext(QLineEdit *le, QString types, int n);
|
||||
|
||||
@ -36,6 +36,9 @@ Options::Options(MainWindow *parent)
|
||||
<< tr("All strings");
|
||||
mbstring->addItems(s);
|
||||
searchP11 = NULL;
|
||||
transDnEntries->setText(transDnEntries->text()
|
||||
.arg(OBJ_nid2ln(NID_commonName))
|
||||
.arg(db_x509name::dn_translations[NID_commonName]));
|
||||
}
|
||||
|
||||
Options::~Options()
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include "lib/x509name.h"
|
||||
#include "lib/db_x509super.h"
|
||||
#include "lib/base.h"
|
||||
#include "widgets/clicklabel.h"
|
||||
|
||||
@ -50,20 +51,30 @@ void DistName::setX509name(const x509name &n)
|
||||
QLabel *l1, *l2;
|
||||
QStringList sl;
|
||||
for (int i=0; i<n.entryCount(); i++) {
|
||||
l1 = new QLabel( this );
|
||||
l2 = new CopyLabel( this );
|
||||
l1->setTextFormat(Qt::PlainText);
|
||||
QString toolt, label, trans;
|
||||
int nid = n.nid(i);
|
||||
trans = db_x509name::dn_translations[nid];
|
||||
sl = n.entryList(i);
|
||||
l1->setText(sl[1]);
|
||||
if (db_x509name::translate_dn && !trans.isEmpty()) {
|
||||
label = trans;
|
||||
toolt = sl[1];
|
||||
} else {
|
||||
toolt = trans;
|
||||
label = sl[1];
|
||||
}
|
||||
l1 = new QLabel(this);
|
||||
l2 = new CopyLabel(this);
|
||||
l1->setTextFormat(Qt::PlainText);
|
||||
l1->setText(label);
|
||||
if (l1->text().isEmpty())
|
||||
l1->setText(sl[0]);
|
||||
l2->setText(sl[2]);
|
||||
|
||||
l1->setToolTip(sl[0]);
|
||||
l1->setToolTip(QString("[%1] %2").arg(sl[0]).arg(toolt));
|
||||
l2->setToolTip(sl[3]);
|
||||
|
||||
DistNameLayout->addWidget( l1, i, 0 );
|
||||
DistNameLayout->addWidget( l2, i, 1 );
|
||||
DistNameLayout->addWidget(l1, i, 0);
|
||||
DistNameLayout->addWidget(l2, i, 1);
|
||||
}
|
||||
rfc2253->setText(n.oneLine(XN_FLAG_RFC2253));
|
||||
rfc2253->setCursorPosition(0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user