mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
validity widget added for time input
more work on CertView
This commit is contained in:
parent
fe46ff670f
commit
431fd7aed3
@ -11,8 +11,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>388</width>
|
||||
<height>284</height>
|
||||
<width>335</width>
|
||||
<height>336</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
@ -145,68 +145,11 @@
|
||||
</property>
|
||||
</spacer>
|
||||
<widget>
|
||||
<class>QGroupBox</class>
|
||||
<class>Validity</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>GroupBox3</cstring>
|
||||
<cstring>validity</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>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>validNumber</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizePolicy</name>
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>365</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QComboBox</class>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Days</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Months</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Years</string>
|
||||
</property>
|
||||
</item>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>validRange</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property>
|
||||
@ -286,6 +229,11 @@
|
||||
<name>name</name>
|
||||
<cstring>PushButton2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>font</name>
|
||||
<font>
|
||||
</font>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&OK</string>
|
||||
@ -295,6 +243,28 @@
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Validity</class>
|
||||
<header location="local">validity.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">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
|
||||
</image>
|
||||
</images>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>PushButton3</sender>
|
||||
|
||||
55
CertView.cpp
55
CertView.cpp
@ -57,8 +57,12 @@
|
||||
#include <qradiobutton.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qpopupmenu.h>
|
||||
#include <qtextview.h>
|
||||
#include <qpushbutton.h>
|
||||
#include "CertExtend.h"
|
||||
#include "CertDetail.h"
|
||||
#include "validity.h"
|
||||
#include "lib/pki_pkcs12.h"
|
||||
|
||||
CertView::CertView(QWidget * parent = 0, const char * name = 0, WFlags f = 0)
|
||||
:XcaListView(parent, name, f)
|
||||
@ -149,8 +153,8 @@ void CertView::newCert(NewX509 *dlg)
|
||||
// Step 3 - Choose the Date and all the V3 extensions
|
||||
|
||||
// Date handling
|
||||
notBefore = dlg->getNotBefore();
|
||||
notAfter = dlg->getNotAfter();
|
||||
notBefore = dlg->validity->getNotBefore();
|
||||
notAfter = dlg->validity->getNotAfter();
|
||||
|
||||
// initially create cert
|
||||
cert = new pki_x509();
|
||||
@ -318,11 +322,14 @@ void CertView::extendCert()
|
||||
{
|
||||
pki_x509 *oldcert = NULL, *signer = NULL, *newcert =NULL;
|
||||
pki_key *signkey = NULL;
|
||||
int days, x;
|
||||
a1time time;
|
||||
a1int serial;
|
||||
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));
|
||||
|
||||
if (!dlg->exec()) {
|
||||
delete dlg;
|
||||
return;
|
||||
@ -338,16 +345,10 @@ void CertView::extendCert()
|
||||
}
|
||||
db->updatePKI(signer); // FIXME::not so pretty ....
|
||||
|
||||
// Date handling
|
||||
x = dlg->validNumber->text().toInt();
|
||||
days = dlg->validRange->currentItem();
|
||||
if (days == 1) x *= 30;
|
||||
if (days == 2) x *= 365;
|
||||
|
||||
// change date and serial
|
||||
newcert->setSerial(serial);
|
||||
newcert->setNotBefore(dlg->getNotBefore());
|
||||
newcert->setNotAfter(dlg->getNotAfter());
|
||||
newcert->setNotBefore(dlg->validity->getNotBefore());
|
||||
newcert->setNotAfter(dlg->validity->getNotAfter());
|
||||
|
||||
if (newcert->resetTimes(signer) > 0) {
|
||||
if (QMessageBox::information(this,tr(XCA_TITLE),
|
||||
@ -376,16 +377,16 @@ void CertView::show(pki_base *basecert, bool import)
|
||||
{
|
||||
pki_x509 *cert = (pki_x509 *)basecert;
|
||||
if (!cert) return;
|
||||
if (opensslError(cert)) return ;
|
||||
if (Error(cert)) return ;
|
||||
try {
|
||||
CertDetail_UI *dlg = new CertDetail_UI(this,0,true);
|
||||
bool ret;
|
||||
dlg->image->setPixmap(*certImg);
|
||||
dlg->image->setPixmap(*MainWindow::certImg);
|
||||
dlg->descr->setText(cert->getIntName());
|
||||
dlg->setCaption(tr(XCA_TITLE));
|
||||
|
||||
// examine the key
|
||||
pki_key *key= cert->getKey();
|
||||
pki_key *key= cert->getRefKey();
|
||||
if (key)
|
||||
if (key->isPrivKey()) {
|
||||
dlg->privKey->setText(key->getIntName());
|
||||
@ -422,7 +423,7 @@ void CertView::show(pki_base *basecert, bool import)
|
||||
else
|
||||
land+=land1;
|
||||
|
||||
dlg->dnCN->setText(subj.geEntryByNid(NID_commonName));
|
||||
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));
|
||||
@ -444,8 +445,8 @@ void CertView::show(pki_base *basecert, bool import)
|
||||
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());
|
||||
dlg->notBefore->setText(cert->getNotBefore().toPretty());
|
||||
dlg->notAfter->setText(cert->getNotAfter().toPretty());
|
||||
MARK
|
||||
|
||||
// validation of the Date
|
||||
@ -490,7 +491,7 @@ void CertView::show(pki_base *basecert, bool import)
|
||||
init_database();
|
||||
}
|
||||
if (import) {
|
||||
cert = insert(cert);
|
||||
cert = (pki_x509 *)insert(cert);
|
||||
}
|
||||
if (ndesc != odesc) {
|
||||
db->renamePKI(cert, ndesc);
|
||||
@ -521,7 +522,7 @@ void CertView::deleteItem()
|
||||
}
|
||||
}
|
||||
|
||||
void CertView::loadItem()
|
||||
void CertView::load()
|
||||
{
|
||||
QStringList filter;
|
||||
filter.append(tr("Certificates ( *.pem *.der *.crt *.cer )"));
|
||||
@ -529,9 +530,9 @@ void CertView::loadItem()
|
||||
load_default(filter,tr("Certificate import"));
|
||||
}
|
||||
|
||||
void CertView::loadItem(QString fname)
|
||||
pki_base *CertView::loadItem(QString fname)
|
||||
{
|
||||
pki_x509 *cert = new pki_x509(s);
|
||||
pki_x509 *cert = new pki_x509(fname);
|
||||
return cert;
|
||||
}
|
||||
|
||||
@ -547,17 +548,17 @@ void CertView::loadPKCS12()
|
||||
dlg->setCaption(tr("Certificate import"));
|
||||
dlg->setFilters(filt);
|
||||
dlg->setMode( QFileDialog::ExistingFiles );
|
||||
setPath(dlg);
|
||||
dlg->setDir(MainWindow::getPath());
|
||||
if (dlg->exec()) {
|
||||
slist = dlg->selectedFiles();
|
||||
newPath(dlg);
|
||||
MainWindow::setPath(dlg->dirPath());
|
||||
}
|
||||
delete dlg;
|
||||
for ( QStringList::Iterator it = slist.begin(); it != slist.end(); ++it ) {
|
||||
s = *it;
|
||||
s = QDir::convertSeparators(s);
|
||||
try {
|
||||
pk12 = new pki_pkcs12(s, &CertView::passRead);
|
||||
pk12 = new pki_pkcs12(s, &MainWindow::passRead);
|
||||
insertP12(pk12);
|
||||
MARK
|
||||
}
|
||||
@ -624,10 +625,10 @@ void CertView::loadPKCS7()
|
||||
dlg->setCaption(tr("Certificate import"));
|
||||
dlg->setFilters(filt);
|
||||
dlg->setMode( QFileDialog::ExistingFiles );
|
||||
setPath(dlg);
|
||||
dlg->setDir(MainWindow::getPath());
|
||||
if (dlg->exec()) {
|
||||
slist = dlg->selectedFiles();
|
||||
newPath(dlg);
|
||||
MainWindow::setPath(dlg->dirPath());
|
||||
}
|
||||
delete dlg;
|
||||
for ( QStringList::Iterator it = slist.begin(); it != slist.end(); ++it ) {
|
||||
@ -700,7 +701,7 @@ pki_x509 *CertView::insert(pki_base *item)
|
||||
#define P7_CHAIN 1
|
||||
#define P7_TRUSTED 2
|
||||
|
||||
void CertView::writeCert()
|
||||
void CertView::store()
|
||||
{
|
||||
QStringList filt;
|
||||
pki_x509 *crt = (pki_x509 *)certs->getSelectedPKI();
|
||||
|
||||
10
CertView.h
10
CertView.h
@ -44,7 +44,7 @@
|
||||
* http://www.hohnstaedt.de/xca
|
||||
* email: christian@hohnstaedt.de
|
||||
*
|
||||
* $Id$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
@ -54,6 +54,7 @@
|
||||
|
||||
#include "XcaListView.h"
|
||||
#include "lib/pki_x509.h"
|
||||
#include "lib/pki_pkcs12.h"
|
||||
#include <qlistview.h>
|
||||
#include "NewX509.h"
|
||||
|
||||
@ -69,9 +70,9 @@ class CertView : public XcaListView
|
||||
void show(pki_base *item, bool import);
|
||||
void newItem();
|
||||
void deleteItem();
|
||||
void load();
|
||||
void updateViewItem(pki_base *);
|
||||
pki_base *loadItem(QString fname);
|
||||
void load();
|
||||
pki_base* loadItem(QString fname);
|
||||
pki_base* insert(pki_base *item);
|
||||
void store();
|
||||
void popupMenu(QListViewItem *item, const QPoint &pt, int x);
|
||||
@ -79,6 +80,9 @@ class CertView : public XcaListView
|
||||
void newCert(NewX509 *dlg);
|
||||
void addStr(QString &str, const char *add);
|
||||
void extendCert();
|
||||
void loadPKCS12();
|
||||
void insertP12(pki_pkcs12 *pk12);
|
||||
void loadPKCS7();
|
||||
signals:
|
||||
void init_database();
|
||||
|
||||
|
||||
13
NewX509.cpp
13
NewX509.cpp
@ -539,16 +539,3 @@ x509name NewX509::getX509name()
|
||||
return x;
|
||||
}
|
||||
|
||||
a1time NewX509::getNotBefore()
|
||||
{
|
||||
a1time nb;
|
||||
nb.set(nbYear->getText() + nbMon->getText() + nbDay->getText());
|
||||
return nb;
|
||||
}
|
||||
|
||||
a1time NewX509::getNotAfter()
|
||||
{
|
||||
a1time nb;
|
||||
nb.set(nbYear->getText() + nbMon->getText() + nbDay->getText());
|
||||
return nb;
|
||||
}
|
||||
|
||||
@ -90,8 +90,6 @@ class NewX509: public NewX509_UI
|
||||
void templateChanged(QString templatename);
|
||||
pki_key *getSelectedKey();
|
||||
x509name getX509name();
|
||||
a1time getNotBefore();
|
||||
a1time getNotAfter();
|
||||
public slots:
|
||||
void toggleFromRequest();
|
||||
void newKey();
|
||||
|
||||
283
NewX509_UI.ui
283
NewX509_UI.ui
@ -11,7 +11,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>648</width>
|
||||
<width>644</width>
|
||||
<height>542</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -1423,264 +1423,11 @@ It also copies the issuer and serial number from the issuer certificate. Normall
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QGroupBox</class>
|
||||
<class>Validity</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>GroupBox3</cstring>
|
||||
<cstring>validity</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>title</name>
|
||||
<string>Validity</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>toolTip</name>
|
||||
<string>Number of validity</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>whatsThis</name>
|
||||
<string>The validation time period is counted from "now" of your system clock the amount of time entered here.
|
||||
It is not possible to adjust the starting time of a certificate. This is a weakness of this program based on the laziness of the programmer and not a weakness of certificates or OpenSSL.</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="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="0" column="1" >
|
||||
<class>QComboBox</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>nbDay</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="0" column="2" >
|
||||
<class>QComboBox</class>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Jan</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Feb</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Mar</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Apr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Mai</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Jun</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Jul</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Aug</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Sep</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Okt</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Nov</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Dec</string>
|
||||
</property>
|
||||
</item>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>nbMon</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="0" column="3" >
|
||||
<class>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>nbYear</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizePolicy</name>
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>2003</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="1" column="2" >
|
||||
<class>QComboBox</class>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Jan</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Feb</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Mar</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Apr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Mai</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Jun</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Jul</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Aug</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Sep</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Okt</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Nov</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>Dec</string>
|
||||
</property>
|
||||
</item>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>naMon</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="1" column="3" >
|
||||
<class>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>naYear</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizePolicy</name>
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>2003</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="1" column="1" >
|
||||
<class>QComboBox</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>naDay</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property>
|
||||
@ -2751,6 +2498,28 @@ URI:http://www.my.com/my.crl, URI:http://www.oth.com/my.crl</string>
|
||||
</vbox>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Validity</class>
|
||||
<header location="local">validity.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">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
|
||||
</image>
|
||||
</images>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>genKeyBUT</sender>
|
||||
@ -2850,8 +2619,6 @@ URI:http://www.my.com/my.crl, URI:http://www.oth.com/my.crl</string>
|
||||
<tabstop>basicPath</tabstop>
|
||||
<tabstop>subKey</tabstop>
|
||||
<tabstop>authKey</tabstop>
|
||||
<tabstop>nbYear</tabstop>
|
||||
<tabstop>nbMon</tabstop>
|
||||
<tabstop>subAltName</tabstop>
|
||||
<tabstop>subAltCp</tabstop>
|
||||
<tabstop>issAltName</tabstop>
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
|
||||
#include "asn1time.h"
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
a1time::a1time()
|
||||
{
|
||||
@ -68,15 +69,31 @@ a1time::~a1time()
|
||||
ASN1_TIME_free(time);
|
||||
}
|
||||
|
||||
void a1time::set(const ASN1_TIME *a)
|
||||
a1time &a1time::set(const ASN1_TIME *a)
|
||||
{
|
||||
ASN1_TIME_free(time);
|
||||
time = ASN1_TIME_to_generalizedtime((ASN1_TIME *)a, NULL);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void a1time::set(time_t t)
|
||||
a1time &a1time::set(time_t t)
|
||||
{
|
||||
ASN1_GENERALIZEDTIME_set(time, t);
|
||||
return *this;
|
||||
}
|
||||
|
||||
a1time &a1time::set(int y, int mon, int d, int h, int m, int s)
|
||||
{
|
||||
if (time->length < 16 ||
|
||||
mon < 1 || mon > 12 ||
|
||||
d < 1 || d > 31 ||
|
||||
h < 0 || h >23 ||
|
||||
m < 0 || m > 59 ||
|
||||
s < 0 || s > 59 )
|
||||
ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT);
|
||||
|
||||
sprintf((char *)time->data, "%04d%02d%02d%02d%02d%02dZ", y, mon, d, h, m ,s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -118,9 +135,10 @@ QString a1time::toSortable() const
|
||||
return t;
|
||||
}
|
||||
|
||||
void a1time::set(const QString &s)
|
||||
a1time &a1time::set(const QString &s)
|
||||
{
|
||||
ASN1_GENERALIZEDTIME_set_string(time, (char *)s.latin1());
|
||||
return *this;
|
||||
}
|
||||
|
||||
int a1time::ymdg(int *y, int *m, int *d, int *g) const
|
||||
@ -144,14 +162,16 @@ int a1time::ymdg(int *y, int *m, int *d, int *g) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void a1time::now(int delta)
|
||||
a1time &a1time::now(int delta)
|
||||
{
|
||||
X509_gmtime_adj(time, delta);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void a1time::operator = (const a1time &a)
|
||||
a1time &a1time::operator = (const a1time &a)
|
||||
{
|
||||
set(a.time);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool const a1time::operator > (const a1time &a)
|
||||
|
||||
@ -65,18 +65,19 @@ class a1time
|
||||
a1time();
|
||||
a1time(const ASN1_TIME *a);
|
||||
~a1time();
|
||||
void set(const ASN1_TIME *a);
|
||||
void set(time_t t);
|
||||
void set(const QString &s);
|
||||
a1time &set(const ASN1_TIME *a);
|
||||
a1time &set(time_t t);
|
||||
a1time &set(const QString &s);
|
||||
a1time &set(int y, int mon, int d, int h, int m, int s);
|
||||
QString toPretty() const;
|
||||
QString toPlain() const;
|
||||
QString toSortable() const;
|
||||
int ymdg(int *y, int *m, int *d, int *g) const;
|
||||
ASN1_TIME *get() const;
|
||||
void now(int delta = 0);
|
||||
a1time &now(int delta = 0);
|
||||
unsigned char *i2d(unsigned char *p);
|
||||
int derSize() const;
|
||||
void operator = (const a1time &a);
|
||||
a1time &operator = (const a1time &a);
|
||||
bool const operator > (const a1time &a);
|
||||
bool const operator < (const a1time &a);
|
||||
bool const operator == (const a1time &a);
|
||||
|
||||
@ -57,6 +57,8 @@
|
||||
#include "base.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
class pki_base
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -579,7 +579,7 @@ a1time pki_x509::getRevoked()
|
||||
return x;
|
||||
}
|
||||
|
||||
void pki_x509::setRevoked(a1time &when)
|
||||
void pki_x509::setRevoked(const a1time &when)
|
||||
{
|
||||
isrevoked = true;
|
||||
revoked = when;
|
||||
|
||||
@ -116,7 +116,7 @@ class pki_x509 : public pki_x509super
|
||||
int getEffTrust();
|
||||
void setEffTrust(int t);
|
||||
void setRevoked(bool rev);
|
||||
void setRevoked(a1time &when);
|
||||
void setRevoked(const a1time &when);
|
||||
a1time getRevoked();
|
||||
bool isRevoked();
|
||||
int calcEffTrust();
|
||||
|
||||
149
validity.cpp
Normal file
149
validity.cpp
Normal file
@ -0,0 +1,149 @@
|
||||
/*
|
||||
* 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 "validity.h"
|
||||
|
||||
#include <qcombobox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.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 )
|
||||
{
|
||||
QStringList months, days;
|
||||
months << tr("Jan") << tr("Feb") << tr("Mar") << tr("Apr")
|
||||
<< tr("Mai") << tr("Jun") << tr("Jul") << tr("Aug")
|
||||
<< tr("Sep") << tr("Okt") << tr("Nov") << tr("Dez");
|
||||
for (int i=1; i<32; i++)
|
||||
days += QString::number(i);
|
||||
|
||||
if ( !name )
|
||||
setName( "Validity" );
|
||||
setTitle( tr( "Validity" ) );
|
||||
ValidityLayout = new QGridLayout( this );
|
||||
ValidityLayout->setSpacing( 6 );
|
||||
ValidityLayout->setMargin( 11 );
|
||||
|
||||
Label1 = new QLabel( this, "Label1" );
|
||||
Label1->setText( tr( "not Before" ) );
|
||||
|
||||
Label2 = new QLabel( this, "Label2" );
|
||||
Label2->setText( tr( "not After" ) );
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Validity::~Validity()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
a1time Validity::getNotBefore() const
|
||||
{
|
||||
a1time date;
|
||||
date.set(nbYear->text().toInt(), nbMon->currentItem() + 1,
|
||||
nbDay->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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
83
validity.h
Normal file
83
validity.h
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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 VALIDITY_H
|
||||
#define VALIDITY_H
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qgroupbox.h>
|
||||
|
||||
class QGridLayout;
|
||||
class a1time;
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
|
||||
class Validity : public QGroupBox
|
||||
{
|
||||
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);
|
||||
|
||||
protected:
|
||||
QGridLayout* ValidityLayout;
|
||||
QLabel *Label1, *Label2;
|
||||
QComboBox *nbDay, *nbMon, *naMon, *naDay;
|
||||
QLineEdit *nbYear, *naYear;
|
||||
|
||||
};
|
||||
|
||||
#endif // VALIDITY_H
|
||||
Loading…
Reference in New Issue
Block a user