diff options
Diffstat (limited to 'src/network/ssl/qsslconfiguration.cpp')
-rw-r--r-- | src/network/ssl/qsslconfiguration.cpp | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index 0ae67b3c1f..afbd4fac77 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -173,7 +173,7 @@ bool QSslConfiguration::operator==(const QSslConfiguration &other) const return true; return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && - d->localCertificate == other.d->localCertificate && + d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->sessionCipher && d->ciphers == other.d->ciphers && @@ -212,7 +212,7 @@ bool QSslConfiguration::isNull() const d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && - d->localCertificate.isNull() && + d->localCertificateChain.isEmpty() && d->privateKey.isNull() && d->peerCertificate.isNull() && d->peerCertificateChain.count() == 0 && @@ -313,6 +313,45 @@ void QSslConfiguration::setPeerVerifyDepth(int depth) } /*! + Returns the certificate chain to be presented to the peer during + the SSL handshake process. + + \sa localCertificate() + \since 5.1 +*/ +QList<QSslCertificate> QSslConfiguration::localCertificateChain() const +{ + return d->localCertificateChain; +} + +/*! + Sets the certificate chain to be presented to the peer during the + SSL handshake to be \a localChain. + + Setting the certificate chain once the connection has been + established has no effect. + + A certificate is the means of identification used in the SSL + process. The local certificate is used by the remote end to verify + the local user's identity against its list of Certification + Authorities. In most cases, such as in HTTP web browsing, only + servers identify to the clients, so the client does not send a + certificate. + + Unlike QSslConfiguration::setLocalCertificate() this method allows + you to specify any intermediate certificates required in order to + validate your certificate. The first item in the list must be the + leaf certificate. + + \sa localCertificateChain() + \since 5.1 + */ +void QSslConfiguration::setLocalCertificateChain(const QList<QSslCertificate> &localChain) +{ + d->localCertificateChain = localChain; +} + +/*! Returns the certificate to be presented to the peer during the SSL handshake process. @@ -320,7 +359,9 @@ void QSslConfiguration::setPeerVerifyDepth(int depth) */ QSslCertificate QSslConfiguration::localCertificate() const { - return d->localCertificate; + if (d->localCertificateChain.isEmpty()) + return QSslCertificate(); + return d->localCertificateChain[0]; } /*! @@ -341,7 +382,8 @@ QSslCertificate QSslConfiguration::localCertificate() const */ void QSslConfiguration::setLocalCertificate(const QSslCertificate &certificate) { - d->localCertificate = certificate; + d->localCertificateChain = QList<QSslCertificate>(); + d->localCertificateChain += certificate; } /*! @@ -584,4 +626,10 @@ void QSslConfiguration::setDefaultConfiguration(const QSslConfiguration &configu QSslConfigurationPrivate::setDefaultConfiguration(configuration); } +/*! \internal +*/ +bool QSslConfigurationPrivate::peerSessionWasShared(const QSslConfiguration &configuration) { + return configuration.d->peerSessionShared; + } + QT_END_NAMESPACE |