Mercurial > trustbridge
changeset 81:112228bd7e4b
Remove platform specific certificate immplementations.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 19 Mar 2014 16:50:59 +0000 |
parents | 01286d0872ca |
children | 1f27d6db5ee3 |
files | ui/CMakeLists.txt ui/certificate.cpp ui/certificate_linux.cpp ui/certificate_win.cpp |
diffstat | 4 files changed, 6 insertions(+), 71 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/CMakeLists.txt Wed Mar 19 16:36:34 2014 +0000 +++ b/ui/CMakeLists.txt Wed Mar 19 16:50:59 2014 +0000 @@ -7,8 +7,6 @@ set(CERTIFICATELIST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/certificatelist.cpp ${CMAKE_CURRENT_SOURCE_DIR}/certificate.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/certificate_win.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/certificate_linux.cpp ${CMAKE_SOURCE_DIR}/common/listutil.c )
--- a/ui/certificate.cpp Wed Mar 19 16:36:34 2014 +0000 +++ b/ui/certificate.cpp Wed Mar 19 16:50:59 2014 +0000 @@ -4,3 +4,9 @@ const QString& Certificate::shortDescription() const { return mShortDescription; } +Certificate::Certificate(const QByteArray& asn1data) : + mValid(false), + mShortDescription(QObject::tr("Invalid Certificate")) +{ + +}
--- a/ui/certificate_linux.cpp Wed Mar 19 16:36:34 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#include "certificate.h" -#ifdef Q_OS_LINUX -Certificate::Certificate(const QByteArray& asn1data) : mValid(false) { -} - -Certificate::~Certificate() { -} -#endif
--- a/ui/certificate_win.cpp Wed Mar 19 16:36:34 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -#include "certificate.h" - -#ifdef Q_OS_WIN - -#include <QDebug> - -Certificate::Certificate(const QByteArray& asn1data) : - mValid(false), - mShortDescription(QObject::tr("Invalid Certificate")) -{ - - // asn1data is expected to be \0 terminated as this is what - // qt does in ::fromBase64 so the actual asn1data is - // size() - 1 and not size() - Q_ASSERT (asn1data[asn1data.size()] == '\0'); - DWORD sizeOfName = 0; - - DWORD sizeOfCert = asn1data.size() - 1; - - mPCertContext = CertCreateCertificateContext(X509_ASN_ENCODING, - (const BYTE *) asn1data.constData(), sizeOfCert); - - if (!mPCertContext) { - qDebug() << "Error creating certificate context. Err: " << - GetLastError(); - return; - } - - sizeOfName = CertGetNameStringW(mPCertContext, - CERT_NAME_FRIENDLY_DISPLAY_TYPE, - 0, - NULL, - NULL, - 0); - - if (sizeOfName <= 1) { - // Probably some fallbacks would be nice here? Let's see if this - // is a problem in testing. - qDebug() << "Failed to get friendly name. Don't know what to do!"; - } else { - WCHAR certName[sizeOfName]; - DWORD actSize = CertGetNameStringW(mPCertContext, - CERT_NAME_FRIENDLY_DISPLAY_TYPE, - 0, - NULL, - certName, - sizeOfName); - Q_ASSERT (actSize == sizeOfName); - - mShortDescription = QString::fromWCharArray(certName, sizeOfName); - } - -} - -Certificate::~Certificate() { - if (mPCertContext) { - CertFreeCertificateContext(mPCertContext); - } -} - -#endif