From 50e8e9538511e3cdf837264f8d676be9899b2b07 Mon Sep 17 00:00:00 2001 From: "Richard J. Moore" Date: Sat, 10 May 2014 22:49:37 +0100 Subject: Add support for loading PKCS#12 bundles. Add support for loading certificates and keys from PKCS#12 bundles (also known as pfx files). Task-number: QTBUG-1565 [ChangeLog][QtNetwork][QSslSocket] Support for loading PKCS#12 bundles was added. These are often used to transport keys and certificates conveniently, particularly when making use of client certificates. Change-Id: Idaeb2cb4dac4b19881a5c99c7c0a7eea00c2b207 Reviewed-by: Daniel Molkentin --- src/network/ssl/qsslsocket.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/network/ssl/qsslsocket.cpp') diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 04c0fb0487..1c77fac769 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1455,6 +1455,26 @@ 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, -- cgit v1.2.3