diff options
Diffstat (limited to 'src/network/ssl/qsslcertificate.cpp')
-rw-r--r-- | src/network/ssl/qsslcertificate.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 3b7fa4da09..11ea711f30 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -265,6 +265,22 @@ bool QSslCertificate::isBlacklisted() const } /*! + \since 5.4 + Returns \c true if this certificate is self signed; otherwise + returns \c false. + + A certificate is considered self-signed its issuer and subject + are identical. +*/ +bool QSslCertificate::isSelfSigned() const +{ + if (!d->x509) + return false; + + return (q_X509_check_issued(d->x509, d->x509) == X509_V_OK); +} + +/*! Clears the contents of this certificate, making it a null certificate. @@ -963,6 +979,26 @@ QList<QSslError> QSslCertificate::verify(QList<QSslCertificate> 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<QSslCertificate> *caCertificates, + const QByteArray &passPhrase) +{ + return QSslSocketBackendPrivate::importPKCS12(device, key, certificate, caCertificates, passPhrase); +} + void QSslCertificatePrivate::init(const QByteArray &data, QSsl::EncodingFormat format) { if (!data.isEmpty()) { |