*** empty log message ***

This commit is contained in:
chris2511 2003-06-25 15:42:51 +00:00
parent 5ac8e13d36
commit 6a88c53778
20 changed files with 360 additions and 717 deletions

View File

@ -8,7 +8,7 @@
#define MARK CERR("--Mark--")
#define DBEX(x) CERR("DB-error: "<<x.what()<<", Errno: "<<x.get_errno())
#ifdef PRINTF_DEBUG
#ifdef PRINTF_DEBUG__
#define CERR(x) cerr <<__FILE__<<" ("<<__LINE__<<") :"<< x << endl;
#else
#define CERR(x)

View File

@ -11,7 +11,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>557</width>
<width>553</width>
<height>446</height>
</rect>
</property>
@ -1249,11 +1249,11 @@
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Widget9</cstring>
<cstring>unnamed</cstring>
</property>
<attribute>
<name>title</name>
<string>Subject &amp; &amp;Issuer</string>
<string>&amp;Subject</string>
</attribute>
<vbox>
<property stdset="1">
@ -1286,437 +1286,11 @@
</property>
</spacer>
<widget>
<class>QLayoutWidget</class>
<class>DistName</class>
<property stdset="1">
<name>name</name>
<cstring>Layout11</cstring>
<cstring>subject</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>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>GroupBox3</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Subject</string>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="2" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel6_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>name / DNS:</string>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Locality:</string>
</property>
</widget>
<widget row="5" 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:</string>
</property>
</widget>
<widget row="4" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnOU</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="3" 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="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Country:</string>
</property>
</widget>
<widget row="3" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnO</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="4" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel5</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Org. unit:</string>
</property>
</widget>
<widget row="5" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnEmail</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>1</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnC</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="1" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnL</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="2" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnCN</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
</grid>
</widget>
<widget>
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>GroupBox3_2</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Issuer</string>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="2" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnCN_2</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4_2_3</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Locality:</string>
</property>
</widget>
<widget row="4" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel5_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Org. unit:</string>
</property>
</widget>
<widget row="5" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnEmail_2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>1</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnC_2</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="3" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnO_2</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="5" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel7_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>E-Mail:</string>
</property>
</widget>
<widget row="1" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnL_2</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="3" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4_2_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Organisation:</string>
</property>
</widget>
<widget row="2" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel6_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>name / DNS:</string>
</property>
</widget>
<widget row="4" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>dnOU_2</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Panel</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
<widget row="0" 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>
</grid>
</widget>
</hbox>
</widget>
<spacer>
<property>
@ -1749,7 +1323,77 @@
</property>
<attribute>
<name>title</name>
<string>&amp;Extensions</string>
<string>&amp;Issuer</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<spacer>
<property>
<name>name</name>
<cstring>Spacer7</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</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>DistName</class>
<property stdset="1">
<name>name</name>
<cstring>issuer</cstring>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer8</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</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>
</vbox>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>&amp;Extension</string>
</attribute>
<vbox>
<property stdset="1">
@ -2053,6 +1697,28 @@
</widget>
</vbox>
</widget>
<customwidgets>
<customwidget>
<class>DistName</class>
<header location="local">distname.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
</sizehint>
<container>1</container>
<sizepolicy>
<hordata>7</hordata>
<verdata>7</verdata>
</sizepolicy>
<pixmap>image0</pixmap>
</customwidget>
</customwidgets>
<images>
<image>
<name>image0</name>
<data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
</image>
</images>
<connections>
<connection>
<sender>but_ok</sender>

View File

@ -62,7 +62,7 @@
#include <qinputdialog.h>
#include "ui/CertExtend.h"
#include "widgets/ExportCert.h"
#include "ui/CertDetail.h"
#include "widgets/CertDetail.h"
#include "ui/TrustState.h"
#include "widgets/ExportTinyCA.h"
#include "widgets/validity.h"
@ -354,127 +354,34 @@ void CertView::extendCert()
}
}
void CertView::showItem(pki_base *basecert, bool import)
void CertView::showItem(pki_base *item, bool import)
{
pki_x509 *cert = (pki_x509 *)basecert;
if (!cert) return;
if (Error(cert)) return ;
if (!item) return;
try {
CertDetail_UI *dlg = new CertDetail_UI(this,0,true);
CertDetail *dlg = new CertDetail(this,0,true);
bool ret;
dlg->image->setPixmap(*MainWindow::certImg);
dlg->descr->setText(cert->getIntName());
dlg->setCaption(tr(XCA_TITLE));
// examine the key
pki_key *key= cert->getRefKey();
if (key)
if (key->isPrivKey()) {
dlg->privKey->setText(key->getIntName());
dlg->privKey->setDisabled(false);
}
// examine the signature
if ( cert->getSigner() == NULL) {
dlg->verify->setText(tr("SIGNER UNKNOWN"));
}
else if ( cert->compare(cert->getSigner()) ) {
dlg->verify->setText(tr("SELF SIGNED"));
}
else {
dlg->verify->setText(cert->getSigner()->getIntName());
}
// check trust state
if (cert->getEffTrust() == 0) {
dlg->verify->setDisabled(true);
}
CERR( cert->getEffTrust() );
// the serial
dlg->serialNr->setText(cert->getSerial().toHex());
// details of subject
x509name subj = cert->getSubject();
QString land = subj.getEntryByNid(NID_countryName);
QString land1 = subj.getEntryByNid(NID_stateOrProvinceName);
if (land != "" && land1 != "")
land += " / " +land1;
else
land+=land1;
dlg->dnCN->setText(subj.getEntryByNid(NID_commonName));
dlg->dnC->setText(land);
dlg->dnL->setText(subj.getEntryByNid(NID_localityName));
dlg->dnO->setText(subj.getEntryByNid(NID_organizationName));
dlg->dnOU->setText(subj.getEntryByNid(NID_organizationalUnitName));
dlg->dnEmail->setText(subj.getEntryByNid(NID_pkcs9_emailAddress));
// same for issuer....
x509name iss = cert->getIssuer();
land = iss.getEntryByNid(NID_countryName);
land1 = iss.getEntryByNid(NID_stateOrProvinceName);
if (land != "" && land1 != "")
land += " / " +land1;
else
land+=land1;
dlg->dnCN_2->setText(iss.getEntryByNid(NID_commonName) );
dlg->dnC_2->setText(land);
dlg->dnL_2->setText(iss.getEntryByNid(NID_localityName));
dlg->dnO_2->setText(iss.getEntryByNid(NID_organizationName));
dlg->dnOU_2->setText(iss.getEntryByNid(NID_organizationalUnitName));
dlg->dnEmail_2->setText(iss.getEntryByNid(NID_pkcs9_emailAddress));
dlg->notBefore->setText(cert->getNotBefore().toPretty());
dlg->notAfter->setText(cert->getNotAfter().toPretty());
MARK
// validation of the Date
if (cert->checkDate() == -1) {
dlg->dateValid->setText(tr("Not valid"));
dlg->dateValid->setDisabled(true);
}
if (cert->checkDate() == +1) {
dlg->dateValid->setText(tr("Not valid"));
dlg->dateValid->setDisabled(true);
}
if (cert->isRevoked()) {
dlg->dateValid->setText(tr("Revoked: ") +
cert->getRevoked().toPretty());
dlg->dateValid->setDisabled(true);
}
// the fingerprints
dlg->fpMD5->setText(cert->fingerprint(EVP_md5()));
dlg->fpSHA1->setText(cert->fingerprint(EVP_sha1()));
// V3 extensions
dlg->v3Extensions->setText(cert->printV3ext());
// rename the buttons in case of import
dlg->setCert((pki_x509 *)item);
if (import) {
dlg->but_ok->setText(tr("Import"));
dlg->but_cancel->setText(tr("Discard"));
dlg->setImport();
}
// show it to the user...
QString odesc = cert->getIntName();
QString odesc = item->getIntName();
ret = dlg->exec();
QString ndesc = dlg->descr->text();
delete dlg;
if (!ret && import) {
delete cert;
delete item;
}
if (!ret) return;
emit init_database();
if (import) {
cert = (pki_x509 *)insert(cert);
item = insert(item);
}
if (ndesc != odesc) {
db->renamePKI(cert, ndesc);
db->renamePKI(item, ndesc);
return;
}
}

View File

@ -50,7 +50,7 @@
#include "ReqView.h"
#include "ui/ReqDetail.h"
#include "widgets/ReqDetail.h"
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <qfiledialog.h>
@ -109,56 +109,27 @@ void ReqView::showItem(pki_base *item, bool import)
if (!item) return;
emit init_database();
try {
pki_x509req *req = (pki_x509req *)item;
ReqDetail_UI *dlg = new ReqDetail_UI(this,0,true);
dlg->descr->setText(req->getIntName());
dlg->setCaption(tr(XCA_TITLE));
if (!req->verify() ) {
dlg->verify->setDisabled(true);
dlg->verify->setText("ERROR");
}
pki_key *key =req->getRefKey();
if (key) {
dlg->privKey->setText(key->getIntName());
dlg->privKey->setDisabled(false);
}
/*
x509name rn = req->getSubject();
dlg->dnCN->setText(rn.getEntryByNid(NID_commonName));
dlg->dnC->setText(rn.getEntryByNid(NID_countryName) + " / "
+ rn.getEntryByNid(NID_stateOrProvinceName));
dlg->dnL->setText(rn.getEntryByNid(NID_localityName));
dlg->dnO->setText(rn.getEntryByNid(NID_organizationName));
dlg->dnOU->setText(rn.getEntryByNid(NID_organizationalUnitName));
dlg->dnEmail->setText(rn.getEntryByNid(NID_pkcs9_emailAddress));
dlg->image->setPixmap(*MainWindow::csrImg);
*/
ReqDetail *dlg = new ReqDetail(this,0,true);
dlg->setReq((pki_x509req *)item);
dlg->subject->setX509name(req->getSubject());
// rename the buttons in case of import
if (import) {
dlg->but_ok->setText(tr("Import"));
dlg->but_cancel->setText(tr("Discard"));
}
QString odesc = req->getIntName();
QString odesc = item->getIntName();
bool ret = dlg->exec();
QString ndesc = dlg->descr->text();
delete dlg;
if (!ret && import) {
delete req;
delete (pki_x509req *)item;
}
if (!ret) return;
emit init_database();
if (import) {
req = (pki_x509req *)insert((pki_x509req *)req);
item = insert(item);
}
if (ndesc != odesc) {
db->renamePKI(req, ndesc);
db->renamePKI(item, ndesc);
}
}
catch (errorEx &err) {

View File

@ -51,18 +51,19 @@
#include "CertDetail.h"
#include "MainWindow.h"
#include "distname.h"
#include <qlabel.h>
#include <qtextview.h>
#include <qlistview.h>
#include <qpushbutton.h>
CertDetail::CertDetail(QWidget *parent, const char *name)
CertDetail::CertDetail(QWidget *parent, const char *name, bool modal, WFlags f)
:CertDetail_UI(parent,name,true,0)
{
setCaption(tr(XCA_TITLE));
image->setPixmap(*MainWindow::revImg);
image->setPixmap(*MainWindow::certImg);
}
CertDetail::setCrt(pki_x509 *cert)
void CertDetail::setCert(pki_x509 *cert)
{
descr->setText(cert->getIntName());
@ -89,46 +90,17 @@ CertDetail::setCrt(pki_x509 *cert)
if (cert->getEffTrust() == 0) {
verify->setDisabled(true);
}
CERR( cert->getEffTrust() );
// the serial
serialNr->setText(cert->getSerial().toHex());
// details of subject
x509name subj = cert->getSubject();
QString land = subj.getEntryByNid(NID_countryName);
QString land1 = subj.getEntryByNid(NID_stateOrProvinceName);
if (land != "" && land1 != "")
land += " / " +land1;
else
land+=land1;
dlg->dnCN->setText(subj.getEntryByNid(NID_commonName));
dlg->dnC->setText(land);
dlg->dnL->setText(subj.getEntryByNid(NID_localityName));
dlg->dnO->setText(subj.getEntryByNid(NID_organizationName));
dlg->dnOU->setText(subj.getEntryByNid(NID_organizationalUnitName));
dlg->dnEmail->setText(subj.getEntryByNid(NID_pkcs9_emailAddress));
// same for issuer....
x509name iss = cert->getIssuer();
land = iss.getEntryByNid(NID_countryName);
land1 = iss.getEntryByNid(NID_stateOrProvinceName);
if (land != "" && land1 != "")
land += " / " +land1;
else
land+=land1;
dlg->dnCN_2->setText(iss.getEntryByNid(NID_commonName) );
dlg->dnC_2->setText(land);
dlg->dnL_2->setText(iss.getEntryByNid(NID_localityName));
dlg->dnO_2->setText(iss.getEntryByNid(NID_organizationName));
dlg->dnOU_2->setText(iss.getEntryByNid(NID_organizationalUnitName));
dlg->dnEmail_2->setText(iss.getEntryByNid(NID_pkcs9_emailAddress));
dlg->notBefore->setText(cert->getNotBefore().toPretty());
dlg->notAfter->setText(cert->getNotAfter().toPretty());
MARK
// details of subject and issuer
subject->setX509name(cert->getSubject());
issuer->setX509name(cert->getIssuer());
// 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"));
@ -138,14 +110,15 @@ CertDetail::setCrt(pki_x509 *cert)
dateValid->setText(tr("Revoked: ") +
cert->getRevoked().toPretty());
dateValid->setDisabled(true);
}
// the fingerprints
fpMD5->setText(cert->fingerprint(EVP_md5()));
fpSHA1->setText(cert->fingerprint(EVP_sha1()));
// V3 extensions
dlg->v3Extensions->setText(cert->printV3ext());
v3Extensions->setText(cert->printV3ext());
}
void CertDetail::setImport()
{

View File

@ -52,15 +52,17 @@
#define CERTDETAIL_H
#include "ui/CertDetail.h"
#include "lib/pki_x509.h"
class pki_x509;
class CertDetail: public CertDetail_UI
{
Q_OBJECT
public:
CertDetail( QWidget *parent = 0, const char *name = 0);
void setCert(pki_crl *crl);
CertDetail( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0);
void setCert(pki_x509 *cert);
void setImport();
};
#endif

View File

@ -51,12 +51,13 @@
#include "CrlDetail.h"
#include "MainWindow.h"
#include "lib/pki_crl.h"
#include <qlabel.h>
#include <qtextview.h>
#include <qlistview.h>
CrlDetail::CrlDetail(QWidget *parent, const char *name)
:CrlDetail_UI(parent,name,true,0)
CrlDetail::CrlDetail(QWidget *parent, const char *name, bool modal, WFlags f)
:CrlDetail_UI(parent, name, modal, f)
{
setCaption(tr(XCA_TITLE));
certList->clear();

View File

@ -52,14 +52,15 @@
#define CRLDETAIL_H
#include "ui/CrlDetail.h"
#include "lib/pki_crl.h"
class pki_crl;
class CrlDetail: public CrlDetail_UI
{
Q_OBJECT
public:
CrlDetail( QWidget *parent = 0, const char *name = 0);
CrlDetail( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0);
void setCrl(pki_crl *crl);
};
#endif

View File

@ -50,7 +50,11 @@
#include "ExportCert.h"
#include "lib/base.h"
#include <qcombobox.h>
#include <qlineedit.h>
#include <qfiledialog.h>
ExportCert::ExportCert(QString fname, bool hasKey, QString dpath,
const QString tcafn, QWidget *parent, const char *name )
@ -99,12 +103,10 @@ void ExportCert::chooseFile()
void ExportCert::formatChanged()
{
CERR("Export format changed");
char *suffix[] = {"crt", "crt", "crt", "crt", "cer", "p7b", "p7b", "p7b", "p12", "p12"};
int selected = exportFormat->currentItem();
QString fn = filename->text();
QString nfn = fn.left(fn.findRev('.')+1) + suffix[selected];
CERR(nfn);
filename->setText(nfn);
}

View File

@ -48,17 +48,11 @@
*
*/
#include "ui/ExportCert.h"
#include <qfiledialog.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include "lib/base.h"
#ifndef EXPORTCERT_H
#define EXPORTCERT_H
#include "ui/ExportCert.h"
class ExportCert: public ExportCert_UI
{
Q_OBJECT

View File

@ -50,7 +50,12 @@
#include "ExportKey.h"
#include "lib/base.h"
#include <qfiledialog.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
ExportKey::ExportKey(QString fname, bool onlypub, QString dpath,
QWidget *parent, const char *name )

View File

@ -48,18 +48,10 @@
*
*/
#include "ui/ExportKey.h"
#include <qfiledialog.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include "lib/pki_base.h"
#include <iostream>
#ifndef EXPORTKEY_H
#define EXPORTKEY_H
#include "ui/ExportKey.h"
class ExportKey: public ExportKey_UI
{

View File

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

View File

@ -65,26 +65,14 @@
#include "MainWindow.h"
#include "lib/x509name.h"
NewX509::NewX509(QWidget *parent , const char *name, db_key *key, db_x509req *req, db_x509 *cert, db_temp *temp, QPixmap *image, QPixmap *ns)
:NewX509_UI(parent, name, true, 0)
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)) );
setCaption(tr(XCA_TITLE));
keys = key;
reqs = req;
temps = temp;
certs = cert;
fixtemp = NULL;
if (image) {
bigImg1->setPixmap(*image);
bigImg2->setPixmap(*image);
bigImg3->setPixmap(*image);
bigImg4->setPixmap(*image);
bigImg5->setPixmap(*image);
bigImg6->setPixmap(*image);
nsImg->setPixmap(*ns);
}
nsImg->setPixmap(*MainWindow::nsImg);
#ifdef qt3
// pretty fat Title :-)
QFont tFont;// = getFont();
@ -98,63 +86,43 @@ NewX509::NewX509(QWidget *parent , const char *name, db_key *key, db_x509req *re
serialNr->setValidator( new QIntValidator(0, 32767, this));
QStringList strings;
// are there any useable private keys ?
if (keys) {
strings = keys->get0PrivateDesc();
keyList->insertStringList(strings);
}
else {
keyList->setEnabled(false);
genKeyBUT->setEnabled(false);
}
strings = MainWindow::keys->get0PrivateDesc();
keyList->insertStringList(strings);
// any PKCS#10 requests to be used ?
if (reqs) {
strings = reqs->getDesc();
if (strings.isEmpty()) {
fromReqCB->setDisabled(true);
}
else {
reqList->insertStringList(strings);
}
strings = MainWindow::reqs->getDesc();
if (strings.isEmpty()) {
fromReqCB->setDisabled(true);
reqList->setDisabled(true);
}
else {
reqList->setEnabled(false);
fromReqCB->setEnabled(false);
reqList->insertStringList(strings);
}
// How about signing certificates ?
if (certs) {
strings = certs->getSignerDesc();
if (strings.isEmpty()) {
foreignSignRB->setDisabled(true);
certList->setDisabled(true);
}
else {
certList->insertStringList(strings);
}
}
else {
strings = certs->getSignerDesc();
if (strings.isEmpty()) {
foreignSignRB->setDisabled(true);
certList->setDisabled(true);
}
else {
certList->insertStringList(strings);
}
// settings for the templates ....
if (temps) {
strings = temps->getDesc();
strings.prepend(tr("Server Template"));
strings.prepend(tr("Client Template"));
strings.prepend(tr("CA Template"));
strings.prepend(tr("Empty Template"));
tempList->insertStringList(strings);
}
else {
templateBox->setEnabled(false);
}
strings = MainWindow::temps->getDesc();
strings.prepend(tr("Server Template"));
strings.prepend(tr("Client Template"));
strings.prepend(tr("CA Template"));
strings.prepend(tr("Empty Template"));
tempList->insertStringList(strings);
setFinishEnabled(page7,true);
setNextEnabled(page2,false);
signerChanged();
}
void NewX509::setRequest()
{
setAppropriate(page4, false);
@ -177,6 +145,7 @@ request. The resulting request should be exported and send to an appropriate CA
for signing it.");
tText=tr("Certificate request");
setup();
setImage(MainWindow::csrImg);
}
NewX509::~NewX509()
@ -204,6 +173,9 @@ applied when signing with this CA.");
tText += tr(" change");
}
setup();
keyList->setEnabled(false);
genKeyBUT->setEnabled(false);
setImage(MainWindow::tempImg);
}
@ -214,6 +186,17 @@ void NewX509::setCert()
endText=tr("You are done with entering all parameters for creating a Certificate.");
tText=tr("Certificate");
setup();
setImage(MainWindow::certImg);
}
void NewX509::setImage(QPixmap *image)
{
bigImg1->setPixmap(*image);
bigImg2->setPixmap(*image);
bigImg3->setPixmap(*image);
bigImg4->setPixmap(*image);
bigImg5->setPixmap(*image);
bigImg6->setPixmap(*image);
}
void NewX509::setup()
@ -385,7 +368,6 @@ void NewX509::toggleFromRequest()
void NewX509::dataChangeP2()
{
CERR( "Data changed" );
if (description->text() != "" && countryName->text().length() !=1 &&
(keyList->count() > 0 || !keyList->isEnabled())){
setNextEnabled(page2,true);
@ -423,19 +405,15 @@ void NewX509::showPage(QWidget *page)
void NewX509::signerChanged()
{
CERR("signer Changed");
if (!certs) return;
QString name = certList->currentText();
CERR( "Certificate: " << name);
if (name.isEmpty()) return;
pki_x509 *cert = (pki_x509 *)certs->getByName(name);
pki_x509 *cert = (pki_x509 *)MainWindow::certs->getByName(name);
if (!cert) return;
QString templ = cert->getTemplate();
if (templ.isEmpty()) return;
CERR( "set Template: " << templ );
templateChanged(templ);
@ -475,7 +453,6 @@ void NewX509::templateChanged()
temp = new pki_temp("temp",item);
if (temp) {
fromTemplate(temp);
CERR("using default template: "<< item);
delete (temp);
}
return;
@ -484,14 +461,12 @@ void NewX509::templateChanged()
if (name == "" || !temps) return;
temp = (pki_temp *)temps->getByName(name);
if (!temp) return;
CERR("CHANGING TEMPLATE");
fromTemplate(temp);
}
void NewX509::switchExtended()
{
if ( !appropriate(page1) ) return;
CERR( "SWITCH Extended");
if (changeDefault->isChecked() || !templateBox->isEnabled()) {
setAppropriate(page4, true);
setAppropriate(page5, true);

View File

@ -64,15 +64,11 @@ class NewX509: public NewX509_UI
{
Q_OBJECT
private:
db_x509req *reqs;
db_x509 *certs;
db_key *keys;
db_temp *temps;
pki_temp *fixtemp;
QString startText, endText, tText;
public:
NewX509(QWidget *parent, const char *name, db_key *key, db_x509req *req, db_x509 *cert, db_temp *temp, QPixmap *image, QPixmap *ns);
NewX509(QWidget *parent, const char *name, bool modal = false, WFlags f = 0);
~NewX509();
void setRequest(); // reduce to request form
void setTemp(pki_temp *temp); // reduce to template form
@ -90,6 +86,7 @@ class NewX509: public NewX509_UI
void templateChanged(QString templatename);
pki_key *getSelectedKey();
x509name getX509name();
void setImage(QPixmap *image);
public slots:
void toggleFromRequest();
void newKey();

91
widgets/ReqDetail.cpp Normal file
View File

@ -0,0 +1,91 @@
/*
* Copyright (C) 2001 Christian Hohnstaedt.
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the author nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* This program links to software with different licenses from:
*
* http://www.openssl.org which includes cryptographic software
* written by Eric Young (eay@cryptsoft.com)"
*
* http://www.sleepycat.com
*
* http://www.trolltech.com
*
*
*
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
* $Id$
*
*/
#include "ReqDetail.h"
#include "MainWindow.h"
#include "distname.h"
#include "lib/pki_x509req.h"
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
ReqDetail::ReqDetail(QWidget *parent, const char *name, bool modal, WFlags f )
:ReqDetail_UI(parent, name, modal, f)
{
setCaption(tr(XCA_TITLE));
image->setPixmap(*MainWindow::csrImg);
}
void ReqDetail::setReq(pki_x509req *req)
{
// internal name and verification
descr->setText(req->getIntName());
if (!req->verify() ) {
verify->setDisabled(true);
verify->setText("ERROR");
}
// look for the private key
pki_key *key =req->getRefKey();
if (key) {
privKey->setText(key->getIntName());
privKey->setDisabled(false);
}
// the subject
subject->setX509name(req->getSubject());
}
void ReqDetail::setImport()
{
// rename the buttons in case of import
but_ok->setText(tr("Import"));
but_cancel->setText(tr("Discard"));
}

68
widgets/ReqDetail.h Normal file
View File

@ -0,0 +1,68 @@
/*
* Copyright (C) 2001 Christian Hohnstaedt.
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the author nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* This program links to software with different licenses from:
*
* http://www.openssl.org which includes cryptographic software
* written by Eric Young (eay@cryptsoft.com)"
*
* http://www.sleepycat.com
*
* http://www.trolltech.com
*
*
*
* http://www.hohnstaedt.de/xca
* email: christian@hohnstaedt.de
*
* $Id$
*
*/
#ifndef REQDETAIL_H
#define REQDETAIL_H
#include "ui/ReqDetail.h"
class pki_x509req;
class ReqDetail: public ReqDetail_UI
{
Q_OBJECT
public:
ReqDetail( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0);
void setReq(pki_x509req *req);
void setImport();
};
#endif

View File

@ -86,7 +86,7 @@ void DistName::setX509name(const x509name &n)
if (lb->text().isEmpty())
lb->setText(sl[0]);
le->setText(sl[2]);
le->setDisabled(true);
le->setReadOnly(true);
DistNameLayout->addWidget( lb, i, 0 );
DistNameLayout->addWidget( le, i, 1 );
}
@ -100,9 +100,9 @@ DistName::~DistName()
void DistName::resizeEvent( QResizeEvent *e)
{
QWidget::resizeEvent(e);
cerr << "W size:" << size().height() << " -- " << size().width() <<endl;
cerr << "max:" << maximumSize().height() << " -- " << maximumSize().width() <<endl;
cerr << "L.max:" << DistNameLayout->maximumSize().height() << " -- " << DistNameLayout->maximumSize().width() <<endl;
//cerr << "W size:" << size().height() << " -- " << size().width() <<endl;
//cerr << "max:" << maximumSize().height() << " -- " << maximumSize().width() <<endl;
//cerr << "L.max:" << DistNameLayout->maximumSize().height() << " -- " << DistNameLayout->maximumSize().width() <<endl;
}
/*******************************************************************/

View File

@ -51,8 +51,7 @@
#ifndef DISTNAME_H
#define DISTNAME_H
#include <qvariant.h>
#include <qgroupbox.h>
#include <qwidget.h>
#include <qlayout.h>
class x509name;

View File

@ -51,7 +51,6 @@
#ifndef VALIDITY_H
#define VALIDITY_H
#include <qvariant.h>
#include <qgroupbox.h>
class QGridLayout;