mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
export CA for TinyCA
This commit is contained in:
parent
7773efc749
commit
cf22f99374
@ -53,7 +53,7 @@
|
||||
|
||||
|
||||
ExportCert::ExportCert(QString fname, bool hasKey, QString dpath,
|
||||
QWidget *parent, const char *name )
|
||||
const QString tcafn, QWidget *parent, const char *name )
|
||||
:ExportCert_UI(parent,name,true,0)
|
||||
{
|
||||
filename->setText(fname);
|
||||
@ -69,6 +69,7 @@ ExportCert::ExportCert(QString fname, bool hasKey, QString dpath,
|
||||
exportFormat->insertItem("PKCS #12 with Certificate chain");
|
||||
}
|
||||
dirPath = dpath;
|
||||
tinyCAfname = tcafn;
|
||||
}
|
||||
|
||||
void ExportCert::chooseFile()
|
||||
@ -104,3 +105,9 @@ void ExportCert::formatChanged()
|
||||
CERR(nfn);
|
||||
filename->setText(nfn);
|
||||
}
|
||||
|
||||
void ExportCert::setTinyCAfname()
|
||||
{
|
||||
filename->setText(tinyCAfname);
|
||||
}
|
||||
|
||||
|
||||
12
ExportCert.h
12
ExportCert.h
@ -63,13 +63,19 @@
|
||||
class ExportCert: public ExportCert_UI
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QString tinyCAfname;
|
||||
|
||||
public:
|
||||
ExportCert(QString fname, bool hasKey, QString dpath,
|
||||
QWidget *parent = 0, const char *name = 0);
|
||||
const QString tcafn, QWidget *parent = 0, const char *name = 0);
|
||||
QString dirPath;
|
||||
|
||||
public slots:
|
||||
virtual void chooseFile();
|
||||
virtual void formatChanged();
|
||||
void chooseFile();
|
||||
void formatChanged();
|
||||
void setTinyCAfname();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>492</width>
|
||||
<height>306</height>
|
||||
<width>527</width>
|
||||
<height>319</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
@ -111,22 +111,57 @@
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<class>QLayoutWidget</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabel13</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Please enter the filename for the certificate.</string>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>alignment</name>
|
||||
<set>WordBreak|AlignVCenter|AlignLeft</set>
|
||||
</property>
|
||||
<property>
|
||||
<name>wordwrap</name>
|
||||
<cstring>Layout3</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>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabel13</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizePolicy</name>
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Please enter the filename for the certificate.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PushButton3</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizePolicy</name>
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>TinyCA filename</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QFrame</class>
|
||||
@ -346,8 +381,15 @@ PKCS#12 is an encrypted official Key-Certificate exchange format</string>
|
||||
<receiver>ExportCert_UI</receiver>
|
||||
<slot>formatChanged()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>PushButton3</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ExportCert_UI</receiver>
|
||||
<slot>setTinyCAfname()</slot>
|
||||
</connection>
|
||||
<slot access="public">chooseFile()</slot>
|
||||
<slot access="public">formatChanged()</slot>
|
||||
<slot access="public">setTinyCAfname()</slot>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>filename</tabstop>
|
||||
|
||||
94
ExportTinyCA.cpp
Normal file
94
ExportTinyCA.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* 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 "ExportTinyCA.h"
|
||||
|
||||
|
||||
ExportTinyCA::ExportTinyCA(const QString tmpdir, const QString tcadir,
|
||||
QWidget *parent, const char *name )
|
||||
:ExportTinyCA_UI(parent,name,true,0)
|
||||
{
|
||||
tempdir->setText(tmpdir);
|
||||
tinycadir->setText(tcadir);
|
||||
setCaption(tr(XCA_TITLE));
|
||||
}
|
||||
|
||||
void ExportTinyCA::chooseTempDir()
|
||||
{
|
||||
QString s = "";
|
||||
QFileDialog *dlg = new QFileDialog(this,0,true);
|
||||
dlg->setCaption(tr("TinyCA Template directory"));
|
||||
dlg->setMode( QFileDialog::DirectoryOnly );
|
||||
dlg->setSelection( tempdir->text() );
|
||||
if (dlg->exec())
|
||||
s = dlg->selectedFile();
|
||||
if (! s.isEmpty()) {
|
||||
QDir::convertSeparators(s);
|
||||
tempdir->setText(s);
|
||||
}
|
||||
delete dlg;
|
||||
}
|
||||
|
||||
void ExportTinyCA::chooseTinyCaDir()
|
||||
{
|
||||
QString s = "";
|
||||
QFileDialog *dlg = new QFileDialog(this,0,true);
|
||||
dlg->setCaption(tr("TinyCA Directory "));
|
||||
dlg->setMode( QFileDialog::DirectoryOnly );
|
||||
dlg->setSelection( tinycadir->text() );
|
||||
if (dlg->exec())
|
||||
s = dlg->selectedFile();
|
||||
if (! s.isEmpty()) {
|
||||
QDir::convertSeparators(s);
|
||||
tinycadir->setText(s);
|
||||
}
|
||||
delete dlg;
|
||||
}
|
||||
76
ExportTinyCA.h
Normal file
76
ExportTinyCA.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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 "ExportTinyCA_UI.h"
|
||||
#include <qfiledialog.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qlineedit.h>
|
||||
#include "lib/base.h"
|
||||
#include <iostream>
|
||||
|
||||
#ifndef EXPORTTINY_H
|
||||
#define EXPORTTINY_H
|
||||
|
||||
class ExportTinyCA: public ExportTinyCA_UI
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExportTinyCA(const QString tmpdir, const QString tcadir,
|
||||
QWidget *parent = 0, const char *name = 0);
|
||||
|
||||
public slots:
|
||||
void chooseTempDir();
|
||||
void chooseTinyCaDir();
|
||||
};
|
||||
|
||||
#endif
|
||||
428
ExportTinyCA_UI.ui
Normal file
428
ExportTinyCA_UI.ui
Normal file
@ -0,0 +1,428 @@
|
||||
<!DOCTYPE UI><UI>
|
||||
<class>ExportTinyCA_UI</class>
|
||||
<widget>
|
||||
<class>QDialog</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>ExportTinyCA_UI</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>589</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>caption</name>
|
||||
<string>CA export</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QLayoutWidget</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>Layout9_2</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>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabel12_2</cstring>
|
||||
</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>TinyCA export</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property>
|
||||
<name>name</name>
|
||||
<cstring>Spacer6_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>orientation</name>
|
||||
<enum>Horizontal</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>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>image_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>minimumSize</name>
|
||||
<size>
|
||||
<width>95</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>maximumSize</name>
|
||||
<size>
|
||||
<width>95</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>scaledContents</name>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property>
|
||||
<name>name</name>
|
||||
<cstring>Spacer10</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>QFrame</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>Frame5_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>frameShape</name>
|
||||
<enum>Box</enum>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>frameShadow</name>
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<hbox>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabel14</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Templatedir:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>tempdir</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QToolButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>ToolButton1</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizePolicy</name>
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QFrame</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>Frame5_2_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>frameShape</name>
|
||||
<enum>Box</enum>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>frameShadow</name>
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<hbox>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabel14_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>TinyCA Directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>tinycadir</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QToolButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>ToolButton1_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizePolicy</name>
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QFrame</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>Frame5_2_2_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>frameShape</name>
|
||||
<enum>Box</enum>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>frameShadow</name>
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<hbox>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QLabel</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>TextLabel14_2_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLineEdit</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>dname</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QToolButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>ToolButton1_2_2</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizePolicy</name>
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</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>
|
||||
<widget>
|
||||
<class>QLayoutWidget</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>Layout6</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>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PushButton9</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property>
|
||||
<name>name</name>
|
||||
<cstring>Spacer7</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>orientation</name>
|
||||
<enum>Horizontal</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>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>PushButton7</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>PushButton9</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ExportTinyCA_UI</receiver>
|
||||
<slot>reject()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>PushButton7</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ExportTinyCA_UI</receiver>
|
||||
<slot>accept()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>ToolButton1_2</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ExportTinyCA_UI</receiver>
|
||||
<slot>chooseTinyCaDir()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>ToolButton1</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ExportTinyCA_UI</receiver>
|
||||
<slot>chooseTempDir()</slot>
|
||||
</connection>
|
||||
<slot access="public">chooseTempDir()</slot>
|
||||
<slot access="public">chooseTinyCaDir()</slot>
|
||||
</connections>
|
||||
</UI>
|
||||
@ -458,3 +458,18 @@ void MainWindow::newPath(QString str)
|
||||
{
|
||||
settings->putString("workingdir", str.latin1());
|
||||
}
|
||||
|
||||
bool MainWindow::mkDir(QString dir)
|
||||
{
|
||||
int ret = mkdir(dir.latin1(), S_IRUSR | S_IWUSR | S_IXUSR);
|
||||
if (ret) {
|
||||
QString desc = " (";
|
||||
desc += strerror(ret);
|
||||
desc += ")";
|
||||
QMessageBox::critical(this,tr(XCA_TITLE),
|
||||
tr("Error creating: ") + dir + desc);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -66,6 +66,7 @@
|
||||
#include "TrustState.h"
|
||||
#include "ExportCert.h"
|
||||
#include "ExportKey.h"
|
||||
#include "ExportTinyCA.h"
|
||||
#include <iostream>
|
||||
#include <qtextview.h>
|
||||
#include <qapplication.h>
|
||||
@ -99,6 +100,9 @@
|
||||
#include "lib/db_x509req.h"
|
||||
#include "lib/db_x509.h"
|
||||
#include "lib/db_temp.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
@ -159,6 +163,7 @@ class MainWindow: public MainWindow_UI
|
||||
QString getPath();
|
||||
void newPath(QFileDialog *dlg);
|
||||
void newPath(QString str);
|
||||
bool mkDir(QString dir);
|
||||
public slots:
|
||||
void loadKey();
|
||||
void loadReq();
|
||||
@ -219,6 +224,7 @@ class MainWindow: public MainWindow_UI
|
||||
void signP7();
|
||||
void encryptP7();
|
||||
void changeView();
|
||||
void toTinyCA();
|
||||
signals:
|
||||
void keyDone(QString name);
|
||||
};
|
||||
|
||||
@ -744,7 +744,8 @@ void MainWindow::writeCert()
|
||||
if (!crt) return;
|
||||
pki_key *privkey = crt->getKey();
|
||||
ExportCert *dlg = new ExportCert((crt->getDescription() + ".crt").c_str(),
|
||||
(privkey && privkey->isPrivKey()), getPath() );
|
||||
(privkey && privkey->isPrivKey()), getPath(), crt->tinyCAfname().c_str() );
|
||||
dlg->image->setPixmap(*certImg);
|
||||
int dlgret = dlg->exec();
|
||||
newPath(dlg->dirPath);
|
||||
|
||||
@ -920,7 +921,7 @@ void MainWindow::showPopupCert(QListViewItem *item, const QPoint &pt, int x) {
|
||||
QPopupMenu *subCa = new QPopupMenu(this);
|
||||
QPopupMenu *subP7 = new QPopupMenu(this);
|
||||
QPopupMenu *subExport = new QPopupMenu(this);
|
||||
int itemExtend, itemRevoke, itemTrust, itemCA, itemTemplate, itemReq, itemP7;
|
||||
int itemExtend, itemRevoke, itemTrust, itemCA, itemTemplate, itemReq, itemP7, itemtca;
|
||||
bool canSign, parentCanSign, hasTemplates, hasPrivkey;
|
||||
|
||||
if (!item) {
|
||||
@ -936,6 +937,7 @@ void MainWindow::showPopupCert(QListViewItem *item, const QPoint &pt, int x) {
|
||||
menu->insertItem(tr("Export"), subExport);
|
||||
subExport->insertItem(tr("File"), this, SLOT(writeCert()));
|
||||
itemReq = subExport->insertItem(tr("Request"), this, SLOT(toRequest()));
|
||||
itemtca = subExport->insertItem(tr("TinyCA"), this, SLOT(toTinyCA()));
|
||||
|
||||
menu->insertItem(tr("Delete"), this, SLOT(deleteCert()));
|
||||
itemTrust = menu->insertItem(tr("Trust"), this, SLOT(setTrust()));
|
||||
@ -967,6 +969,7 @@ void MainWindow::showPopupCert(QListViewItem *item, const QPoint &pt, int x) {
|
||||
menu->setItemEnabled(itemRevoke, parentCanSign);
|
||||
menu->setItemEnabled(itemCA, canSign);
|
||||
subExport->setItemEnabled(itemReq, hasPrivkey);
|
||||
subExport->setItemEnabled(itemtca, canSign);
|
||||
menu->setItemEnabled(itemP7, hasPrivkey);
|
||||
subCa->setItemEnabled(itemTemplate, hasTemplates);
|
||||
|
||||
@ -1168,6 +1171,61 @@ void MainWindow::changeView()
|
||||
certs->updateView();
|
||||
}
|
||||
|
||||
void MainWindow::toTinyCA()
|
||||
{
|
||||
pki_x509 *crt = (pki_x509 *)certs->getSelectedPKI();
|
||||
if (!crt) return;
|
||||
pki_key *key = crt->getKey();
|
||||
if (!key) return;
|
||||
FILE *fp;
|
||||
|
||||
QString dname = crt->getDescription().c_str();
|
||||
QString tcatempdir = settings->getString("TinyCAtempdir").c_str();
|
||||
QString tcadir = settings->getString("TinyCAdir").c_str();
|
||||
if (tcatempdir.isEmpty()) {
|
||||
tcatempdir = "templates";
|
||||
}
|
||||
if (tcadir.isEmpty()) {
|
||||
tcadir = QDir::homeDirPath();
|
||||
tcadir += QDir::separator();
|
||||
tcadir += ".TinyCA";
|
||||
}
|
||||
ExportTinyCA *dlg = new ExportTinyCA( tcatempdir, tcadir, this, NULL);
|
||||
if (!dlg->exec()) return;
|
||||
|
||||
tcatempdir = dlg->tempdir->text();
|
||||
tcadir = dlg->tinycadir->text();
|
||||
dname = dlg->dname->text();
|
||||
|
||||
if (dname.isEmpty()) return;
|
||||
const EVP_CIPHER *enc = EVP_des_ede3_cbc();
|
||||
|
||||
// OK, we have all names now...
|
||||
tcadir += QDir::separator();
|
||||
tcadir += dname;
|
||||
|
||||
//create directory tree
|
||||
if (! mkDir(tcadir)) return;
|
||||
chdir(tcadir.latin1());
|
||||
if (! mkDir("certs")) return;
|
||||
if (! mkDir("crl")) return;
|
||||
if (! mkDir("keys")) return;
|
||||
if (! mkDir("newcerts")) return;
|
||||
if (! mkDir("req")) return;
|
||||
|
||||
crt->writeCert("cacert.pem", true, false);
|
||||
key->writeKey("cacert.key", enc, &MainWindow::passWrite, true);
|
||||
fp = fopen("serial", "w");
|
||||
if (!fp) return;
|
||||
fprintf(fp, "%x", crt->getCaSerial());
|
||||
fclose(fp);
|
||||
|
||||
settings->putString("TinyCAtempdir", tcatempdir.latin1());
|
||||
settings->putString("TinyCAdir", tcadir.latin1());
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::startRenameCert()
|
||||
{
|
||||
try {
|
||||
|
||||
@ -24,9 +24,10 @@ UIC=@UIC@
|
||||
###################################
|
||||
|
||||
UINAMES=CertDetail ExportKey_UI ExportCert_UI KeyDetail MainWindow_UI \
|
||||
NewKey NewX509_UI PassRead PassWrite ReqDetail TrustState CertExtend
|
||||
NewKey NewX509_UI PassRead PassWrite ReqDetail TrustState \
|
||||
CertExtend ExportTinyCA_UI
|
||||
|
||||
MOCNAMES=NewX509 ExportKey MainWindow ExportCert $(UINAMES)
|
||||
MOCNAMES=ExportTinyCA NewX509 ExportKey MainWindow ExportCert $(UINAMES)
|
||||
|
||||
MOBJS=MainWindowKeys.o MainWindowX509Req.o MainWindowX509.o MainWindowTemps.o
|
||||
OOBJS=$(patsubst %,moc_%.o,$(MOCNAMES)) $(patsubst %,%.o,$(MOCNAMES))
|
||||
|
||||
@ -768,6 +768,7 @@ string pki_x509::tinyCAfname()
|
||||
EVP_EncodeBlock(buf, (unsigned char *)col.c_str(), len );
|
||||
col = (char *)buf;
|
||||
OPENSSL_free(buf);
|
||||
col += ".pem";
|
||||
CERR("base64 Encoding: " <<col);
|
||||
return col;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user