"Authority info Access" enhanced

"aia.txt" as oid list added
This commit is contained in:
chris2511 2004-04-14 23:36:54 +00:00
parent 621b27d4eb
commit a9a34847c2
13 changed files with 260 additions and 136 deletions

View File

@ -5,10 +5,17 @@ all: target.obj
ifneq ($(prefix),)
CFLAGS+= -DPREFIX=\"$(prefix)\"
endif
ifneq ($(basedir),)
CFLAGS+= -DBASEDIR=\"$(basedir)\"
endif
ifneq ($(etc),)
CFLAGS+= -DETC=\"$(etc)\"
else
CFLAGS+= -DETC=\"/etc/xca\"
endif
SRCS=$(patsubst %.o, %.cpp, $(OBJS))
# recompile all

View File

@ -123,7 +123,6 @@ pki_base* db_key::insert(pki_base *item)
"'\n" + tr("and will be completed by the new, private part of the key"), "OK");
deletePKI(oldkey);
lkey->setIntName(oldkey->getIntName());
delete(oldkey);
}
}
insertPKI(lkey);

View File

@ -67,6 +67,7 @@ static void readOIDs(QString fname)
FILE *fp;
int line = 0;
QStringList sl;
//fprintf(stderr, "FILE: %s\n", fname.latin1());
fp = fopen(fname.latin1(), "r");
if (fp == NULL) return;
while (fgets(buff, 127, fp)) {
@ -92,12 +93,16 @@ static void readOIDs(QString fname)
void initOIDs(QString baseDir)
{
QString dir=getPrefix();
readOIDs(dir + QDir::separator() + "oids.txt");
QString oids = (QChar)QDir::separator();
oids += "oids.txt";
QString dir = getPrefix();
readOIDs(dir + oids);
#ifndef _WIN32_
readOIDs("/etc/xca/oids.txt");
QString etc = ETC;
readOIDs(etc + oids);
#endif
readOIDs(baseDir + QDir::separator() + "oids.txt");
readOIDs(baseDir + oids);
}
/* reads a list of OIDs/SNs from a file and turns them into a QValueList
@ -114,6 +119,7 @@ NIDlist readNIDlist(QString fname)
int line = 0, nid;
NIDlist nl;
nl.clear();
//fprintf(stderr, "OID FILE: %s\n", fname.latin1());
fp = fopen(fname.latin1(), "r");
if (fp == NULL) return nl;
while (fgets(buff, 127, fp)) {

3
misc/aia.txt Normal file
View File

@ -0,0 +1,3 @@
OCSP
caIssuers
ad_timestamping

View File

@ -72,6 +72,7 @@ Section "xca (required)"
File "Release\msvcrt.dll"
File "Release\msvcp60.dll"
File "Release\qt-mt230nc.dll"
File "doc\*.html"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\xca "Install_Dir" "$INSTDIR"

View File

@ -11,8 +11,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>568</width>
<height>477</height>
<width>583</width>
<height>494</height>
</rect>
</property>
<property stdset="1">
@ -1274,7 +1274,7 @@
<images>
<image>
<name>image0</name>
<data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
<data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
</image>
</images>
<connections>

View File

@ -11,13 +11,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>670</width>
<height>329</height>
<width>671</width>
<height>353</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>CertExtend_UI</string>
<string></string>
</property>
<vbox>
<property stdset="1">

View File

@ -11,13 +11,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>620</width>
<width>595</width>
<height>614</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string></string>
<string>NewX509_UI</string>
</property>
<widget>
<class>QWidget</class>
@ -2084,6 +2084,10 @@ email:my@other.address, RID:1.2.3.4, DNS: ns.server.tld</string>
<name>selectionMode</name>
<enum>Multi</enum>
</property>
<property>
<name>toolTip</name>
<string>can be altered by the file "eku.txt"</string>
</property>
</widget>
</vbox>
</widget>
@ -2114,9 +2118,9 @@ email:my@other.address, RID:1.2.3.4, DNS: ns.server.tld</string>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout19</cstring>
<cstring>Layout23</cstring>
</property>
<grid>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
@ -2125,97 +2129,150 @@ email:my@other.address, RID:1.2.3.4, DNS: ns.server.tld</string>
<name>spacing</name>
<number>6</number>
</property>
<widget row="0" column="1" >
<class>QLineEdit</class>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>crlDist</cstring>
<cstring>Layout22</cstring>
</property>
<property>
<name>whatsThis</name>
<string>This is a multi-valued extension that supports all the literal options of subject alternative name. Of the few software packages that currentlyi nterpret this extension most only interpret the URI option.
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2_3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>CRL distribution point</string>
</property>
</widget>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2_3_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Authority Info Access</string>
</property>
</widget>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2_3_2_2_2</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
<name>text</name>
<string>Certificate Policies</string>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout21</cstring>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>authInfAcc</cstring>
</property>
<property>
<name>toolTip</name>
<string>DNS: IP: URI: email: RIP:</string>
</property>
<property>
<name>whatsThis</name>
<string>The authority information access extension gives details about how to access certain information relating to the CA. Its syntax is accessOID;location where 'location' has the same syntax as subject alternative name (except that email:copy is not supported). accessOID can be any valid OID but only certain values are meaningful for example OCSP and caIssuers. OCSP gives the location of an OCSP responder: this is used by Netscape PSM and other software.
Example:
OCSP;URI:http://ocsp.my.host/
caIssuers;URI:http://my.ca/ca.html</string>
</property>
</widget>
<widget row="0" column="0" rowspan="1" colspan="2" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>crlDist</cstring>
</property>
<property>
<name>whatsThis</name>
<string>This is a multi-valued extension that supports all the literal options of subject alternative name. Of the few software packages that currentlyi nterpret this extension most only interpret the URI option.
Currently each option will set a new DistributionPoint with the fullName field set to the given value.
Other fields like cRLissuer and reasons cannot currently be set or displayed: at this time no examples were available that used these fields.
If you see this extension with &lt;UNSUPPORTED&gt; when you attempt to print it out or it doesn't appear to display correctly then let steve know, including the certificate (mail steve at openssl dot org) .
Examples:
URI:http://www.myhost.com/myca.crl
URI:http://www.my.com/my.crl, URI:http://www.oth.com/my.crl</string>
</property>
</widget>
<widget row="2" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2_3_2_2_2</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
<name>text</name>
<string>Certificate Policies</string>
</property>
</widget>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2_3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>CRL distribution point</string>
</property>
</widget>
<widget row="2" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>certPol</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property>
<name>whatsThis</name>
<string>If you follow the PKIX recommendations of not including any qualifiers and just
</property>
</widget>
<widget row="2" column="0" rowspan="1" colspan="2" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>certPol</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
<name>text</name>
<string>This will be enabled in a later version :-(</string>
</property>
<property>
<name>whatsThis</name>
<string>If you follow the PKIX recommendations of not including any qualifiers and just
using only one OID then you just include the value of that OID. Multiple OIDs
can be set separated by commas, for example:
Example:
1.2.4.5, 1.1.3.4</string>
</property>
</property>
</widget>
<widget row="1" column="0" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>aiaOid</cstring>
</property>
<property>
<name>toolTip</name>
<string>can be altered by the file "aia.txt"</string>
</property>
</widget>
</grid>
</widget>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>authInfAcc</cstring>
</property>
<property>
<name>whatsThis</name>
<string>The authority information access extension gives details about how to access certain information relating to the CA. Its syntax is accessOID;location where 'location' has the same syntax as subject alternative name (except that email:copy is not supported). accessOID can be any valid OID but only certain values are meaningful for example OCSP and caIssuers. OCSP gives the location of an OCSP responder: this is used by Netscape PSM and other software.
Example:
OCSP;URI:http://ocsp.my.host/
caIssuers;URI:http://my.ca/ca.html</string>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2_3_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Authority Info Access</string>
</property>
</widget>
</grid>
</hbox>
</widget>
<spacer>
<property>

View File

@ -88,6 +88,7 @@ DbEnv *MainWindow::dbenv = NULL;
NIDlist *MainWindow::eku_nid = NULL;
NIDlist *MainWindow::dn_nid = NULL;
NIDlist *MainWindow::aia_nid = NULL;
MainWindow::MainWindow(QWidget *parent, const char *name )
@ -124,6 +125,29 @@ MainWindow::MainWindow(QWidget *parent, const char *name )
emit init_database();
}
/* creates a new nid list from the given filename */
NIDlist *MainWindow::read_nidlist(QString name)
{
NIDlist nl;
QString prefix = getPrefix();
name = QDir::separator() + name;
/* first try $HOME/xca/ */
nl = readNIDlist(baseDir + name);
#ifndef _WIN32_
if (nl.count() == 0){ /* next is /etx/xca/... */
QString unix_etc = ETC;
nl = readNIDlist(unix_etc + name);
}
#endif
if (nl.count() == 0) /* look at /usr/(local/)share/xca/ */
nl = readNIDlist(prefix + name);
return new NIDlist(nl);
}
void MainWindow::init_baseDir()
{
static bool done = false;
@ -136,34 +160,15 @@ void MainWindow::init_baseDir()
qFatal( QString::fromLatin1("Could not create: ") + baseDir );
}
done = true;
NIDlist nl;
nl.clear();
QString prefix = getPrefix();
/* read in all our own OIDs */
initOIDs(baseDir);
nl = readNIDlist(baseDir + QDir::separator() + "eku.txt");
#ifndef _WIN32_
if (nl.count() == 0)
nl = readNIDlist("/etc/xca/eku.txt");
#endif
if (nl.count() == 0)
nl = readNIDlist(prefix + QDir::separator() + "eku.txt");
eku_nid = new NIDlist(nl);
nl.clear();
nl = readNIDlist(baseDir + QDir::separator() + "dn.txt");
#ifndef _WIN32_
if (nl.count() == 0)
nl = readNIDlist("/etc/xca/dn.txt");
#endif
if (nl.count() == 0)
nl = readNIDlist(prefix + QDir::separator() + "dn.txt");
dn_nid = new NIDlist(nl);
eku_nid = read_nidlist("eku.txt");
dn_nid = read_nidlist("dn.txt");
aia_nid = read_nidlist("aia.txt");
}
void MainWindow::do_connections()
{
@ -331,6 +336,8 @@ MainWindow::~MainWindow()
delete eku_nid;
if (dn_nid)
delete dn_nid;
if (aia_nid)
delete aia_nid;
#ifdef MDEBUG
fprintf(stderr, "Memdebug:\n");
CRYPTO_mem_leaks_fp(stderr);

View File

@ -81,7 +81,7 @@ class MainWindow: public MainWindow_UI
DbTxn *global_tid;
QMenuBar *mb;
int force_load;
NIDlist *read_nidlist(QString name);
friend class pki_key;
public:
@ -93,7 +93,7 @@ class MainWindow: public MainWindow_UI
static db_crl *crls;
static db_base *settings;
static QPixmap *keyImg, *csrImg, *certImg, *tempImg, *nsImg, *revImg, *appIco;
static NIDlist *eku_nid, *dn_nid;
static NIDlist *eku_nid, *dn_nid, *aia_nid;
int exitApp;
QString baseDir, dbfile, dbdir;

View File

@ -96,6 +96,8 @@ NewX509::NewX509(QWidget *parent , const char *name, bool modal, WFlags f)
eku_nid = *MainWindow::eku_nid;
dn_nid = *MainWindow::dn_nid;
aia_nid = *MainWindow::aia_nid;
setCaption(tr(XCA_TITLE));
fixtemp = NULL;
nsImg->setPixmap(*MainWindow::nsImg);
@ -158,6 +160,10 @@ NewX509::NewX509(QWidget *parent , const char *name, bool modal, WFlags f)
for (i=0; i < dn_nid.count(); i++)
extDNobj->insertItem(OBJ_nid2ln(dn_nid[i]));
// setup Authority Info Access
for (i=0; i < aia_nid.count(); i++)
aiaOid->insertItem(OBJ_nid2ln(aia_nid[i]));
// init the X509 v3 context
X509V3_set_ctx(&ext_ctx, NULL , NULL, NULL, NULL, 0);
X509V3_set_ctx_nodb((&ext_ctx));
@ -189,14 +195,14 @@ void NewX509::setRequest()
signerBox->setEnabled(false);
requestBox->setEnabled(false);
startText_h=tr("Welcome to the settings for certificate signing requests.");
startText_b=tr("A signing request needs a private key, so it will be"
"created if there isn't any unused key available in the key"
"database. This signing request can then be given to a"
"Certification authority while the private key of the request"
"and of the resulting certificate returned from the CA does never"
startText_b=tr("A signing request needs a private key, so it will be "
"created if there isn't any unused key available in the key "
"database. This signing request can then be given to a "
"Certification authority while the private key of the request "
"and of the resulting certificate returned from the CA does never "
"leave your computer.");
endText=tr("You are done with entering all parameters for generating"
"a Certificate signing request. The resulting request should"
endText=tr("You are done with entering all parameters for generating "
"a Certificate signing request. The resulting request should "
"be exported and send to an appropriate CA for signing it.");
tText=tr("Certificate signing request");
setup();
@ -213,12 +219,12 @@ void NewX509::setTemp(pki_temp *temp)
setAppropriate(page1, false);
finishButton()->setEnabled(true);
startText_h=tr("Welcome to the settings for Templates.");
startText_b=tr("This templates do not refer to any ASN.1 structure"
"but are used to keep default settings for signing requests and"
"certificates. When creating a Request or Certificate the template"
startText_b=tr("This templates do not refer to any ASN.1 structure "
"but are used to keep default settings for signing requests and "
"certificates. When creating a Request or Certificate the template "
"can preset the needed fields with default settings.");
endText=tr("You are done with entering all parameters for the Template.\n"
"After this step the template can be assigned to one of your CAs to"
"After this step the template can be assigned to one of your CAs to "
"be autoatically applied when signing with this CA.");
tText=tr("Template");
if (temp->getIntName() != "--") {
@ -236,13 +242,13 @@ void NewX509::setCert()
{
finishButton()->setEnabled(true);
startText_h=tr("Welcome to the settings for Certificates.");
startText_b=tr("The information for the new Certificate can either be"
"grabbed from a given Certificate-request or be filled in by hand."
"In the case of not signing a request there needs to be at least one"
"unused key. If this is not the case it will be created. If you want"
"to self-sign a request (unusual but nevertheless possible) you need"
startText_b=tr("The information for the new Certificate can either be "
"grabbed from a given Certificate-request or be filled in by hand. "
"In the case of not signing a request there needs to be at least one "
"unused key. If this is not the case it will be created. If you want "
"to self-sign a request (unusual but nevertheless possible) you need "
"the private key used to create the request.");
endText=tr("You are done with entering all parameters for creating"
endText=tr("You are done with entering all parameters for creating "
"a Certificate.");
tText=tr("Certificate");
setup();
@ -346,7 +352,7 @@ void NewX509::fromTemplate(pki_temp *temp)
subAltName->setText(temp->subAltName);
issAltName->setText(temp->issAltName);
crlDist->setText(temp->crlDist);
authInfAcc->setText(temp->authInfAcc);
setAuthInfAcc_string(temp->authInfAcc);
certPol->setText(temp->certPol);
nsComment->setText(temp->nsComment);
nsBaseUrl->setText(temp->nsBaseUrl);
@ -382,7 +388,7 @@ void NewX509::toTemplate(pki_temp *temp)
temp->subAltName = subAltName->text();
temp->issAltName = issAltName->text();
temp->crlDist = crlDist->text();
temp->authInfAcc = authInfAcc->text();
temp->authInfAcc = getAuthInfAcc_string();
temp->certPol = certPol->text();
temp->nsComment = nsComment->text();
temp->nsBaseUrl = nsBaseUrl->text();

View File

@ -76,6 +76,7 @@ class NewX509: public NewX509_UI
QString startText_h, startText_b, endText, tText;
NIDlist eku_nid;
NIDlist dn_nid;
NIDlist aia_nid;
#define EXPLICIT_NAME_CNT 7
static int name_nid[EXPLICIT_NAME_CNT];
QLineEdit *name_ptr[EXPLICIT_NAME_CNT];
@ -104,6 +105,8 @@ class NewX509: public NewX509_UI
x509name getX509name();
void setX509name(const x509name &n);
void setImage(QPixmap *image);
void setAuthInfAcc_string(QString aia_txt);
QString getAuthInfAcc_string();
x509v3ext getBasicConstraints();
x509v3ext getSubKeyIdent();
x509v3ext getAuthKeyIdent();

View File

@ -183,11 +183,46 @@ x509v3ext NewX509::getCrlDist()
return ext;
}
QString NewX509::getAuthInfAcc_string()
{
QString rval="";
QString aia_txt = authInfAcc->text();
aia_txt.stripWhiteSpace();
if (!aia_txt.isEmpty()) {
rval = OBJ_nid2sn(aia_nid[aiaOid->currentItem()]);
rval += ";" + aia_txt;
}
return rval;
}
void NewX509::setAuthInfAcc_string(QString aia_txt)
{
QStringList aia;
int nid;
aia = aia.split(';', aia_txt);
if (aia.count() != 2) return;
nid = OBJ_sn2nid(aia[0].latin1());
for (int i=0; i < aia_nid.count(); i++) {
if (aia_nid[i] == nid) {
aiaOid->setCurrentItem(i);
}
}
authInfAcc->setText(aia[1]);
}
x509v3ext NewX509::getAuthInfAcc()
{
x509v3ext ext;
if (!authInfAcc->text().isEmpty()) {
ext.create(NID_info_access, authInfAcc->text());
QString aia_txt = getAuthInfAcc_string();
if (!aia_txt.isEmpty()) {
ext.create(NID_info_access, aia_txt);
}
return ext;
}