mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
This is a large squash of many small commits. Allow porting data from the legacy format to SQL. Store Binaries base64 encoded and use db->transaction Update password hash to be 8000 x SHA512 with 8 byte Salt Add revocations table and fixup CRL generation Add comment and insertion date columns Fix column saving, remove trust, add XcaDialog Allow changing the internal name and comment in Cert/Req details view Extend Comment functionality, Replace About.ui by XcaDialog.ui
137 lines
3.9 KiB
C++
137 lines
3.9 KiB
C++
/* vi: set sw=4 ts=4:
|
|
*
|
|
* Copyright (C) 2001 - 2017 Christian Hohnstaedt.
|
|
*
|
|
* All rights reserved.
|
|
*/
|
|
|
|
|
|
#include "MainWindow.h"
|
|
#include <QApplication>
|
|
#include <QMimeData>
|
|
#include <QPixmap>
|
|
#include <QLabel>
|
|
#ifndef OPENSSL_NO_EC
|
|
#include <openssl/ec.h>
|
|
#endif
|
|
#include "XcaDialog.h"
|
|
#include "ui_Help.h"
|
|
#include "lib/func.h"
|
|
#include "lib/entropy.h"
|
|
|
|
void MainWindow::cmd_version()
|
|
{
|
|
fprintf(stderr, XCA_TITLE " Version %s\n", version_str(false));
|
|
exitApp = 1;
|
|
}
|
|
|
|
void MainWindow::cmd_help(const char* msg)
|
|
{
|
|
fprintf(stderr, XCA_TITLE " Version %s\n"
|
|
"\n"
|
|
" -v show version information and exit\n"
|
|
" -h shows this help screen and exit\n"
|
|
" -e <type>:<name> extract entry.\n"
|
|
" -d expect the following argument to be the database name to use\n"
|
|
" -i expect the following argument to be the index file to generate\n"
|
|
" -I expect the following argument to be the base name the index file hierarchy to generate\n"
|
|
" -x Exit after processing all commandline options\n\n", version_str(false));
|
|
|
|
if (msg) {
|
|
fprintf(stderr, "Cmdline Error: %s\n", msg);
|
|
}
|
|
exitApp = 1;
|
|
}
|
|
|
|
void MainWindow::about()
|
|
{
|
|
QTextEdit *textbox = new QTextEdit(NULL);
|
|
XcaDialog *about = new XcaDialog(this, x509, textbox,
|
|
QString(), QString());
|
|
about->aboutDialog(scardImg);
|
|
QString openssl, qt, cont, version, brainpool;
|
|
#ifndef OPENSSL_NO_EC
|
|
#ifdef NID_brainpoolP160r1
|
|
EC_GROUP *group = EC_GROUP_new_by_curve_name(NID_brainpoolP160r1);
|
|
ign_openssl_error();
|
|
if (group) {
|
|
EC_GROUP_free(group);
|
|
brainpool = "<p>ECC With RFC 5639 Brainpool curves"
|
|
#if OPENSSL_VERSION_NUMBER < 0x10002001L
|
|
"<br/>(Backported to " OPENSSL_VERSION_TEXT ")"
|
|
#endif
|
|
;
|
|
}
|
|
#endif
|
|
#else
|
|
brainpool = "(Elliptic Curve Cryptography support disabled)";
|
|
#endif
|
|
openssl = SSLeay_version(SSLEAY_VERSION);
|
|
qt = qVersion();
|
|
if (openssl != OPENSSL_VERSION_TEXT ||
|
|
qt != QT_VERSION_STR)
|
|
{
|
|
version = QString("<table border=0 width=500><tr>"
|
|
"<td>Compile time:</td>"
|
|
"<td>" OPENSSL_VERSION_TEXT "</td>"
|
|
"<td>QT version: " QT_VERSION_STR "</td>"
|
|
"</tr><tr>"
|
|
"<td>Run time:</td>"
|
|
"<td>%1</td>"
|
|
"<td>QT version: %2</td>"
|
|
"</tr></table>").arg(openssl).arg(qt);
|
|
} else {
|
|
version = QString("%1<br>QT version: %2").arg(openssl).arg(qt);
|
|
}
|
|
Entropy::seed_rng();
|
|
cont = QString(
|
|
"<p><h3><center><u>XCA</u></center></h3>"
|
|
"<p>Copyright 2001 - 2018 by Christian Hohnstädt\n"
|
|
"<p>Version: %4<p>%1<p>%2" /* commithash, Brainpool, OpenSSL & Qt Version */
|
|
"<p>http://hohnstaedt.de/xca"
|
|
"<p>Entropy strength: %3"
|
|
"<p>Installation path: <i>%5</i><br/>User settings path: <i>%6</i>"
|
|
"<hr><table border=0>"
|
|
"<tr><th align=left>Christian Hohnstädt</th><td><u><christian@hohnstaedt.de></u></td></tr>"
|
|
"<tr><td></td><td>Programming, Translation and Testing</td></tr>"
|
|
"<tr><th align=left>Kerstin Steinhauff</th><td><u><tine@kerstine.de></td></u></tr>"
|
|
"<tr><td></td><td>Arts and Graphics</td></tr>"
|
|
"</table><hr><center><u><b>Maintained Translations</b></u></center>"
|
|
"<p><table>"
|
|
"<tr><td><b>German</b></td><td>Christian Hohnstädt <christian@hohnstaedt.de></td></tr>"
|
|
"<tr><td><b>French</b></td><td>Patrick Monnerat <Patrick.Monnerat@datasphere.ch></td></tr>"
|
|
"<tr><td><b>Croatian</b></td><td>Nevenko Bartolincic <nevenko.bartolincic@gmail.com></td></tr>"
|
|
"<tr><td><b>Slovak</b></td><td>Slavko <linux@slavino.sk></td></tr>"
|
|
"</table>").arg(brainpool).arg(version).arg(Entropy::strength())
|
|
.arg(version_str(true)).arg(getPrefix())
|
|
.arg(getUserSettingsDir());
|
|
|
|
textbox->setHtml(cont);
|
|
about->exec();
|
|
delete about;
|
|
}
|
|
|
|
void MainWindow::help()
|
|
{
|
|
QDialog *h = new QDialog(this, 0);
|
|
QString path, uri;
|
|
Ui::Help ui;
|
|
ui.setupUi(h);
|
|
|
|
path = QString("file://");
|
|
#if defined(Q_OS_WIN32)
|
|
path += "/";
|
|
#endif
|
|
path += getDocDir() + "/";
|
|
#if defined(Q_OS_WIN32)
|
|
path = path.replace("\\","/");
|
|
#endif
|
|
uri = path + "xca.html";
|
|
|
|
ui.textbox->setSource(QUrl(uri));
|
|
ui.textbox->setSearchPaths(QStringList(path));
|
|
h->setWindowTitle(tr(XCA_TITLE));
|
|
h->show();
|
|
}
|
|
|