mirror of
https://github.com/chris2511/xca.git
synced 2026-09-14 11:06:19 +05:00
Certificates are now generated well,
they can be loaded and stored.
This commit is contained in:
parent
1899ce4c72
commit
86f52eba50
@ -54,6 +54,7 @@ class MainWindow: public MainWindow_UI
|
||||
public slots:
|
||||
void loadKey();
|
||||
void loadReq();
|
||||
void loadCert();
|
||||
void newKey();
|
||||
void newReq();
|
||||
void newCert();
|
||||
@ -61,7 +62,9 @@ class MainWindow: public MainWindow_UI
|
||||
void showDetailsReq();
|
||||
void deleteKey();
|
||||
void deleteReq();
|
||||
void deleteCert();
|
||||
void writeKey();
|
||||
void writeReq();
|
||||
void writeCert();
|
||||
};
|
||||
#endif
|
||||
|
||||
126
MainWindow.ui
126
MainWindow.ui
@ -11,7 +11,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<width>596</width>
|
||||
<height>533</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -261,7 +261,7 @@
|
||||
</property>
|
||||
<attribute>
|
||||
<name>title</name>
|
||||
<string>Signing Request</string>
|
||||
<string>Unterschriftsanfrage</string>
|
||||
</attribute>
|
||||
<widget>
|
||||
<class>QFrame</class>
|
||||
@ -461,26 +461,6 @@
|
||||
<name>frameShadow</name>
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PushButton26_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>180</y>
|
||||
<width>190</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Löschen</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
@ -505,26 +485,6 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PushButton47_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>190</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Exportieren</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
@ -585,6 +545,46 @@
|
||||
<string>Neues Zertifikat erstellen</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PushButton47_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>190</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Exportieren</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PushButton26_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>180</y>
|
||||
<width>190</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Löschen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QListBox</class>
|
||||
@ -637,12 +637,6 @@
|
||||
<receiver>MainWindow_UI</receiver>
|
||||
<slot>newKey()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>renameKey</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MainWindow_UI</receiver>
|
||||
<slot>deleteKey()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>detailsKey</sender>
|
||||
<signal>clicked()</signal>
|
||||
@ -709,15 +703,49 @@
|
||||
<receiver>MainWindow_UI</receiver>
|
||||
<slot>newCert()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>PushButton47_2</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MainWindow_UI</receiver>
|
||||
<slot>writeCert()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>PushButton46_2</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MainWindow_UI</receiver>
|
||||
<slot>loadCert()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>PushButton25_2</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MainWindow_UI</receiver>
|
||||
<slot>showDetailsCert()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>PushButton26_2</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MainWindow_UI</receiver>
|
||||
<slot>deleteCert()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>renameKey</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MainWindow_UI</receiver>
|
||||
<slot>deleteKey()</slot>
|
||||
</connection>
|
||||
<slot access="public">deleteCert()</slot>
|
||||
<slot access="public">deleteKey()</slot>
|
||||
<slot access="public">deleteReq()</slot>
|
||||
<slot access="public">loadCert()</slot>
|
||||
<slot access="public">loadKey()</slot>
|
||||
<slot access="public">loadReq()</slot>
|
||||
<slot access="public">newCert()</slot>
|
||||
<slot access="public">newKey()</slot>
|
||||
<slot access="public">newReq()</slot>
|
||||
<slot access="public">newCert()</slot>
|
||||
<slot access="public">showDetailsCert()</slot>
|
||||
<slot access="public">showDetailsKey()</slot>
|
||||
<slot access="public">showDetailsReq()</slot>
|
||||
<slot access="public">writeCert()</slot>
|
||||
<slot access="public">writeKey()</slot>
|
||||
<slot access="public">writeReq()</slot>
|
||||
</connections>
|
||||
|
||||
@ -74,13 +74,13 @@ void MainWindow::showDetailsReq()
|
||||
certs->updatePKI(cert, ndesc);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::deleteReq()
|
||||
*/
|
||||
void MainWindow::deleteCert()
|
||||
{
|
||||
pki_x509 *cert = (pki_x509 *)certs->getSelectedPKI();
|
||||
if (!cert) return;
|
||||
if (QMessageBox::information(this,"Zertifikatsanfrage löschen",
|
||||
("Möchten Sie die Zertifikatsanfrage: '" +
|
||||
if (QMessageBox::information(this,"Zertifikat löschen",
|
||||
("Möchten Sie das Zertifikat: '" +
|
||||
cert->getDescription() +
|
||||
"'\nwirklich löschen ?\n").c_str(),
|
||||
"Löschen", "Abbrechen")
|
||||
@ -88,14 +88,14 @@ void MainWindow::deleteReq()
|
||||
certs->deletePKI(cert);
|
||||
}
|
||||
|
||||
void MainWindow::loadReq()
|
||||
void MainWindow::loadCert()
|
||||
{
|
||||
QStringList filt;
|
||||
filt.append( "Zertifikatsanfragen ( *.pem *.der )");
|
||||
filt.append( "Zertifikate ( *.pem *.der )");
|
||||
filt.append("Alle Dateien ( *.* )");
|
||||
string s;
|
||||
QFileDialog *dlg = new QFileDialog(this,0,true);
|
||||
dlg->setCaption("Anfrage importieren");
|
||||
dlg->setCaption("Zertifikat importieren");
|
||||
dlg->setFilters(filt);
|
||||
if (dlg->exec())
|
||||
s = dlg->selectedFile().latin1();
|
||||
@ -104,14 +104,14 @@ void MainWindow::loadReq()
|
||||
string errtxt;
|
||||
if ((errtxt = cert->getError()) != "") {
|
||||
QMessageBox::warning(this,"Datei Fehler",
|
||||
("Die Zertifikatsanfrage: '" + s +
|
||||
("Das Zertifikat: '" + s +
|
||||
"'\nkonnte nicht geladen werden:\n" + errtxt).c_str());
|
||||
return;
|
||||
}
|
||||
pki_x509 *oldcert = (pki_x509 *)certs->findPKI(cert);
|
||||
if (oldcert) {
|
||||
QMessageBox::information(this,"Zertifikatsanfragen import",
|
||||
("Die Zertifikatsanfrage ist bereits vorhanden als:\n'" +
|
||||
QMessageBox::information(this,"Zertifikats import",
|
||||
("Das Zertifikat ist bereits vorhanden als:\n'" +
|
||||
oldcert->getDescription() +
|
||||
"'\nund wurde daher nicht importiert").c_str(), "OK");
|
||||
delete(oldcert);
|
||||
@ -120,14 +120,14 @@ void MainWindow::loadReq()
|
||||
certs->insertPKI(cert);
|
||||
}
|
||||
|
||||
void MainWindow::writeReq()
|
||||
void MainWindow::writeCert()
|
||||
{
|
||||
QStringList filt;
|
||||
filt.append( "Zertifikatsanfragen ( *.pem *.der )");
|
||||
filt.append( "Zertifikat ( *.pem *.der )");
|
||||
filt.append("Alle Dateien ( *.* )");
|
||||
string s;
|
||||
QFileDialog *dlg = new QFileDialog(this,0,true);
|
||||
dlg->setCaption("Anfrage exportieren");
|
||||
dlg->setCaption("Zertifikat exportieren");
|
||||
dlg->setFilters(filt);
|
||||
if (dlg->exec())
|
||||
s = dlg->selectedFile().latin1();
|
||||
@ -138,10 +138,9 @@ void MainWindow::writeReq()
|
||||
string errtxt;
|
||||
if ((errtxt = cert->getError()) != "") {
|
||||
QMessageBox::warning(this,"Datei Fehler",
|
||||
("Die Zertifikatsanfrage: '" + s +
|
||||
("Das Zertifikat: '" + s +
|
||||
"'\nkonnte nicht gespeichert werden:\n" + errtxt).c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@ -51,6 +51,7 @@ void MainWindow::showDetailsReq()
|
||||
{
|
||||
dlg->keyPubEx->setText(key->pubEx().c_str());
|
||||
dlg->keyModulus->setText(key->modulus().c_str());
|
||||
dlg->keySize->setText(key->length().c_str());
|
||||
pki_key *existkey = (pki_key *)keys->findPKI(key);
|
||||
if (existkey) {
|
||||
if (!existkey->isPubKey()) {
|
||||
|
||||
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
||||
VERSION=0.1.7
|
||||
TAG=$(shell echo "V.$(VERSION)" |sed "s/\./_/g")
|
||||
TAG=$(shell echo "V.$(VERSION)" |sed "s/\./_/g" )
|
||||
TARGET=xca-$(VERSION)
|
||||
GCC=g++ -Wall
|
||||
INC=-I$(QTDIR)/include
|
||||
|
||||
334
ReqDetail.ui
334
ReqDetail.ui
@ -11,7 +11,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>526</width>
|
||||
<width>518</width>
|
||||
<height>660</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -34,6 +34,14 @@
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>frameShape</name>
|
||||
<enum>Box</enum>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>frameShadow</name>
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>title</name>
|
||||
<string>Allgemeines</string>
|
||||
@ -850,62 +858,6 @@
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>dnL</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>60</y>
|
||||
<width>160</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</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>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>dnCN</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>90</y>
|
||||
<width>160</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</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>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
@ -990,6 +942,114 @@
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>dnCN</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>90</y>
|
||||
<width>160</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</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>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>dnL</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>60</y>
|
||||
<width>160</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</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>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabel1</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>10</y>
|
||||
<width>250</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>font</name>
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<bold>1</bold>
|
||||
<underline>1</underline>
|
||||
</font>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Details der Unterschriftsanfrage</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PixmapLabel2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>400</x>
|
||||
<y>10</y>
|
||||
<width>100</width>
|
||||
<height>47</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>pixmap</name>
|
||||
<pixmap>image0</pixmap>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>scaledContents</name>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QGroupBox</class>
|
||||
@ -1010,34 +1070,6 @@
|
||||
<name>title</name>
|
||||
<string>Schlüssel</string>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>keyPubEx</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>30</y>
|
||||
<width>350</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</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>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
@ -1105,6 +1137,10 @@
|
||||
<name>text</name>
|
||||
<string></string>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>alignment</name>
|
||||
<set>WordBreak|AlignTop|AlignLeft</set>
|
||||
</property>
|
||||
<property>
|
||||
<name>vAlign</name>
|
||||
</property>
|
||||
@ -1112,58 +1148,82 @@
|
||||
<name>wordwrap</name>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabel1</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>10</y>
|
||||
<width>250</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>font</name>
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<bold>1</bold>
|
||||
<underline>1</underline>
|
||||
</font>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Details der Unterschriftsanfrage</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PixmapLabel2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>400</x>
|
||||
<y>10</y>
|
||||
<width>100</width>
|
||||
<height>47</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>pixmap</name>
|
||||
<pixmap>image0</pixmap>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>scaledContents</name>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>keyPubEx</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>30</y>
|
||||
<width>130</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</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>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>keySize</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>30</y>
|
||||
<width>110</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</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>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabel1_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>30</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Schlüssellänge:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<images>
|
||||
|
||||
@ -6,7 +6,7 @@ pki_x509::pki_x509(pki_key *key, const string cn,
|
||||
const string c, const string l,
|
||||
const string st,const string o,
|
||||
const string ou,const string email,
|
||||
const string d)
|
||||
const string d,int days=365)
|
||||
:pki_base( d )
|
||||
{
|
||||
cert = X509_new();
|
||||
@ -38,7 +38,26 @@ pki_x509::pki_x509(pki_key *key, const string cn,
|
||||
(unsigned char*)email.c_str() , -1, -1, 0);
|
||||
|
||||
const EVP_MD *digest = EVP_md5();
|
||||
X509_sign(cert, key->key, digest);
|
||||
|
||||
/* Set version to V3 */
|
||||
if(!X509_set_version(cert, 2)) {
|
||||
error="set Version faoiled";
|
||||
return;
|
||||
}
|
||||
ASN1_INTEGER_set(X509_get_serialNumber(cert),0L);
|
||||
|
||||
X509_set_issuer_name(cert,subj);
|
||||
X509_gmtime_adj(X509_get_notBefore(cert),0);
|
||||
X509_gmtime_adj(X509_get_notAfter(cert), (long)60*60*24*days);
|
||||
|
||||
/* Set up V3 context struct */
|
||||
X509V3_CTX ext_ctx;
|
||||
|
||||
X509V3_set_ctx(&ext_ctx, cert, cert, NULL, NULL, 0);
|
||||
|
||||
if (!X509_sign(cert, key->key, digest)) {
|
||||
error="Error signing the request";
|
||||
}
|
||||
openssl_error();
|
||||
}
|
||||
|
||||
@ -60,12 +79,12 @@ pki_x509::pki_x509(const string fname)
|
||||
if (!cert) {
|
||||
openssl_error();
|
||||
rewind(fp);
|
||||
printf("Fallback to private key DER\n");
|
||||
printf("Fallback to certificate DER\n");
|
||||
cert = d2i_X509_fp(fp, NULL);
|
||||
}
|
||||
int r = fname.rfind('.');
|
||||
int l = fname.rfind('/');
|
||||
desc = fname.substr(l,r);
|
||||
desc = fname.substr(l+1,r-l-1);
|
||||
if (desc == "") desc = fname;
|
||||
openssl_error();
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/pem.h>
|
||||
#include "pki_key.h"
|
||||
|
||||
@ -14,7 +15,7 @@ class pki_x509 : public pki_base
|
||||
const string c, const string l,
|
||||
const string st,const string o,
|
||||
const string ou,const string email,
|
||||
const string d);
|
||||
const string d, int days=365);
|
||||
pki_x509();
|
||||
pki_x509(const string fname);
|
||||
virtual void fromData(unsigned char *p, int size);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user