Mercurial > trustbridge
changeset 788:5ab7441dcda9
Remove dead code.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 14 Jul 2014 18:13:25 +0200 |
parents | 07cc0aabf782 |
children | 2e954efcb3f1 |
files | ui/certificate_win.h |
diffstat | 1 files changed, 0 insertions(+), 72 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/certificate_win.h Mon Jul 14 16:07:55 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik - * Software engineering by Intevation GmbH - * - * This file is Free Software under the GNU GPL (v>=2) - * and comes with ABSOLUTELY NO WARRANTY! - * See LICENSE.txt for details. - */ -#include "certificate.h" - -#ifdef Q_OS_WIN - -#include <QDebug> - -Certificate::Certificate(const QByteArray& asn1data) : mValid(false) { - - // 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(pCertContext, - 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(pCertContext, - CERT_NAME_FRIENDLY_DISPLAY_TYPE, - 0, - NULL, - certName, - sizeOfName); - Q_ASSERT (actSize == sizeOfName); - - mShortDescription = QString::fromWCharArray(certName, sizeOfName); - } - -} - -Certificate::~Certificate() { - if (mPCertContext) { - CertFreeCertificateContext(pCertContext); - } -} - -QString Certificate::shortDescription() { - if (!isValid()) { - return QString::fromLatin1(tr("Invalid Certificate")); - } - return mShortDescription; -} - -#endif