Rebase on master

This commit is contained in:
Christian Hohnstaedt 2017-07-14 22:05:35 +02:00
parent fed2dd711a
commit 07594d1edd
7 changed files with 22 additions and 36 deletions

View File

@ -104,7 +104,7 @@ AC_ARG_WITH([qt-version],
[WANT_QT_VERSION=detect])
if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 5; then
PKG_CHECK_MODULES(Qt5, [Qt5Core >= 5.0, Qt5Widgets >= 5.0], [
PKG_CHECK_MODULES(Qt5, [Qt5Core >= 5.0 Qt5Widgets >= 5.0 Qt5Sql >= 5.0], [
_QT_HOST_BINS="`pkg-config --variable=host_bins Qt5Core`"
QT_MOC="${_QT_HOST_BINS}/moc"
QT_UIC="${_QT_HOST_BINS}/uic"
@ -120,7 +120,7 @@ if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 5; then
fi
if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 4; then
PKG_CHECK_MODULES(Qt4, [QtCore >= 4.7, QtCore < 5.0, QtGui >= 4.7, QtGui < 5.0], [
PKG_CHECK_MODULES(Qt4, [QtCore >= 4.7 QtCore < 5.0 QtGui >= 4.7 QtGui < 5.0 QtSql >= 4.7 QtSql < 5.0], [
QT_MOC="`pkg-config --variable=moc_location QtCore`"
QT_UIC="`pkg-config --variable=uic_location QtCore`"
if test -n "${QT_MOC}"; then
@ -145,7 +145,7 @@ if test -z "${QT_VERSION}"; then
QT_MOC="${_QT_HOST_BINS}/moc"
QT_UIC="${_QT_HOST_BINS}/uic"
FRAMEDIR=${_QTDIR}/lib
QT_LIBS=" -framework QtGui -framework QtCore -framework QtWidgets -Xlinker -rpath -Xlinker ${FRAMEDIR}"
QT_LIBS=" -framework QtGui -framework QtCore -framework QtWidgets -framework QtSql -Xlinker -rpath -Xlinker ${FRAMEDIR}"
QT_CFLAGS="-std=c++11 -F${FRAMEDIR} -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtGui.framework/Headers -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtWidgets.framework/Headers -I${FRAMEDIR}/QtSql.framework/Headers"
fi
AC_MSG_WARN([Qt pkg-config failed, using fallback defaults (${QT_LIBS})]);

View File

@ -50,7 +50,7 @@ CROSS=$CROSS
CONSOLE=-mwindows
#CONSOLE=-mconsole
CPPFLAGS=-I\$(TOPDIR) -I\$(QTDIR)/include/QtGui -I\$(QTDIR)/include/QtCore -I\$(QTDIR)/include/QtWidgets -I\$(QTDIR)/include -I\$(INSTALL_DIR)/include -I\$(BUILD) -I\$(BUILD)/ui
CPPFLAGS=-I\$(TOPDIR) -I\$(QTDIR)/include/QtGui -I\$(QTDIR)/include/QtCore -I\$(QTDIR)/include/QtWidgets -I\$(QTDIR)/include/QtSql -I\$(QTDIR)/include -I\$(INSTALL_DIR)/include -I\$(BUILD) -I\$(BUILD)/ui
CFLAGS=-Wall -g -O2 -mthreads \$(CONSOLE) -mnop-fun-dllimport -Wno-strict-aliasing -std=c++11
LDFLAGS= -L\$(QTDIR)/lib -L\$(INSTALL_DIR)/lib \
@ -59,7 +59,7 @@ LDFLAGS= -L\$(QTDIR)/lib -L\$(INSTALL_DIR)/lib \
-static-libgcc -static-libstdc++
# list of dynamic libraries
LIBS=-lQt5Gui -lQt5Core -lQt5Widgets -lcrypto -lltdl
LIBS=-lQt5Gui -lQt5Core -lQt5Widgets -lQt5Sql -lcrypto -lltdl
# As long as the linux uic and moc are version compatible to the W32 ones
# we use the native tools, because they are much faster than the wine's

View File

@ -172,7 +172,7 @@ class pki_base : public QObject
}
QString i2d_b64()
{
return QString::fromAscii(i2d().toBase64());
return QString::fromLatin1(i2d().toBase64());
}
virtual QByteArray i2d();
virtual bool compare(pki_base *);

View File

@ -27,7 +27,7 @@ class pki_evp: public pki_key
QByteArray getEncKey() const;
QString encKey_b64()
{
return QString::fromAscii(encKey.toBase64());
return QString::fromLatin1(encKey.toBase64());
}
static QString _sha512passwd(QByteArray pass, QString salt,
int size, int repeat);

View File

@ -77,7 +77,7 @@ class pki_temp: public pki_x509name
QByteArray toData();
QString toB64Data()
{
return QString::fromAscii(toData().toBase64());
return QString::fromLatin1(toData().toBase64());
}
bool compare(pki_base *ref);
void writeTemp(QString fname);

View File

@ -33,7 +33,7 @@ QSqlError MainWindow::initSqlDB()
* Collisions are of course possible.
*
* All binaries are stored Base64 encoded in a column of type
* "B64_BLOB" It is defined here as "VARCHAR(10000)"
* " B64_BLOB " It is defined here as "VARCHAR(10000)"
*/
#define B64_BLOB "VARCHAR(10000)"
@ -71,7 +71,7 @@ QSqlError MainWindow::initSqlDB()
"name VARCHAR(128), " /* Internal name of the item */
"type INTEGER, " /* enum pki_type */
"source INTEGER, " /* enum pki_source */
"date "DB_DATE", " /* Time of insertion (creation/import) */
"date " DB_DATE ", " /* Time of insertion (creation/import) */
"comment VARCHAR(2048))"
/*
@ -83,7 +83,7 @@ QSqlError MainWindow::initSqlDB()
"type CHAR(4), " /* RSA DSA EC (as text) */
"hash INTEGER, " /* 32 bit hash */
"len INTEGER, " /* key size in bits */
"public "B64_BLOB", " /* B64(DER(public key)) */
"public " B64_BLOB ", " /* B64(DER(public key)) */
"FOREIGN KEY (item) REFERENCES items (id))"
/*
@ -93,7 +93,7 @@ QSqlError MainWindow::initSqlDB()
<< "CREATE TABLE private_keys ("
"item INTEGER, " /* reference to items(id) */
"ownPass INTEGER, " /* Encrypted by DB pwd or own pwd */
"private "B64_BLOB", " /* B64(Encrypt(DER(private key))) */
"private " B64_BLOB ", " /* B64(Encrypt(DER(private key))) */
"FOREIGN KEY (item) REFERENCES items (id))"
/*
@ -143,7 +143,7 @@ QSqlError MainWindow::initSqlDB()
"item INTEGER, " /* reference to items(id) */
"hash INTEGER, " /* 32 bit hash of the request */
"signed INTEGER, " /* Whether it was once signed. */
"request "B64_BLOB", " /* B64(DER(PKCS#10 request)) */
"request " B64_BLOB ", " /* B64(DER(PKCS#10 request)) */
"FOREIGN KEY (item) REFERENCES items (id)) "
/*
@ -160,7 +160,7 @@ QSqlError MainWindow::initSqlDB()
"serial VARCHAR(64), " /* Serial number of the certificate */
"issuer INTEGER, " /* The items(id) of the issuer or NULL */
"ca INTEGER, " /* CA: yes / no from BasicConstraints */
"cert "B64_BLOB", " /* B64(DER(certificate)) */
"cert " B64_BLOB ", " /* B64(DER(certificate)) */
"FOREIGN KEY (item) REFERENCES items (id), "
"FOREIGN KEY (issuer) REFERENCES items (id)) "
@ -170,7 +170,7 @@ QSqlError MainWindow::initSqlDB()
<< "CREATE TABLE authority ("
"item INTEGER, " /* reference to items(id) */
"template INTEGER, " /* reference to items(id) of the default template*/
"crlExpire "DB_DATE", " /* CRL expiry date */
"crlExpire " DB_DATE ", " /* CRL expiry date */
"crlNo INTEGER, " /* Last CRL Number */
"crlDays INTEGER, " /* CRL days until renewal */
"dnPolicy VARCHAR(1024), " /* DistinguishedName policy */
@ -186,7 +186,7 @@ QSqlError MainWindow::initSqlDB()
"num INTEGER, " /* Number of revoked certificates */
"iss_hash INTEGER, " /* 32 bit hash of the issuer DN */
"issuer INTEGER, " /* The items(id) of the issuer or NULL */
"crl "B64_BLOB", " /* B64(DER(revocation list)) */
"crl " B64_BLOB ", " /* B64(DER(revocation list)) */
"FOREIGN KEY (item) REFERENCES items (id), "
"FOREIGN KEY (issuer) REFERENCES items (id)) "
@ -197,8 +197,8 @@ QSqlError MainWindow::initSqlDB()
<< "CREATE TABLE revocations ("
"caId INTEGER, " /* reference to certs(item) */
"serial VARCHAR(64), " /* Serial number of the revoked certificate */
"date "DB_DATE", " /* Time of creating the revocation */
"invaldate "DB_DATE", " /* Time of invalidation */
"date " DB_DATE ", " /* Time of creating the revocation */
"invaldate " DB_DATE ", " /* Time of invalidation */
"crlNo INTEGER, " /* Crl Number of CRL of first appearance */
"reasonBit INTEGER, " /* Bit number of the revocation reason */
"FOREIGN KEY (caId) REFERENCES items (id))"
@ -209,7 +209,7 @@ QSqlError MainWindow::initSqlDB()
<< "CREATE TABLE templates ("
"item INTEGER, " /* reference to items(id) */
"version INTEGER, " /* Version of the template format */
"template "B64_BLOB", " /* The base64 encoded template */
"template " B64_BLOB ", " /* The base64 encoded template */
"FOREIGN KEY (item) REFERENCES items (id))"
;

View File

@ -404,7 +404,6 @@ void NewX509::defineRequest(pki_x509req *req)
/* Preset all values from another request to create a similar one */
void NewX509::fromX509super(pki_x509super *cert_or_req, bool applyTemp)
void NewX509::fromX509super(pki_x509super *cert_or_req)
{
pki_temp *temp = new pki_temp("");
temp->fromCert(cert_or_req);
@ -451,21 +450,6 @@ pki_temp *NewX509::caTemplate(pki_x509 *ca) const
return (pki_temp*)MainWindow::temps->lookupPki(sqlId);
}
/* Preset all values from another cert to create a aimilar one */
void NewX509::defineCert(pki_x509 *cert)
{
fromX509super(cert);
pki_x509 *signer = cert->getSigner();
if (signer == cert) {
foreignSignRB->setChecked(false);
} else if (signer) {
defineSigner(signer);
}
notBefore->setDate(cert->getNotBefore());
notAfter->setDate(cert->getNotAfter());
}
/* Preset the signing certificate */
void NewX509::defineSigner(pki_x509 *defcert, bool applyTemp)
{
@ -474,7 +458,9 @@ void NewX509::defineSigner(pki_x509 *defcert, bool applyTemp)
if (certList->setCurrentPkiItem(defcert) != -1) {
foreignSignRB->setChecked(true);
certList->setEnabled(true);
if (applyTemp && defcert->getTemplate()) {
if (applyTemp &&
defcert->getTemplateSqlId().isValid())
{
on_applyTemplate_clicked();
}
}