diff --git a/COPYRIGHT b/COPYRIGHT
index cfa7c9c6..31eb0cc8 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/CertDetail.ui b/CertDetail.ui
index 9cf50324..e0fa209e 100644
--- a/CertDetail.ui
+++ b/CertDetail.ui
@@ -11,7 +11,7 @@
0
0
- 538
+ 534
763
@@ -1800,7 +1800,7 @@
QPushButton
name
- PushButton10
+ but_ok
text
@@ -1832,7 +1832,7 @@
QPushButton
name
- PushButton11
+ but_cancel
text
@@ -1845,13 +1845,13 @@
- PushButton10
+ but_ok
clicked()
CertDetail_UI
accept()
- PushButton11
+ but_cancel
clicked()
CertDetail_UI
reject()
diff --git a/ExportKey.cpp b/ExportKey.cpp
index 510f9d94..2d465c4e 100644
--- a/ExportKey.cpp
+++ b/ExportKey.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/ExportKey.h b/ExportKey.h
index 360ab623..81153bc0 100644
--- a/ExportKey.h
+++ b/ExportKey.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/KeyDetail.ui b/KeyDetail.ui
index 79ff86df..54764596 100644
--- a/KeyDetail.ui
+++ b/KeyDetail.ui
@@ -11,7 +11,7 @@
0
0
- 470
+ 466
349
@@ -766,7 +766,7 @@
textFormat
- PlainText
+ AutoText
@@ -788,7 +788,7 @@
QPushButton
name
- PushButton1
+ but_ok
text
@@ -824,7 +824,7 @@
QPushButton
name
- PushButton2
+ but_cancel
text
@@ -837,19 +837,19 @@
- PushButton2
+ but_cancel
clicked()
KeyDetail_UI
reject()
- PushButton1
+ but_ok
clicked()
KeyDetail_UI
accept()
- PushButton1
+ but_ok
clicked()
KeyDetail_UI
accept()
diff --git a/MainWindow.cpp b/MainWindow.cpp
index a6f76120..54d8fbb3 100644
--- a/MainWindow.cpp
+++ b/MainWindow.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/MainWindow.h b/MainWindow.h
index 3843b915..57519ba0 100644
--- a/MainWindow.h
+++ b/MainWindow.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
@@ -117,9 +118,9 @@ class MainWindow: public MainWindow_UI
void loadSettings();
void saveSettings();
void initPass();
- void showDetailsKey(pki_key *key);
+ bool showDetailsKey(pki_key *key, bool import = false);
void showDetailsReq(pki_x509req *req);
- void showDetailsCert(pki_x509 *cert);
+ bool showDetailsCert(pki_x509 *cert, bool import = false);
static int passRead(char *buf, int size, int rwflag, void *userdata);
static int passWrite(char *buf, int size, int rwflag, void *userdata);
static void incProgress(int a, int b, void *progress);
diff --git a/MainWindow.ui b/MainWindow.ui
index 9b66e9dd..1644ceaa 100644
--- a/MainWindow.ui
+++ b/MainWindow.ui
@@ -12,7 +12,7 @@
0
0
- 820
+ 816
604
@@ -534,6 +534,17 @@
Export PKCS#12
+
+ QPushButton
+
+ name
+ PushButton18
+
+
+ text
+ Import PKCS#12
+
+
name
@@ -784,6 +795,12 @@
MainWindow_UI
showPopupReq(QListViewItem *, const QPoint &, int)
+
+ PushButton18
+ clicked()
+ MainWindow_UI
+ loadPKCS12()
+
deleteCert()
deleteKey()
deleteReq()
@@ -793,7 +810,7 @@
newCert()
newKey()
newReq()
- showPopupKey(QListViewItem *, const QPoint &, int)
+ loadPKCS12()
showDetailsCert()
showDetailsCert(QListViewItem *)
showDetailsKey()
@@ -801,6 +818,7 @@
showDetailsReq()
showDetailsReq(QListViewItem *)
showPopupCert(QListViewItem *, const QPoint &, int)
+ showPopupKey(QListViewItem *, const QPoint &, int)
showPopupReq(QListViewItem *, const QPoint &, int)
writeCert()
writeKey()
diff --git a/MainWindowKeys.cpp b/MainWindowKeys.cpp
index 8ef4c73b..2fe9dea7 100644
--- a/MainWindowKeys.cpp
+++ b/MainWindowKeys.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
@@ -109,9 +110,10 @@ void MainWindow::deleteKey()
}
-void MainWindow::showDetailsKey(pki_key *key)
+bool MainWindow::showDetailsKey(pki_key *key, bool import = false)
{
- if (key == NULL ) return;
+ if (!key) return false;
+ if (opensslError(key)) return false;
KeyDetail_UI *detDlg = new KeyDetail_UI(this, 0, true, 0 );
detDlg->keyDesc->setText(
@@ -127,12 +129,17 @@ void MainWindow::showDetailsKey(pki_key *key)
detDlg->keyPrivEx->setDisabled(true);
}
detDlg->image->setPixmap(*keyImg);
-
- if ( !detDlg->exec()) return;
+ if (import) {
+ detDlg->but_ok->setText(tr("Import"));
+ detDlg->but_cancel->setText(tr("Discard"));
+ }
+
+ if ( !detDlg->exec()) return false;
string ndesc = detDlg->keyDesc->text().latin1();
if (ndesc != key->getDescription()) {
keys->renamePKI(key, ndesc);
}
+ return true;
}
diff --git a/MainWindowX509.cpp b/MainWindowX509.cpp
index f4a3a73a..78248112 100644
--- a/MainWindowX509.cpp
+++ b/MainWindowX509.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
@@ -227,10 +228,10 @@ void MainWindow::showDetailsCert(QListViewItem *item)
}
-void MainWindow::showDetailsCert(pki_x509 *cert)
+bool MainWindow::showDetailsCert(pki_x509 *cert, bool import = false)
{
- if (!cert) return;
- if (opensslError(cert)) return;
+ if (!cert) return false;
+ if (opensslError(cert)) return false;
CertDetail_UI *dlg = new CertDetail_UI(this,0,true);
dlg->image->setPixmap(*certImg);
dlg->descr->setText(cert->getDescription().c_str());
@@ -315,14 +316,22 @@ void MainWindow::showDetailsCert(pki_x509 *cert)
// V3 extensions
dlg->v3Extensions->setText(cert->printV3ext().c_str());
+
+ // rename the buttons in case of import
+ if (import) {
+ dlg->but_ok->setText(tr("Import"));
+ dlg->but_cancel->setText(tr("Discard"));
+ }
+
// show it to the user...
- if ( !dlg->exec()) return;
+ if ( !dlg->exec()) return false;
string ndesc = dlg->descr->text().latin1();
if (ndesc != cert->getDescription()) {
certs->renamePKI(cert, ndesc);
}
- opensslError(cert);
+ if (opensslError(cert)) return false;
+ return true;
}
void MainWindow::deleteCert()
@@ -360,11 +369,56 @@ void MainWindow::loadCert()
void MainWindow::loadPKCS12()
{
+ pki_pkcs12 *pk12;
+ pki_x509 *acert;
+ pki_key *akey;
QStringList filt;
filt.append(tr("PKCS#12 Certificates ( *.p12 )"));
filt.append(tr("All files ( *.* )"));
string s;
QFileDialog *dlg = new QFileDialog(this,0,true);
+ dlg->setCaption(tr("Certificate import"));
+ dlg->setFilters(filt);
+ if (dlg->exec())
+ s = dlg->selectedFile().latin1();
+ if (s == "") return;
+ pk12 = new pki_pkcs12(s, &MainWindow::passRead);
+ opensslError(pk12);
+ akey = pk12->getKey();
+ acert = pk12->getCert();
+ opensslError(akey);
+ opensslError(acert);
+ opensslError(pk12);
+ insertKey(akey);
+ insertCert(acert);
+ for (int i=0; inumCa(); i++) {
+ acert = pk12->getCa(i);
+ insertCert(acert);
+ }
+
+/* insert with asking.....
+ if (showDetailsKey(akey, true)) {
+ insertKey(akey);
+ }
+ else {
+ delete(akey);
+ }
+ if (showDetailsCert(acert,true)) {
+ insertCert(acert);
+ }
+ else {
+ delete(acert);
+ }
+ for (int i=0; inumCa(); i++) {
+ acert = pk12->getCa(i);
+ if (showDetailsCert(acert, true)) {
+ insertCert(acert);
+ }
+ else {
+ delete(acert);
+ }
+ }
+*/
}
void MainWindow::insertCert(pki_x509 *cert)
@@ -411,6 +465,7 @@ void MainWindow::writePKCS12()
QFileDialog *dlg = new QFileDialog(this,0,true);
dlg->setCaption(tr("PKCS#12 export"));
dlg->setFilters(filt);
+ dlg->setMode( QFileDialog::AnyFile );
if (dlg->exec())
s = dlg->selectedFile().latin1();
if (s == "") return;
diff --git a/MainWindowX509Req.cpp b/MainWindowX509Req.cpp
index faba7e2d..a5294333 100644
--- a/MainWindowX509Req.cpp
+++ b/MainWindowX509Req.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/Makefile.in b/Makefile.in
index b9c06db9..6eda476e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,13 +1,15 @@
#
# @configure_input@
#
+# $id$
+#
VERSION=@PACKAGE_VERSION@
TAG=$(shell echo "V.$(VERSION)" |sed "s/\./_/g" )
TARGET=xca-$(VERSION)
GCC=@CXX@
-CPPFLAGS=@CPPFLAGS@ -Wall -g
+CPPFLAGS=@CPPFLAGS@ -Wall -ggdb
LIBS=-Llib @LDFLAGS@ @LIBS@ -lxcadb -lpki
MOC=@MOC@
@@ -70,6 +72,7 @@ clean:
rm -rf *_MOC.cpp *_UI.h *_UI.cpp *~ *.o xca
distclean: clean
+ make -C lib distclean
rm -f Makefile config.cache config.h
dist:
diff --git a/NewX509.cpp b/NewX509.cpp
index 789cbf53..d0d95e17 100644
--- a/NewX509.cpp
+++ b/NewX509.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/NewX509.h b/NewX509.h
index 59eeb3fa..020286a4 100644
--- a/NewX509.h
+++ b/NewX509.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/README b/README
index 238f31dd..c400c546 100644
--- a/README
+++ b/README
@@ -33,7 +33,8 @@ Installation
============
should be straight forward:
-just type 'make' to compile
+just type 'configure' to configure the package,
+then type 'make' to compile
and as root: 'make install'
for installation
@@ -42,10 +43,10 @@ than the recommended software packages, or on an other platform
than Linux, or if it failed :-)
-
----------------------------------------------------------
if there are any questions regarding this software,
dont hesitate to contact me:
christian@hohnstaedt.de
+$id$
diff --git a/configure.ac b/configure.ac
index 97fac798..709aeeab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT(xca, 0.2.3)
+AC_INIT(xca, 0.2.4)
AC_CONFIG_SRCDIR([MainWindow.h])
AC_CONFIG_HEADERS([config.h])
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 62094012..1e05cd04 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -1,6 +1,7 @@
#
# @configure_input@
#
+# $id$
VERSION=@PACKAGE_VERSION@
TARGET=xca-$(VERSION)
@@ -34,5 +35,5 @@ clean:
rm -rf *~ *.o *.a
distclean: clean
- Makefile
+ rm -f Makefile
diff --git a/lib/db_base.cpp b/lib/db_base.cpp
index fec83179..43147da2 100644
--- a/lib/db_base.cpp
+++ b/lib/db_base.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/db_base.h b/lib/db_base.h
index ea0e4d98..691f33fa 100644
--- a/lib/db_base.h
+++ b/lib/db_base.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/db_key.cpp b/lib/db_key.cpp
index d0a3a8a6..b8aa9549 100644
--- a/lib/db_key.cpp
+++ b/lib/db_key.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/db_key.h b/lib/db_key.h
index c22766ad..cac21a85 100644
--- a/lib/db_key.h
+++ b/lib/db_key.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/db_x509.cpp b/lib/db_x509.cpp
index 52c5a9ec..c5e63369 100644
--- a/lib/db_x509.cpp
+++ b/lib/db_x509.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/db_x509.h b/lib/db_x509.h
index 8f268492..532abc96 100644
--- a/lib/db_x509.h
+++ b/lib/db_x509.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/db_x509req.cpp b/lib/db_x509req.cpp
index fde7b51a..9c48512e 100644
--- a/lib/db_x509req.cpp
+++ b/lib/db_x509req.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/db_x509req.h b/lib/db_x509req.h
index 4de67765..bc3ba2f7 100644
--- a/lib/db_x509req.h
+++ b/lib/db_x509req.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/pki_base.cpp b/lib/pki_base.cpp
index 47f70c1e..4690754b 100644
--- a/lib/pki_base.cpp
+++ b/lib/pki_base.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/pki_base.h b/lib/pki_base.h
index b1aaffbb..157eef95 100644
--- a/lib/pki_base.h
+++ b/lib/pki_base.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/pki_key.cpp b/lib/pki_key.cpp
index 8e9c59be..71f3a851 100644
--- a/lib/pki_key.cpp
+++ b/lib/pki_key.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
@@ -68,7 +69,11 @@ pki_key::pki_key(const pki_key *pk)
:pki_base(pk->desc)
{
key = EVP_PKEY_new();
- EVP_PKEY_copy_parameters(key, pk->key);
+ 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));
+ }
+ // TODO add DSA support.....
openssl_error();
}
diff --git a/lib/pki_key.h b/lib/pki_key.h
index f77b41cc..be915b48 100644
--- a/lib/pki_key.h
+++ b/lib/pki_key.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/pki_pkcs12.cpp b/lib/pki_pkcs12.cpp
index 825d0ca9..aa8083f3 100644
--- a/lib/pki_pkcs12.cpp
+++ b/lib/pki_pkcs12.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
@@ -54,8 +55,8 @@
pki_pkcs12::pki_pkcs12(const string d, pki_x509 *acert, pki_key *akey, pem_password_cb *cb):
pki_base(d)
{
- key = akey;
- cert = acert;
+ key = new pki_key(akey);
+ cert = new pki_x509(acert);
certstack = sk_X509_new_null();
pkcs12 = NULL;
passcb = cb;
@@ -69,6 +70,9 @@ pki_pkcs12::pki_pkcs12(const string fname, pem_password_cb *cb)
char pass[30];
EVP_PKEY *mykey;
X509 *mycert;
+ key=NULL; cert=NULL; pkcs12=NULL;
+ passcb = cb;
+ certstack = sk_X509_new_null();
PASS_INFO p;
string title = "Password to import the PKCS#12 certificate";
string description = "Please enter the password to encrypt the PKCS#12 bag.";
@@ -77,14 +81,24 @@ pki_pkcs12::pki_pkcs12(const string fname, pem_password_cb *cb)
fp = fopen(fname.c_str(), "rb");
if (fp) {
pkcs12 = d2i_PKCS12_fp(fp, NULL);
+ CERR<<"PK12 A" <setDescription("pk12-import");
+ //EVP_PKEY_free(mykey);
+ }
+ if (mycert) {
+ cert = new pki_x509(mycert);
+ cert->setDescription("pk12-import");
+ //X509_free(mycert);
+ }
}
else pki_error("Error opening file");
}
@@ -93,13 +107,15 @@ pki_pkcs12::pki_pkcs12(const string fname, pem_password_cb *cb)
pki_pkcs12::~pki_pkcs12()
{
sk_X509_pop_free(certstack, X509_free); // free the certs itself, because we own a copy of them
+ delete(key);
+ delete(cert);
PKCS12_free(pkcs12);
}
void pki_pkcs12::addCaCert(pki_x509 *ca)
{
- if (ca == 0) return;
+ if (!ca) return;
sk_X509_push(certstack, X509_dup(ca->getCert()));
}
@@ -135,21 +151,24 @@ void pki_pkcs12::writePKCS12(const string fname)
else pki_error("Error opening file");
}
-int pki_pkcs12::num_ca() {
+int pki_pkcs12::numCa() {
return sk_X509_num(certstack);
}
pki_key *pki_pkcs12::getKey() {
- return key;
+ return new pki_key(key);
}
pki_x509 *pki_pkcs12::getCert() {
- return cert;
+ return new pki_x509(cert);
}
pki_x509 *pki_pkcs12::getCa(int x) {
- return new pki_x509(sk_X509_value(certstack, x));
+ pki_x509 *cert;
+ cert = new pki_x509(X509_dup(sk_X509_value(certstack, x)));
+ cert->setDescription("pk12-import");
+ return cert;
}
diff --git a/lib/pki_pkcs12.h b/lib/pki_pkcs12.h
index 4560e55f..be487a3e 100644
--- a/lib/pki_pkcs12.h
+++ b/lib/pki_pkcs12.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
@@ -85,7 +86,7 @@ class pki_pkcs12: public pki_base
pki_key *getKey();
pki_x509 *getCert();
pki_x509 *getCa(int x);
- int num_ca(); // number of ca certs;
+ int numCa(); // number of ca certs;
//bool fromData(unsigned char *p, int size);
//unsigned char *toData(int *size);
//bool compare(pki_base *ref);
diff --git a/lib/pki_x509.cpp b/lib/pki_x509.cpp
index 17eb5dc7..1d4da0e3 100644
--- a/lib/pki_x509.cpp
+++ b/lib/pki_x509.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/pki_x509.h b/lib/pki_x509.h
index ab4da91c..e9fe713c 100644
--- a/lib/pki_x509.h
+++ b/lib/pki_x509.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/pki_x509req.cpp b/lib/pki_x509req.cpp
index d85ee537..f1b12720 100644
--- a/lib/pki_x509req.cpp
+++ b/lib/pki_x509req.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/lib/pki_x509req.h b/lib/pki_x509req.h
index cf0422bb..e8236189 100644
--- a/lib/pki_x509req.h
+++ b/lib/pki_x509req.h
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/
diff --git a/main.cpp b/main.cpp
index a72c5872..4e7c82d1 100644
--- a/main.cpp
+++ b/main.cpp
@@ -44,6 +44,7 @@
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
+ * $id$
*
*/