From 1a8788d966da9698b05c1e0bd271d83c5bca9992 Mon Sep 17 00:00:00 2001 From: "Richard J. Moore" Date: Mon, 12 May 2014 21:16:20 +0100 Subject: Move the PKCS#12 support from QSslSocket to QSslCertificate. Discussed with Peter and agreed that it's a slightly better fit there. Change-Id: If8db777336e2273670a23d75d8542b30c07e0d7b Reviewed-by: Daniel Molkentin Reviewed-by: Peter Hartmann --- src/network/ssl/qsslcertificate.cpp | 20 ++++++++++++++++++++ src/network/ssl/qsslcertificate.h | 5 +++++ src/network/ssl/qsslsocket.cpp | 20 -------------------- src/network/ssl/qsslsocket.h | 5 ----- 4 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/network/ssl') diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 316d2206be..11ea711f30 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -979,6 +979,26 @@ QList QSslCertificate::verify(QList certificateChain return QSslSocketBackendPrivate::verify(certificateChain, hostName); } +/*! + \since 5.4 + + Imports a PKCS#12 (pfx) file from the specified \a device. A PKCS#12 + file is a bundle that can contain a number of certificates and keys. + This method reads a single \a key, its \a certificate and any + associated \a caCertificates from the bundle. If a \a passPhrase is + specified then this will be used to decrypt the bundle. Returns + \c true if the PKCS#12 file was successfully loaded. + + \note The \a device must be open and ready to be read from. + */ +bool QSslCertificate::importPKCS12(QIODevice *device, + QSslKey *key, QSslCertificate *certificate, + QList *caCertificates, + const QByteArray &passPhrase) +{ + return QSslSocketBackendPrivate::importPKCS12(device, key, certificate, caCertificates, passPhrase); +} + void QSslCertificatePrivate::init(const QByteArray &data, QSsl::EncodingFormat format) { if (!data.isEmpty()) { diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h index 0ae491e8d5..2217eb7fb9 100644 --- a/src/network/ssl/qsslcertificate.h +++ b/src/network/ssl/qsslcertificate.h @@ -142,6 +142,11 @@ public: static QList verify(QList certificateChain, const QString &hostName = QString()); + static bool importPKCS12(QIODevice *device, + QSslKey *key, QSslCertificate *cert, + QList *caCertificates=0, + const QByteArray &passPhrase=QByteArray()); + Qt::HANDLE handle() const; private: diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 1c77fac769..04c0fb0487 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1455,26 +1455,6 @@ QList QSslSocket::systemCaCertificates() return QSslSocketPrivate::systemCaCertificates(); } -/*! - \since 5.4 - - Imports a PKCS#12 (pfx) file from the specified \a device. A PKCS#12 - file is a bundle that can contain a number of certificates and keys. - This method reads a single \a key, it's \a certificate and any - associated \a caCertificates from the bundle. If a \a passPhrase is - specified then this will be used to decrypt the bundle. Returns - \c true if the PKCS#12 file was successfully loaded. - - \note The \a device must be open and ready to be read from. - */ -bool QSslSocket::importPKCS12(QIODevice *device, - QSslKey *key, QSslCertificate *certificate, - QList *caCertificates, - const QByteArray &passPhrase) -{ - return QSslSocketBackendPrivate::importPKCS12(device, key, certificate, caCertificates, passPhrase); -} - /*! Waits until the socket is connected, or \a msecs milliseconds, whichever happens first. If the connection has been established, diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index a0c9002529..9cc5e02de3 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -172,11 +172,6 @@ public: static QList defaultCaCertificates(); static QList systemCaCertificates(); - static bool importPKCS12(QIODevice *device, - QSslKey *key, QSslCertificate *cert, - QList *caCertificates=0, - const QByteArray &passPhrase=QByteArray()); - bool waitForConnected(int msecs = 30000); bool waitForEncrypted(int msecs = 30000); bool waitForReadyRead(int msecs = 30000); -- cgit v1.2.3