*** empty log message ***

This commit is contained in:
chris2511 2003-06-25 23:38:49 +00:00
parent 6a88c53778
commit 67294fc708
20 changed files with 656 additions and 567 deletions

View File

@ -83,13 +83,9 @@ pki_key::pki_key(const pki_key *pk)
:pki_base(pk->desc)
{
init();
MARK
key = EVP_PKEY_new();
MARK
openssl_error();
MARK
if (pk == NULL) return;
MARK
key->type = pk->key->type;
if (key->type == EVP_PKEY_RSA) {
key->pkey.rsa=((RSA *)ASN1_dup( (int (*)())i2d_RSAPrivateKey, (char *(*)())d2i_RSAPrivateKey,(char *)pk->key->pkey.rsa));
@ -128,19 +124,16 @@ pki_key::pki_key(const QString fname, pem_password_cb *cb, int type )
if (!rsakey) {
ign_openssl_error();
rewind(fp);
CERR("Fallback to privatekey DER");
rsakey = d2i_RSAPrivateKey_fp(fp, NULL);
}
if (!rsakey) {
ign_openssl_error();
rewind(fp);
CERR("Fallback to pubkey");
rsakey = PEM_read_RSA_PUBKEY(fp, NULL, cb, &p);
}
if (!rsakey) {
ign_openssl_error();
rewind(fp);
CERR("Fallback to pubkey DER");
rsakey = d2i_RSA_PUBKEY_fp(fp, NULL);
}
if (!rsakey) {
@ -148,26 +141,22 @@ pki_key::pki_key(const QString fname, pem_password_cb *cb, int type )
rewind(fp);
p.setTitle(tr("Password for PKCS#8 private key"));
p.setDescription(tr("Please enter the password to decrypt the PKCS#8 private key."));
CERR("Fallback to PKCS#8 Private key");
d2i_PKCS8PrivateKey_fp(fp, &key, cb, &p);
}
else {
EVP_PKEY_set1_RSA(key,rsakey);
openssl_error();
CERR("assigning loaded key");
}
setIntName(rmslashdot(fname));
openssl_error();
}
else fopen_error(fname);
CERR("end of loading");
fclose(fp);
}
void pki_key::fromData(unsigned char *p, int size )
{
CERR( "KEY fromData");
unsigned char *sik, *pdec, *pdec1, *sik1;
int outl, decsize;
unsigned char iv[EVP_MAX_IV_LENGTH];
@ -194,7 +183,6 @@ void pki_key::fromData(unsigned char *p, int size )
decsize = outl;
EVP_DecryptFinal( &ctx, pdec + decsize , &outl );
decsize += outl;
CERR("Decryption done: DB:" << size << " encrypted:" << size-8 << " decrypted:" << decsize);
openssl_error();
memcpy(sik, pdec, decsize);
if (key->type == EVP_PKEY_RSA) {
@ -217,7 +205,6 @@ void pki_key::fromData(unsigned char *p, int size )
unsigned char *pki_key::toData(int *size)
{
CERR("KEY toData " << getDescription());
unsigned char *p, *p1, *penc;
int outl, encsize=0;
EVP_CIPHER_CTX ctx;
@ -409,11 +396,9 @@ bool pki_key::compare(pki_base *ref)
bool pki_key::isPubKey()
{
if (key == NULL) {
CERR("key is null");
return false;
}
if (key->pkey.rsa == 0) {
CERR("key->pkey is null");
return false;
}
return (key->pkey.rsa->d == NULL);
@ -430,13 +415,11 @@ int pki_key::verify()
{
bool veri = false;
return true;
CERR("verify start");
if (key->type == EVP_PKEY_RSA && isPrivKey()) {
if (RSA_check_key(key->pkey.rsa) == 1) veri = true;
}
if (isPrivKey()) veri = true;
openssl_error();
CERR("verify end: "<< veri );
return veri;
}

View File

@ -52,7 +52,12 @@
#include "pki_x509super.h"
pki_x509super::pki_x509super() : pki_base() {}
pki_x509super::pki_x509super()
: pki_base()
{
privkey = NULL;
printf("privkey set to NULL");
}
pki_x509super::~pki_x509super() {}

View File

@ -11,8 +11,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>335</width>
<height>336</height>
<width>388</width>
<height>304</height>
</rect>
</property>
<property stdset="1">
@ -145,11 +145,78 @@
</property>
</spacer>
<widget>
<class>Validity</class>
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>validity</cstring>
<cstring>GroupBox8</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Validity</string>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout16</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="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>not Before</string>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2_4</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>not After</string>
</property>
</widget>
<widget row="0" column="1" >
<class>Validity</class>
<property stdset="1">
<name>name</name>
<cstring>notBefore</cstring>
</property>
</widget>
<widget row="1" column="1" >
<class>Validity</class>
<property stdset="1">
<name>name</name>
<cstring>notAfter</cstring>
</property>
</widget>
</grid>
</widget>
</hbox>
</widget>
<spacer>
<property>

View File

@ -11,8 +11,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>644</width>
<height>542</height>
<width>615</width>
<height>590</height>
</rect>
</property>
<property stdset="1">
@ -678,9 +678,9 @@ Empy, CA, client, server</string>
</property>
<property stdset="1">
<name>title</name>
<string>Source of the subject and the key</string>
<string>Source of the subject</string>
</property>
<grid>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
@ -689,182 +689,320 @@ Empy, CA, client, server</string>
<name>spacing</name>
<number>6</number>
</property>
<widget row="0" column="0" >
<class>QLabel</class>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Internal name</string>
<cstring>Layout20</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="3" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>emailAddress</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>60</number>
</property>
</widget>
<widget row="0" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Organisation</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>description</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>100</number>
</property>
<property>
<name>toolTip</name>
<string>This name is only used internally and does not appear in the resulting certificate</string>
</property>
</widget>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>countryName</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>2</number>
</property>
<property>
<name>toolTip</name>
<string>Must be exactly 2 letter of size (DE, UK)</string>
</property>
</widget>
<widget row="2" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>commonName</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>64</number>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Country code</string>
</property>
</widget>
<widget row="2" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Country</string>
</property>
</widget>
<widget row="2" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>stateOrProvinceName</cstring>
</property>
</widget>
<widget row="3" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4_3</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Locality</string>
</property>
</widget>
<widget row="1" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel5_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Organ. unit</string>
</property>
</widget>
<widget row="2" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel6_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Common name</string>
</property>
</widget>
<widget row="3" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel7_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>E-Mail address</string>
</property>
</widget>
<widget row="3" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>localityName</cstring>
</property>
</widget>
<widget row="1" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>organisationalUnitName</cstring>
</property>
</widget>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Internal name</string>
</property>
</widget>
<widget row="0" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>organisationName</cstring>
</property>
</widget>
</grid>
</widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
<widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>description</cstring>
<cstring>Line1</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>100</number>
</property>
<property>
<name>toolTip</name>
<string>This name is only used internally and does not appear in the resulting certificate</string>
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
<widget row="1" column="1" >
<class>QLineEdit</class>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>countryName</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>2</number>
</property>
<property>
<name>toolTip</name>
<string>Must be exactly 2 letter of size (DE, UK)</string>
<cstring>Layout23</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>extDNobj</cstring>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>extDNname</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>100</number>
</property>
<property>
<name>toolTip</name>
<string>This name is only used internally and does not appear in the resulting certificate</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>extDNadd</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Add</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>extDNdel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Delete</string>
</property>
</widget>
</hbox>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<widget>
<class>QListView</class>
<column>
<property>
<name>text</name>
<string>Object</string>
</property>
<property>
<name>clickable</name>
<bool>true</bool>
</property>
<property>
<name>resizeable</name>
<bool>true</bool>
</property>
</column>
<column>
<property>
<name>text</name>
<string>Value</string>
</property>
<property>
<name>clickable</name>
<bool>true</bool>
</property>
<property>
<name>resizeable</name>
<bool>true</bool>
</property>
</column>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Country code</string>
<cstring>extDNlist</cstring>
</property>
</widget>
<widget row="2" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Country</string>
</property>
</widget>
<widget row="3" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>localityName</cstring>
</property>
</widget>
<widget row="5" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>organisationalUnitName</cstring>
</property>
</widget>
<widget row="6" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>commonName</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>64</number>
</property>
</widget>
<widget row="7" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>emailAddress</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>60</number>
</property>
</widget>
<widget row="2" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>stateOrProvinceName</cstring>
</property>
</widget>
<widget row="0" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>sureName</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>100</number>
</property>
<property>
<name>toolTip</name>
<string>This name is only used internally and does not appear in the resulting certificate</string>
</property>
</widget>
<widget row="1" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>givenName</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>2</number>
</property>
<property>
<name>toolTip</name>
<string>Must be exactly 2 letter of size (DE, UK)</string>
</property>
</widget>
<widget row="6" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>initials</cstring>
</property>
<property stdset="1">
<name>maxLength</name>
<number>64</number>
</property>
</widget>
<widget row="5" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>role</cstring>
</property>
</widget>
<widget row="3" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>localityName_2</cstring>
</property>
</widget>
<widget row="4" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>pseudonym</cstring>
</property>
</widget>
<widget row="2" column="3" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>title</cstring>
</property>
</widget>
<widget row="8" column="1" >
</vbox>
</widget>
<widget>
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>GroupBox7</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Private key</string>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
@ -875,183 +1013,7 @@ Empy, CA, client, server</string>
<string>This list only contains unused keys</string>
</property>
</widget>
<widget row="0" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_3_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Sure name</string>
</property>
</widget>
<widget row="2" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_2_3</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Title</string>
</property>
</widget>
<widget row="3" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4_3</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Locality</string>
</property>
</widget>
<widget row="3" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4_3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Name</string>
</property>
</widget>
<widget row="5" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel5_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Organ. unit</string>
</property>
</widget>
<widget row="6" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel6_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Common name</string>
</property>
</widget>
<widget row="7" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel7_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>E-Mail address</string>
</property>
</widget>
<widget row="4" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>organisationName</cstring>
</property>
</widget>
<widget row="1" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Given Name</string>
</property>
</widget>
<widget row="4" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Organisation</string>
</property>
</widget>
<widget row="8" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2_3</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Private key</string>
</property>
</widget>
<widget row="6" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel6_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Initials</string>
</property>
</widget>
<widget row="5" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel5_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Role</string>
</property>
</widget>
<widget row="4" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4_2_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Pseudonym</string>
</property>
</widget>
<widget row="8" column="3" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>genKeyBUT</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Generate a new key</string>
</property>
<property>
<name>toolTip</name>
<string>This funny button creates a key. Go figure.</string>
</property>
</widget>
<widget row="7" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel7_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Hash Algo</string>
</property>
</widget>
<widget row="7" column="3" >
<widget>
<class>QComboBox</class>
<item>
<property>
@ -1076,14 +1038,43 @@ Empy, CA, client, server</string>
<cstring>ComboBox19</cstring>
</property>
</widget>
<widget row="8" column="2" >
<class>QLabel</class>
<spacer>
<property>
<name>name</name>
<cstring>Spacer33_2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_3</cstring>
<cstring>genKeyBUT</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Generate a new key</string>
</property>
<property>
<name>toolTip</name>
<string>This funny button creates a key. Go figure.</string>
</property>
</widget>
</grid>
</hbox>
</widget>
<spacer>
<property>
@ -1423,11 +1414,99 @@ It also copies the issuer and serial number from the issuer certificate. Normall
</hbox>
</widget>
<widget>
<class>Validity</class>
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>validity</cstring>
<cstring>GroupBox8</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Validity</string>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout16</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="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>not Before</string>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2_4</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>not After</string>
</property>
</widget>
<widget row="0" column="1" >
<class>Validity</class>
<property stdset="1">
<name>name</name>
<cstring>notBefore</cstring>
</property>
</widget>
<widget row="1" column="1" >
<class>Validity</class>
<property stdset="1">
<name>name</name>
<cstring>notAfter</cstring>
</property>
</widget>
</grid>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer34_2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<spacer>
<property>
@ -1867,78 +1946,6 @@ URI:http://www.my.com/my.crl, URI:http://www.oth.com/my.crl</string>
</widget>
<widget>
<class>QListBox</class>
<item>
<property>
<name>text</name>
<string>SSL/TLS Web Server Authentication</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>SSL/TLS Web Client Authentication</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Code signing</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>E-mail Protection (S/MIME)</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Trusted Timestamping</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Microsoft Individual Code Signing (authenticode)</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Microsoft Commercial Code Signing (authenticode)</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Microsoft Trust List Signing</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Microsoft Server Gated Crypto</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Microsoft Encrypted File System</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Netscape Server Gated Crypto</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Microsoft EFS File Recovery</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>ekeyUsage</cstring>
@ -2521,12 +2528,6 @@ URI:http://www.my.com/my.crl, URI:http://www.oth.com/my.crl</string>
</image>
</images>
<connections>
<connection>
<sender>genKeyBUT</sender>
<signal>clicked()</signal>
<receiver>NewX509_UI</receiver>
<slot>newKey()</slot>
</connection>
<connection>
<sender>description</sender>
<signal>textChanged(const QString&amp;)</signal>
@ -2594,7 +2595,6 @@ URI:http://www.my.com/my.crl, URI:http://www.oth.com/my.crl</string>
<slot>helpClicked()</slot>
</connection>
<slot access="public">dataChangeP2()</slot>
<slot access="public">newKey()</slot>
<slot access="public">helpClicked()</slot>
<slot access="public">signerChanged()</slot>
<slot access="public">switchExtended()</slot>

View File

@ -92,7 +92,8 @@ CertView::CertView(QWidget * parent = 0, const char * name = 0, WFlags f = 0)
void CertView::newItem()
{
NewX509 *dlg = MainWindow::newX509(MainWindow::certImg);
NewX509 *dlg = new NewX509(this, NULL, true);
emit connNewX509(dlg);
dlg->setCert();
if (dlg->exec()) {
newCert(dlg);
@ -165,8 +166,8 @@ void CertView::newCert(NewX509 *dlg)
// Step 3 - Choose the Date and all the V3 extensions
// Date handling
notBefore = dlg->validity->getNotBefore();
notAfter = dlg->validity->getNotAfter();
notBefore = dlg->notBefore->getDate();
notAfter = dlg->notAfter->getDate();
// initially create cert
cert = new pki_x509();
@ -282,11 +283,8 @@ void CertView::newCert(NewX509 *dlg)
// and finally sign the request
cert->sign(signkey);
CERR( "SIGNED");
insert(cert);
CERR("inserted");
if (tempkey != NULL) delete(tempkey);
CERR("Dialog deleted" );
updateView();
return;
}
@ -308,8 +306,8 @@ void CertView::extendCert()
try {
CertExtend_UI *dlg = new CertExtend_UI(this, NULL, true);
dlg->image->setPixmap(*MainWindow::certImg);
dlg->validity->setNotBefore(time.now());
dlg->validity->setNotAfter(time.now(60 * 60 * 24 * 356));
dlg->notBefore->setDate(time.now());
dlg->notAfter->setDate(time.now(60 * 60 * 24 * 356));
if (!dlg->exec()) {
delete dlg;
@ -328,8 +326,8 @@ void CertView::extendCert()
// change date and serial
newcert->setSerial(serial);
newcert->setNotBefore(dlg->validity->getNotBefore());
newcert->setNotAfter(dlg->validity->getNotAfter());
newcert->setNotBefore(dlg->notBefore->getDate());
newcert->setNotAfter(dlg->notBefore->getDate());
if (newcert->resetTimes(signer) > 0) {
if (QMessageBox::information(this,tr(XCA_TITLE),
@ -342,9 +340,7 @@ void CertView::extendCert()
// and finally sign the request
newcert->sign(signkey);
CERR( "SIGNED");
insert(newcert);
CERR("inserted");
delete dlg;
}
catch (errorEx &err) {
@ -805,21 +801,21 @@ void CertView::popupMenu(QListViewItem *item, const QPoint &pt, int x) {
emit init_database();
if (!item) {
menu->insertItem(tr("New Certificate"), this, SLOT(newCert()));
menu->insertItem(tr("Import"), this, SLOT(loadCert()));
menu->insertItem(tr("New Certificate"), this, SLOT(newItem()));
menu->insertItem(tr("Import"), this, SLOT(load()));
menu->insertItem(tr("Import PKCS#12"), this, SLOT(loadPKCS12()));
menu->insertItem(tr("Import from PKCS#7"), this, SLOT(loadPKCS7()));
}
else {
pki_x509 *cert = (pki_x509 *)db->getByName(item->text(0));
menu->insertItem(tr("Rename"), this, SLOT(startRenameCert()));
menu->insertItem(tr("Show Details"), this, SLOT(showDetailsCert()));
menu->insertItem(tr("Rename"), this, SLOT(startRename()));
menu->insertItem(tr("Show Details"), this, SLOT(showItem()));
menu->insertItem(tr("Export"), subExport);
subExport->insertItem(tr("File"), this, SLOT(writeCert()));
subExport->insertItem(tr("File"), this, SLOT(store()));
itemReq = subExport->insertItem(tr("Request"), this, SLOT(toRequest()));
itemtca = subExport->insertItem(tr("TinyCA"), this, SLOT(toTinyCA()));
menu->insertItem(tr("Delete"), this, SLOT(deleteCert()));
menu->insertItem(tr("Delete"), this, SLOT(deleteItem()));
itemTrust = menu->insertItem(tr("Trust"), this, SLOT(setTrust()));
menu->insertSeparator();
itemCA = menu->insertItem(tr("CA"), subCa);

View File

@ -78,13 +78,13 @@ class CertView : public XcaListView
void popupMenu(QListViewItem *item, const QPoint &pt, int x);
void newCert();
void newCert(NewX509 *dlg);
void extendCert();
void loadPKCS12();
void insertP12(pki_pkcs12 *pk12);
void loadPKCS7();
void writePKCS12(QString s, bool chain);
void writePKCS7(QString s, int type);
public slots:
void loadPKCS12();
void loadPKCS7();
void extendCert();
void signP7();
void encryptP7();
void setTrust();

View File

@ -59,6 +59,7 @@
#include <qtextview.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qcheckbox.h>
const int KeyView::sizeList[] = {256, 512, 1024, 2048, 4096, 0 };

View File

@ -53,8 +53,8 @@
#define KEYVIEW_H
#include "XcaListView.h"
#include "lib/pki_key.h"
#include <qlistview.h>
class pki_base;
class KeyView : public XcaListView
{
@ -70,11 +70,11 @@ class KeyView : public XcaListView
void deleteItem();
void load();
pki_base *loadItem(QString fname);
pki_base* insert(pki_base *item);
pki_base *insert(pki_base *item);
void store();
void popupMenu(QListViewItem *item, const QPoint &pt, int x);
signals:
void keyDone(QString &);
void keyDone(QString);
void init_database();
};

View File

@ -81,7 +81,9 @@ void ReqView::newItem()
void ReqView::newItem(pki_temp *temp)
{
NewX509 *dlg = MainWindow::newX509(MainWindow::csrImg);
NewX509 *dlg = new NewX509(this,0,true);
emit connNewX509(dlg);
if (temp) {
dlg->defineTemplate(temp);
}

View File

@ -79,7 +79,6 @@ class ReqView : public XcaListView
void writeReq_der();
void signReq();
signals:
void keyDone(QString &);
void newCert(pki_x509req *req);
};

View File

@ -72,7 +72,9 @@ void TempView::newItem(int type)
bool TempView::alterTemp(pki_temp *temp)
{
NewX509 *dlg = MainWindow::newX509(MainWindow::tempImg);
NewX509 *dlg = new NewX509(this, NULL, true);
emit connNewX509(dlg);
dlg->setTemp(temp);
dlg->fromTemplate(temp);
if (!dlg->exec()) {

View File

@ -55,6 +55,7 @@
#include <qlistview.h>
#include "lib/db_base.h"
#include "lib/exception.h"
#include "widgets/NewX509.h"
class XcaListView : public QListView
{
@ -90,6 +91,7 @@ class XcaListView : public QListView
void updateView();
signals:
void init_database();
void connNewX509(NewX509 *);
};
#endif

View File

@ -101,6 +101,7 @@ void CertDetail::setCert(pki_x509 *cert)
// The dates
notBefore->setText(cert->getNotBefore().toPretty());
notAfter->setText(cert->getNotAfter().toPretty());
// validation of the Date
if (cert->checkDate() != 0) {
dateValid->setText(tr("Not valid"));

View File

@ -96,24 +96,25 @@ MainWindow::MainWindow(QWidget *parent, const char *name )
init_images();
CERR("Connecting init-database");
connect( keyList, SIGNAL(init_database()), this, SLOT(init_database()));
connect( reqList, SIGNAL(init_database()), this, SLOT(init_database()));
connect( certList, SIGNAL(init_database()), this, SLOT(init_database()));
connect( tempList, SIGNAL(init_database()), this, SLOT(init_database()));
CERR("Connecting Key Buttons");
connect( (const QObject *)BNnewKey, SIGNAL(clicked()), keyList, SLOT(newItem()));
connect( (const QObject *)BNexportKey, SIGNAL(clicked()), keyList, SLOT(store()));
connect( (const QObject *)BNimportKey, SIGNAL(clicked()), keyList, SLOT(load()));
connect( (const QObject *)BNdetailsKey, SIGNAL(clicked()), keyList, SLOT(showItem()));
connect( (const QObject *)BNdeleteKey, SIGNAL(clicked()), keyList, SLOT(deleteItem()));
CERR("Connecting Request Buttons");
connect( (const QObject *)BNnewReq, SIGNAL(clicked()), reqList, SLOT(newItem()));
connect( (const QObject *)BNimportReq, SIGNAL(clicked()), reqList, SLOT(load()));
connect( (const QObject *)BNdetailsReq, SIGNAL(clicked()), reqList, SLOT(showItem()));
connect( (const QObject *)BNdeleteReq, SIGNAL(clicked()), reqList, SLOT(deleteItem()));
connect( certList, SIGNAL(connNewX509(NewX509 *)), this, SLOT(connNewX509(NewX509 *)) );
connect( reqList, SIGNAL(connNewX509(NewX509 *)), this, SLOT(connNewX509(NewX509 *)) );
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
@ -418,11 +419,19 @@ void MainWindow::setPath(QString str)
settings->putString("workingdir", str);
}
NewX509 *MainWindow::newX509(QPixmap *image)
NewX509 *MainWindow::newX509()
{
return new NewX509(NULL, 0, keys, reqs, certs, temps, image, nsImg);
return new NewX509(NULL, 0, true);
}
void MainWindow::connNewX509(NewX509 *nx)
{
connect( (const QObject *)nx->genKeyBUT, SIGNAL(clicked()), keyList, SLOT(newItem()) );
connect( nx, SIGNAL(genKey()), keyList, SLOT(newItem()) );
connect( keyList, SIGNAL(keyDone(QString)), nx, SLOT(newKeyDone(QString)) );
}
QString MainWindow::getBaseDir()
{
#ifdef WIN32

View File

@ -103,7 +103,7 @@ class MainWindow: public MainWindow_UI
static int passWrite(char *buf, int size, int rwflag, void *userdata);
static void incProgress(int a, int b, void *progress);
static void dberr(const char *errpfx, char *msg);
static NewX509 *newX509(QPixmap *image);
static NewX509 *newX509();
QString md5passwd();
void Error(errorEx &err);
@ -112,6 +112,7 @@ class MainWindow: public MainWindow_UI
bool mkDir(QString dir);
public slots:
void init_database();
void connNewX509(NewX509 *nx);
};
#endif

View File

@ -21,7 +21,7 @@ CFLAGS=-Wall @ac_DEBUG@
##############################################
NAMES= ExportCert ExportKey ExportTinyCA NewX509 CrlDetail CertDetail \
MainWindow validity distname
MainWindow validity distname ReqDetail
OBJS=$(patsubst %,moc_%.o,$(NAMES)) $(patsubst %,%.o,$(NAMES))

View File

@ -65,11 +65,49 @@
#include "MainWindow.h"
#include "lib/x509name.h"
int NewX509::eku_nid[EKUN_CNT] = {
NID_server_auth,
NID_client_auth,
NID_code_sign,
NID_email_protect,
NID_time_stamp,
NID_ms_code_ind,
NID_ms_code_com,
NID_ms_ctl_sign,
NID_ms_sgc,
NID_ms_efs,
NID_ns_sgc,
OBJ_create("1.3.6.1.4.1.311.10.3.4.1", "msEFSFR",
"Microsoft EFS File Recovery" )
};
int NewX509::dn_nid[DISTNAME_CNT] = {
NID_commonName,
NID_surname,
NID_serialNumber,
NID_countryName,
NID_localityName,
NID_stateOrProvinceName,
NID_organizationName,
NID_organizationalUnitName,
NID_title,
NID_description,
NID_name,
NID_givenName,
NID_initials,
NID_generationQualifier,
NID_x500UniqueIdentifier,
NID_dnQualifier,
NID_pseudonym,
NID_role
};
NewX509::NewX509(QWidget *parent , const char *name, bool modal, WFlags f)
:NewX509_UI(parent, name, modal, f)
{
connect( this, SIGNAL(genKey()), parent, SLOT(newKey()) );
connect( parent, SIGNAL(keyDone(QString)), this, SLOT(newKeyDone(QString)) );
connect( extDNadd, SIGNAL(clicked()), this, SLOT(addX509NameEntry()) );
connect( extDNdel, SIGNAL(clicked()), this, SLOT(delX509NameEntry()) );
setCaption(tr(XCA_TITLE));
fixtemp = NULL;
nsImg->setPixmap(*MainWindow::nsImg);
@ -83,8 +121,9 @@ NewX509::NewX509(QWidget *parent , const char *name, bool modal, WFlags f)
#else
//setFont( tFont );
#endif
serialNr->setValidator( new QIntValidator(0, 32767, this));
// serialNr->setValidator( new QIntValidator(0, 32767, this));
QStringList strings;
// are there any useable private keys ?
strings = MainWindow::keys->get0PrivateDesc();
keyList->insertStringList(strings);
@ -100,7 +139,7 @@ NewX509::NewX509(QWidget *parent , const char *name, bool modal, WFlags f)
}
// How about signing certificates ?
strings = certs->getSignerDesc();
strings = MainWindow::certs->getSignerDesc();
if (strings.isEmpty()) {
foreignSignRB->setDisabled(true);
certList->setDisabled(true);
@ -117,7 +156,15 @@ NewX509::NewX509(QWidget *parent , const char *name, bool modal, WFlags f)
strings.prepend(tr("Empty Template"));
tempList->insertStringList(strings);
// setup Extended keyusage
for (int i=0; i<EKUN_CNT; i++)
ekeyUsage->insertItem(OBJ_nid2ln(eku_nid[i]));
// setup Distinguished Name
for (int i=0; i<DISTNAME_CNT; i++)
extDNobj->insertItem(OBJ_nid2ln(dn_nid[i]));
// last polish
setFinishEnabled(page7,true);
setNextEnabled(page2,false);
signerChanged();
@ -387,7 +434,7 @@ void NewX509::showPage(QWidget *page)
}
else if ( page == page2 ) {
if (keyList->isEnabled() && keyList->count() == 0 ) {
newKey();
emit genKey();
}
dataChangeP2();
}
@ -458,8 +505,8 @@ void NewX509::templateChanged()
return;
}
QString name = tempList->currentText();
if (name == "" || !temps) return;
temp = (pki_temp *)temps->getByName(name);
if (name.isEmpty()) return;
temp = (pki_temp *)MainWindow::temps->getByName(name);
if (!temp) return;
fromTemplate(temp);
}
@ -479,11 +526,6 @@ void NewX509::switchExtended()
}
}
void NewX509::newKey()
{
emit genKey();
}
void NewX509::newKeyDone(QString name)
{
keyList->insertItem(name,0);
@ -511,6 +553,22 @@ x509name NewX509::getX509name()
x.addEntryByNid(NID_organizationName, organisationName->text());
x.addEntryByNid(NID_organizationalUnitName, organisationalUnitName->text());
x.addEntryByNid(NID_pkcs9_emailAddress, emailAddress->text());
QListViewItem *lvi = extDNlist->firstChild();
while (lvi != NULL) {
int nid;
nid = OBJ_ln2nid(lvi->text(0).latin1());
x.addEntryByNid(nid, lvi->text(1));
lvi = lvi->nextSibling();
}
return x;
}
void NewX509::addX509NameEntry()
{
new QListViewItem(extDNlist, extDNobj->currentText(), extDNname->text());
}
void NewX509::delX509NameEntry()
{
extDNlist->removeItem(extDNlist->currentItem());
}

View File

@ -66,7 +66,11 @@ class NewX509: public NewX509_UI
private:
pki_temp *fixtemp;
QString startText, endText, tText;
#define EKUN_CNT 12
#define DISTNAME_CNT 18
static int eku_nid[EKUN_CNT];
static int dn_nid[DISTNAME_CNT];
public:
NewX509(QWidget *parent, const char *name, bool modal = false, WFlags f = 0);
~NewX509();
@ -89,16 +93,16 @@ class NewX509: public NewX509_UI
void setImage(QPixmap *image);
public slots:
void toggleFromRequest();
void newKey();
void dataChangeP2();
void newKeyDone(QString name);
void switchExtended();
void templateChanged();
void signerChanged();
void helpClicked();
void addX509NameEntry();
void delX509NameEntry();
signals:
void genKey();
void genKey();
};
#endif

View File

@ -51,17 +51,15 @@
#include "validity.h"
#include <qcombobox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qvalidator.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include "lib/asn1time.h"
Validity::Validity( QWidget* parent, const char* name )
: QGroupBox( parent, name )
: QWidget( parent, name )
{
QStringList months, days;
months << tr("Jan") << tr("Feb") << tr("Mar") << tr("Apr")
@ -72,40 +70,22 @@ Validity::Validity( QWidget* parent, const char* name )
if ( !name )
setName( "Validity" );
setTitle( tr( "Validity" ) );
ValidityLayout = new QGridLayout( this );
ValidityLayout = new QHBoxLayout( this );
ValidityLayout->setSpacing( 6 );
ValidityLayout->setMargin( 11 );
ValidityLayout->setMargin( 0 );
Label1 = new QLabel( this, "Label1" );
Label1->setText( tr( "not Before" ) );
Day = new QComboBox( FALSE, this, "Day" );
Mon = new QComboBox( FALSE, this, "Mon" );
Year = new QLineEdit( this, "Year" );
Year->setMaximumWidth(64);
Year->setValidator( new QIntValidator(1000, 9999, this));
Label2 = new QLabel( this, "Label2" );
Label2->setText( tr( "not After" ) );
ValidityLayout->addWidget( Day );
ValidityLayout->addWidget( Mon );
ValidityLayout->addWidget( Year );
nbDay = new QComboBox( FALSE, this, "nbDay" );
nbMon = new QComboBox( FALSE, this, "nbMon" );
nbYear = new QLineEdit( this, "nbYear" );
naDay = new QComboBox( FALSE, this, "naDay" );
naMon = new QComboBox( FALSE, this, "naMon" );
naYear = new QLineEdit( this, "naYear" );
ValidityLayout->addWidget( Label1, 0, 0 );
ValidityLayout->addWidget( nbDay, 0, 1 );
ValidityLayout->addWidget( nbMon, 0, 2 );
ValidityLayout->addWidget( nbYear, 0, 3 );
ValidityLayout->addWidget( Label2, 1, 0 );
ValidityLayout->addWidget( naDay, 1, 1 );
ValidityLayout->addWidget( naMon, 1, 2 );
ValidityLayout->addWidget( naYear, 1, 3 );
nbMon->insertStringList(months);
naMon->insertStringList(months);
nbDay->insertStringList(days);
naDay->insertStringList(days);
Mon->insertStringList(months);
Day->insertStringList(days);
}
Validity::~Validity()
@ -113,37 +93,20 @@ Validity::~Validity()
// no need to delete child widgets, Qt does it all for us
}
a1time Validity::getNotBefore() const
a1time Validity::getDate() const
{
a1time date;
date.set(nbYear->text().toInt(), nbMon->currentItem() + 1,
nbDay->currentItem() +1, 0, 0, 0);
date.set(Year->text().toInt(), Mon->currentItem() + 1,
Day->currentItem() +1, 0, 0, 0);
return date;
}
a1time Validity::getNotAfter() const
{
a1time date;
date.set(naYear->text().toInt(), naMon->currentItem() + 1,
naDay->currentItem() +1, 0, 0, 0);
return date;
}
void Validity::setNotBefore(const a1time &a)
void Validity::setDate(const a1time &a)
{
int y, m, d, g;
a.ymdg(&y,&m,&d,&g);
nbYear->setText(QString::number(y));
nbMon->setCurrentItem(m-1);
nbDay->setCurrentItem(d-1);
}
void Validity::setNotAfter(const a1time &a)
{
int y, m, d, g;
a.ymdg(&y,&m,&d,&g);
naYear->setText(QString::number(y));
naMon->setCurrentItem(m-1);
naDay->setCurrentItem(d-1);
Year->setText(QString::number(y));
Mon->setCurrentItem(m-1);
Day->setCurrentItem(d-1);
}

View File

@ -53,29 +53,25 @@
#include <qgroupbox.h>
class QGridLayout;
class QHBoxLayout;
class a1time;
class QLabel;
class QComboBox;
class QLineEdit;
class Validity : public QGroupBox
class Validity : public QWidget
{
Q_OBJECT
public:
Validity( QWidget* parent = 0, const char* name = 0);
~Validity();
a1time getNotBefore() const;
a1time getNotAfter() const;
void setNotBefore(const a1time &t);
void setNotAfter(const a1time &t);
a1time getDate() const;
void setDate(const a1time &t);
protected:
QGridLayout* ValidityLayout;
QLabel *Label1, *Label2;
QComboBox *nbDay, *nbMon, *naMon, *naDay;
QLineEdit *nbYear, *naYear;
QHBoxLayout* ValidityLayout;
QComboBox *Mon, *Day;
QLineEdit *Year;
};