mirror of
https://github.com/chris2511/xca.git
synced 2026-09-14 11:06:19 +05:00
add CRL dialog
extend setup.exe
This commit is contained in:
parent
11051862ae
commit
81bad4e11e
@ -54,7 +54,7 @@
|
||||
#include "widgets/CrlDetail.h"
|
||||
#include <Qt/qmessagebox.h>
|
||||
#include <Qt/qevent.h>
|
||||
|
||||
#include <ui/NewCrl.h>
|
||||
|
||||
db_crl::db_crl(QString db, MainWindow *mw)
|
||||
:db_base(db,mw)
|
||||
@ -180,11 +180,41 @@ pki_crl *db_crl::newItem(pki_x509 *cert)
|
||||
QList<pki_x509*> list;
|
||||
a1time time;
|
||||
pki_crl *crl = NULL;
|
||||
Ui::NewCrl ui;
|
||||
const EVP_MD *dgst;
|
||||
const EVP_MD *algolist[] = { EVP_md2(), EVP_md5(), EVP_sha1()
|
||||
#ifdef HAS_SHA256
|
||||
,EVP_sha256(), EVP_sha512()
|
||||
#endif
|
||||
};
|
||||
x509v3ext e;
|
||||
X509V3_CTX ext_ctx;
|
||||
X509V3_set_ctx(&ext_ctx, cert->getCert() , NULL, NULL, NULL, 0);
|
||||
X509V3_set_ctx_nodb((&ext_ctx));
|
||||
QDialog *dlg = new QDialog(mainwin);
|
||||
ui.setupUi(dlg);
|
||||
ui.image->setPixmap(*MainWindow::revImg);
|
||||
#ifdef HAS_SHA256
|
||||
ui.hashAlgo->addItem(tr("SHA 256"));
|
||||
ui.hashAlgo->addItem(tr("SHA 512"));
|
||||
ui.hashAlgo->setCurrentIndex(3);
|
||||
#endif
|
||||
ui.lastUpdate->setDate(time.now());
|
||||
ui.nextUpdate->setDate(time.now(cert->getCrlDays() *60*60*24));
|
||||
|
||||
if (cert->getRefKey()->getType() == EVP_PKEY_DSA)
|
||||
ui.hashAlgo->setEnabled(false);
|
||||
else
|
||||
ui.hashAlgo->setEnabled(true);
|
||||
|
||||
if (cert->hasExtension(NID_subject_alt_name))
|
||||
ui.subAltName->setEnabled(true);
|
||||
else
|
||||
ui.subAltName->setEnabled(false);
|
||||
if (!dlg->exec()) {
|
||||
delete dlg;
|
||||
return NULL;
|
||||
}
|
||||
try {
|
||||
crl = new pki_crl();
|
||||
crl->createCrl(cert->getIntName(), cert);
|
||||
@ -196,16 +226,26 @@ pki_crl *db_crl::newItem(pki_x509 *cert)
|
||||
}
|
||||
}
|
||||
|
||||
crl->addV3ext(e.create(NID_authority_key_identifier,
|
||||
"keyid,issuer", &ext_ctx));
|
||||
if (cert->hasExtension(NID_subject_alt_name)) {
|
||||
crl->addV3ext(e.create(NID_issuer_alt_name,
|
||||
"issuer:copy", &ext_ctx));
|
||||
if (ui.authKeyId->isChecked()) {
|
||||
crl->addV3ext(e.create(NID_authority_key_identifier,
|
||||
"keyid,issuer", &ext_ctx));
|
||||
}
|
||||
crl->setLastUpdate(time.now());
|
||||
crl->setNextUpdate(time.now(60*60*24*cert->getCrlDays()));
|
||||
cert->setLastCrl(time);
|
||||
crl->sign(cert->getRefKey(), EVP_sha1());
|
||||
if (ui.subAltName->isChecked()) {
|
||||
if (cert->hasExtension(NID_subject_alt_name)) {
|
||||
crl->addV3ext(e.create(NID_issuer_alt_name,
|
||||
"issuer:copy", &ext_ctx));
|
||||
}
|
||||
}
|
||||
|
||||
crl->setLastUpdate(ui.lastUpdate->getDate());
|
||||
crl->setNextUpdate(ui.nextUpdate->getDate());
|
||||
cert->setLastCrl(ui.nextUpdate->getDate());
|
||||
if (cert->getRefKey()->getType() == EVP_PKEY_DSA)
|
||||
dgst = EVP_dss1();
|
||||
else
|
||||
dgst = algolist[ui.hashAlgo->currentIndex()];
|
||||
|
||||
crl->sign(cert->getRefKey(), dgst);
|
||||
mainwin->certs->updatePKI(cert);
|
||||
#warning FIXME: set Last update
|
||||
insert(crl);
|
||||
|
||||
29
misc/xca.nsi
29
misc/xca.nsi
@ -64,12 +64,15 @@ Section "xca (required)" SecMain
|
||||
File "misc\eku.txt"
|
||||
File "misc\oids.txt"
|
||||
File "misc\aia.txt"
|
||||
File "lang\*.qm"
|
||||
File /nonfatal "lang\*.qm"
|
||||
File "doc\*.html"
|
||||
File "../mingwm10.dll"
|
||||
|
||||
File "${OPENSSL}\libeay32.dll"
|
||||
File "${QTDIR}\QtGui4.dll"
|
||||
File "${QTDIR}\QtCore4.dll"
|
||||
; remove old images
|
||||
Delete "$INSTDIR\*.png"
|
||||
; Write the installation path into the registry
|
||||
WriteRegStr HKLM SOFTWARE\xca "Install_Dir" "$INSTDIR"
|
||||
|
||||
@ -89,18 +92,24 @@ SectionEnd
|
||||
;----------------------------------------
|
||||
Section "Update" SecUpdate
|
||||
|
||||
StrCpy $3 ""
|
||||
SetOutPath $INSTDIR
|
||||
File "${DBDUMP}"
|
||||
FindFirst $0 $1 $LOCALAPPDATA\*.db
|
||||
loop:
|
||||
StrCmp $1 "" done
|
||||
Exec '"$INSTDIR\db_dump.exe" -f "$LOCALAPPDATA\$1.dump" "$LOCALAPPDATA\$1"'
|
||||
StrCpy $3 "$3 $LOCALAPPDATA\$1.dump\n"
|
||||
FindFirst $0 $1 $APPDATA\xca\*.db
|
||||
loop1:
|
||||
StrCmp $1 "" done1
|
||||
Exec '"$INSTDIR\db_dump.exe" -f "$APPDATA\xca\$1.dump" "$APPDATA\xca\$1"'
|
||||
MessageBox MB_OK "Dumping $APPDATA\xca\$1 to $APPDATA\xca\$1.dump"
|
||||
FindNext $0 $1
|
||||
Goto loop
|
||||
MessageBox MB_OK "You can use the Menu entry 'Import old db dump' to import the following dumps: $3"
|
||||
done:
|
||||
Goto loop1
|
||||
done1:
|
||||
FindFirst $0 $1 $INSTDIR\*.db
|
||||
loop2:
|
||||
StrCmp $1 "" done2
|
||||
Exec '"$INSTDIR\db_dump.exe" -f "$INSTDIR\$1.dump" "$INSTDIR\$1"'
|
||||
MessageBox MB_OK "Dumping $INSTDIR\$1 to $INSTDIR\$1.dump"
|
||||
FindNext $0 $1
|
||||
Goto loop2
|
||||
done2:
|
||||
SectionEnd
|
||||
|
||||
|
||||
|
||||
355
ui/NewCrl.ui
355
ui/NewCrl.ui
@ -1,142 +1,267 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<class>NewCrl</class>
|
||||
<widget class="QDialog" name="NewCrl" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>316</width>
|
||||
<height>384</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>250</y>
|
||||
<width>351</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>131</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton" >
|
||||
<property name="text" >
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton" >
|
||||
<property name="text" >
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="hashAlgo" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>200</y>
|
||||
<width>76</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>MD 2</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="TextLabel1" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>50</weight>
|
||||
<italic>false</italic>
|
||||
<bold>false</bold>
|
||||
<underline>false</underline>
|
||||
<strikeout>false</strikeout>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Create CRL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="image" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>95</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>95</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>MD 5</string>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>SHA 1</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Dates</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>next update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>last update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="Validity" name="lastUpdate" />
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="Validity" name="nextUpdate" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>20</y>
|
||||
<width>261</width>
|
||||
<height>161</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>GroupBox</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
<width>121</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>last update</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>101</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>next update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Hashing algorithm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="hashAlgo" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>MD 2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>MD 5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>SHA 1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<string>Extensions</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="authKeyId" >
|
||||
<property name="text" >
|
||||
<string>Authority key identifier</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="subAltName" >
|
||||
<property name="text" >
|
||||
<string>Subject alternative name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton" >
|
||||
<property name="text" >
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton" >
|
||||
<property name="text" >
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Validity</class>
|
||||
<extends>QDateTimeEdit</extends>
|
||||
<header>widgets/validity.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>okButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<receiver>NewCrl</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>278</x>
|
||||
<y>253</y>
|
||||
<x>224</x>
|
||||
<y>332</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>96</x>
|
||||
@ -147,12 +272,12 @@
|
||||
<connection>
|
||||
<sender>cancelButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<receiver>NewCrl</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>369</x>
|
||||
<y>253</y>
|
||||
<x>305</x>
|
||||
<y>332</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>179</x>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user