diff --git a/lib/pki_key.cpp b/lib/pki_key.cpp
index 6b77b668..e3fd02ad 100644
--- a/lib/pki_key.cpp
+++ b/lib/pki_key.cpp
@@ -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;
}
diff --git a/lib/pki_x509super.cpp b/lib/pki_x509super.cpp
index 8b3f376e..55e39a0e 100644
--- a/lib/pki_x509super.cpp
+++ b/lib/pki_x509super.cpp
@@ -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() {}
diff --git a/ui/CertExtend.ui b/ui/CertExtend.ui
index 9c576f0f..b48a420e 100644
--- a/ui/CertExtend.ui
+++ b/ui/CertExtend.ui
@@ -11,8 +11,8 @@
0
0
- 335
- 336
+ 388
+ 304
@@ -145,11 +145,78 @@
- Validity
+ QGroupBox
name
- validity
+ GroupBox8
+
+ title
+ Validity
+
+
+
+ margin
+ 11
+
+
+ spacing
+ 6
+
+
+ QLayoutWidget
+
+ name
+ Layout16
+
+
+
+ margin
+ 0
+
+
+ spacing
+ 6
+
+
+ QLabel
+
+ name
+ TextLabel1_2
+
+
+ text
+ not Before
+
+
+
+ QLabel
+
+ name
+ TextLabel2_4
+
+
+ text
+ not After
+
+
+
+ Validity
+
+ name
+ notBefore
+
+
+
+ Validity
+
+ name
+ notAfter
+
+
+
+
+
diff --git a/ui/NewX509.ui b/ui/NewX509.ui
index 0e6496fd..222e163d 100644
--- a/ui/NewX509.ui
+++ b/ui/NewX509.ui
@@ -11,8 +11,8 @@
0
0
- 644
- 542
+ 615
+ 590
@@ -678,9 +678,9 @@ Empy, CA, client, server
title
- Source of the subject and the key
+ Source of the subject
-
+
margin
11
@@ -689,182 +689,320 @@ Empy, CA, client, server
spacing
6
-
- QLabel
+
+ QLayoutWidget
name
- TextLabel1_3_2
-
-
- text
- Internal name
+ Layout20
+
+
+ margin
+ 0
+
+
+ spacing
+ 6
+
+
+ QLineEdit
+
+ name
+ emailAddress
+
+
+ maxLength
+ 60
+
+
+
+ QLabel
+
+ name
+ TextLabel4_2_2
+
+
+ text
+ Organisation
+
+
+
+ QLineEdit
+
+ name
+ description
+
+
+ maxLength
+ 100
+
+
+ toolTip
+ This name is only used internally and does not appear in the resulting certificate
+
+
+
+ QLineEdit
+
+ name
+ countryName
+
+
+ maxLength
+ 2
+
+
+ toolTip
+ Must be exactly 2 letter of size (DE, UK)
+
+
+
+ QLineEdit
+
+ name
+ commonName
+
+
+ maxLength
+ 64
+
+
+
+ QLabel
+
+ name
+ TextLabel2_2
+
+
+ text
+ Country code
+
+
+
+ QLabel
+
+ name
+ TextLabel3_2
+
+
+ text
+ Country
+
+
+
+ QLineEdit
+
+ name
+ stateOrProvinceName
+
+
+
+ QLabel
+
+ name
+ TextLabel4_3
+
+
+ text
+ Locality
+
+
+
+ QLabel
+
+ name
+ TextLabel5_2
+
+
+ text
+ Organ. unit
+
+
+
+ QLabel
+
+ name
+ TextLabel6_2
+
+
+ text
+ Common name
+
+
+
+ QLabel
+
+ name
+ TextLabel7_2
+
+
+ text
+ E-Mail address
+
+
+
+ QLineEdit
+
+ name
+ localityName
+
+
+
+ QLineEdit
+
+ name
+ organisationalUnitName
+
+
+
+ QLabel
+
+ name
+ TextLabel1_3_2
+
+
+ text
+ Internal name
+
+
+
+ QLineEdit
+
+ name
+ organisationName
+
+
+
-
- QLineEdit
+
+ Line
name
- description
+ Line1
- maxLength
- 100
-
-
- toolTip
- This name is only used internally and does not appear in the resulting certificate
+ orientation
+ Horizontal
-
- QLineEdit
+
+ QLayoutWidget
name
- countryName
-
-
- maxLength
- 2
-
-
- toolTip
- Must be exactly 2 letter of size (DE, UK)
+ Layout23
+
+
+ margin
+ 0
+
+
+ spacing
+ 6
+
+
+ QComboBox
+
+ name
+ extDNobj
+
+
+
+ QLineEdit
+
+ name
+ extDNname
+
+
+ maxLength
+ 100
+
+
+ toolTip
+ This name is only used internally and does not appear in the resulting certificate
+
+
+
+ QPushButton
+
+ name
+ extDNadd
+
+
+ text
+ Add
+
+
+
+ QPushButton
+
+ name
+ extDNdel
+
+
+ text
+ Delete
+
+
+
-
- QLabel
+
+ QListView
+
+
+ text
+ Object
+
+
+ clickable
+ true
+
+
+ resizeable
+ true
+
+
+
+
+ text
+ Value
+
+
+ clickable
+ true
+
+
+ resizeable
+ true
+
+
name
- TextLabel2_2
-
-
- text
- Country code
+ extDNlist
-
- QLabel
-
- name
- TextLabel3_2
-
-
- text
- Country
-
-
-
- QLineEdit
-
- name
- localityName
-
-
-
- QLineEdit
-
- name
- organisationalUnitName
-
-
-
- QLineEdit
-
- name
- commonName
-
-
- maxLength
- 64
-
-
-
- QLineEdit
-
- name
- emailAddress
-
-
- maxLength
- 60
-
-
-
- QLineEdit
-
- name
- stateOrProvinceName
-
-
-
- QLineEdit
-
- name
- sureName
-
-
- maxLength
- 100
-
-
- toolTip
- This name is only used internally and does not appear in the resulting certificate
-
-
-
- QLineEdit
-
- name
- givenName
-
-
- maxLength
- 2
-
-
- toolTip
- Must be exactly 2 letter of size (DE, UK)
-
-
-
- QLineEdit
-
- name
- initials
-
-
- maxLength
- 64
-
-
-
- QLineEdit
-
- name
- role
-
-
-
- QLineEdit
-
- name
- localityName_2
-
-
-
- QLineEdit
-
- name
- pseudonym
-
-
-
- QLineEdit
-
- name
- title
-
-
-
+
+
+
+ QGroupBox
+
+ name
+ GroupBox7
+
+
+ title
+ Private key
+
+
+
+ margin
+ 11
+
+
+ spacing
+ 6
+
+
QComboBox
name
@@ -875,183 +1013,7 @@ Empy, CA, client, server
This list only contains unused keys
-
- QLabel
-
- name
- TextLabel1_3_2_2
-
-
- text
- Sure name
-
-
-
- QLabel
-
- name
- TextLabel3_2_3
-
-
- text
- Title
-
-
-
- QLabel
-
- name
- TextLabel4_3
-
-
- text
- Locality
-
-
-
- QLabel
-
- name
- TextLabel4_3_2
-
-
- text
- Name
-
-
-
- QLabel
-
- name
- TextLabel5_2
-
-
- text
- Organ. unit
-
-
-
- QLabel
-
- name
- TextLabel6_2
-
-
- text
- Common name
-
-
-
- QLabel
-
- name
- TextLabel7_2
-
-
- text
- E-Mail address
-
-
-
- QLineEdit
-
- name
- organisationName
-
-
-
- QLabel
-
- name
- TextLabel2_2_2
-
-
- text
- Given Name
-
-
-
- QLabel
-
- name
- TextLabel4_2_2
-
-
- text
- Organisation
-
-
-
- QLabel
-
- name
- TextLabel1_2_3
-
-
- text
- Private key
-
-
-
- QLabel
-
- name
- TextLabel6_2_2
-
-
- text
- Initials
-
-
-
- QLabel
-
- name
- TextLabel5_2_2
-
-
- text
- Role
-
-
-
- QLabel
-
- name
- TextLabel4_2_2_2
-
-
- text
- Pseudonym
-
-
-
- QPushButton
-
- name
- genKeyBUT
-
-
- text
- &Generate a new key
-
-
- toolTip
- This funny button creates a key. Go figure.
-
-
-
- QLabel
-
- name
- TextLabel7_2_2
-
-
- text
- Hash Algo
-
-
-
+
QComboBox
-
@@ -1076,14 +1038,43 @@ Empy, CA, client, server
ComboBox19
-
- QLabel
+
+
+ name
+ Spacer33_2
+
+
+ orientation
+ Horizontal
+
+
+ sizeType
+ Expanding
+
+
+ sizeHint
+
+ 20
+ 20
+
+
+
+
+ QPushButton
name
- TextLabel3_3
+ genKeyBUT
+
+
+ text
+ &Generate a new key
+
+
+ toolTip
+ This funny button creates a key. Go figure.
-
+
@@ -1423,11 +1414,99 @@ It also copies the issuer and serial number from the issuer certificate. Normall
- Validity
+ QGroupBox
name
- validity
+ GroupBox8
+
+ title
+ Validity
+
+
+
+ margin
+ 11
+
+
+ spacing
+ 6
+
+
+ QLayoutWidget
+
+ name
+ Layout16
+
+
+
+ margin
+ 0
+
+
+ spacing
+ 6
+
+
+ QLabel
+
+ name
+ TextLabel1_2
+
+
+ text
+ not Before
+
+
+
+ QLabel
+
+ name
+ TextLabel2_4
+
+
+ text
+ not After
+
+
+
+ Validity
+
+ name
+ notBefore
+
+
+
+ Validity
+
+ name
+ notAfter
+
+
+
+
+
+
+ name
+ Spacer34_2
+
+
+ orientation
+ Horizontal
+
+
+ sizeType
+ Expanding
+
+
+ sizeHint
+
+ 20
+ 20
+
+
+
+
@@ -1867,78 +1946,6 @@ URI:http://www.my.com/my.crl, URI:http://www.oth.com/my.crl
QListBox
- -
-
- text
- SSL/TLS Web Server Authentication
-
-
- -
-
- text
- SSL/TLS Web Client Authentication
-
-
- -
-
- text
- Code signing
-
-
- -
-
- text
- E-mail Protection (S/MIME)
-
-
- -
-
- text
- Trusted Timestamping
-
-
- -
-
- text
- Microsoft Individual Code Signing (authenticode)
-
-
- -
-
- text
- Microsoft Commercial Code Signing (authenticode)
-
-
- -
-
- text
- Microsoft Trust List Signing
-
-
- -
-
- text
- Microsoft Server Gated Crypto
-
-
- -
-
- text
- Microsoft Encrypted File System
-
-
- -
-
- text
- Netscape Server Gated Crypto
-
-
- -
-
- text
- Microsoft EFS File Recovery
-
-
name
ekeyUsage
@@ -2521,12 +2528,6 @@ URI:http://www.my.com/my.crl, URI:http://www.oth.com/my.crl
-
- genKeyBUT
- clicked()
- NewX509_UI
- newKey()
-
description
textChanged(const QString&)
@@ -2594,7 +2595,6 @@ URI:http://www.my.com/my.crl, URI:http://www.oth.com/my.crl
helpClicked()
dataChangeP2()
- newKey()
helpClicked()
signerChanged()
switchExtended()
diff --git a/view/CertView.cpp b/view/CertView.cpp
index 09feeda5..d1e7c701 100644
--- a/view/CertView.cpp
+++ b/view/CertView.cpp
@@ -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);
diff --git a/view/CertView.h b/view/CertView.h
index 99a54cb7..35999d9a 100644
--- a/view/CertView.h
+++ b/view/CertView.h
@@ -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();
diff --git a/view/KeyView.cpp b/view/KeyView.cpp
index 09199930..81e5b2be 100644
--- a/view/KeyView.cpp
+++ b/view/KeyView.cpp
@@ -59,6 +59,7 @@
#include
#include
#include
+#include
const int KeyView::sizeList[] = {256, 512, 1024, 2048, 4096, 0 };
diff --git a/view/KeyView.h b/view/KeyView.h
index 98c4bb9a..628a534a 100644
--- a/view/KeyView.h
+++ b/view/KeyView.h
@@ -53,8 +53,8 @@
#define KEYVIEW_H
#include "XcaListView.h"
-#include "lib/pki_key.h"
-#include
+
+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();
};
diff --git a/view/ReqView.cpp b/view/ReqView.cpp
index d1606414..78912e18 100644
--- a/view/ReqView.cpp
+++ b/view/ReqView.cpp
@@ -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);
}
diff --git a/view/ReqView.h b/view/ReqView.h
index d694ceeb..310bdf74 100644
--- a/view/ReqView.h
+++ b/view/ReqView.h
@@ -79,7 +79,6 @@ class ReqView : public XcaListView
void writeReq_der();
void signReq();
signals:
- void keyDone(QString &);
void newCert(pki_x509req *req);
};
diff --git a/view/TempView.cpp b/view/TempView.cpp
index 3121d40b..6504417a 100644
--- a/view/TempView.cpp
+++ b/view/TempView.cpp
@@ -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()) {
diff --git a/view/XcaListView.h b/view/XcaListView.h
index b3fcb212..77251c5b 100644
--- a/view/XcaListView.h
+++ b/view/XcaListView.h
@@ -55,6 +55,7 @@
#include
#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
diff --git a/widgets/CertDetail.cpp b/widgets/CertDetail.cpp
index e47d153a..8f5ba923 100644
--- a/widgets/CertDetail.cpp
+++ b/widgets/CertDetail.cpp
@@ -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"));
diff --git a/widgets/MainWindow.cpp b/widgets/MainWindow.cpp
index 6707cca7..f1ed02f1 100644
--- a/widgets/MainWindow.cpp
+++ b/widgets/MainWindow.cpp
@@ -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
diff --git a/widgets/MainWindow.h b/widgets/MainWindow.h
index 96a21a89..9ccffd84 100644
--- a/widgets/MainWindow.h
+++ b/widgets/MainWindow.h
@@ -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
diff --git a/widgets/Makefile.in b/widgets/Makefile.in
index a8494ae9..98f0e773 100644
--- a/widgets/Makefile.in
+++ b/widgets/Makefile.in
@@ -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))
diff --git a/widgets/NewX509.cpp b/widgets/NewX509.cpp
index b34610ac..bd8bc20d 100644
--- a/widgets/NewX509.cpp
+++ b/widgets/NewX509.cpp
@@ -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; iinsertItem(OBJ_nid2ln(eku_nid[i]));
+
+ // setup Distinguished Name
+ for (int i=0; iinsertItem(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());
+}
diff --git a/widgets/NewX509.h b/widgets/NewX509.h
index 9f9c0711..7e659949 100644
--- a/widgets/NewX509.h
+++ b/widgets/NewX509.h
@@ -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
diff --git a/widgets/validity.cpp b/widgets/validity.cpp
index 77be64c1..fdb95f83 100644
--- a/widgets/validity.cpp
+++ b/widgets/validity.cpp
@@ -51,17 +51,15 @@
#include "validity.h"
#include
-#include
#include
-#include
+#include
#include
-#include
#include
#include
#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);
}
diff --git a/widgets/validity.h b/widgets/validity.h
index a06247f9..e4dbbe29 100644
--- a/widgets/validity.h
+++ b/widgets/validity.h
@@ -53,29 +53,25 @@
#include
-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;
};