Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QTlsPrivate::X509CertificateOpenSSL Class Referencefinal

#include <qx509_openssl_p.h>

+ Inheritance diagram for QTlsPrivate::X509CertificateOpenSSL:
+ Collaboration diagram for QTlsPrivate::X509CertificateOpenSSL:

Public Member Functions

 X509CertificateOpenSSL ()
 
 ~X509CertificateOpenSSL ()
 
bool isEqual (const X509Certificate &rhs) const override
 
bool isSelfSigned () const override
 
QMultiMap< QSsl::AlternativeNameEntryType, QStringsubjectAlternativeNames () const override
 
TlsKeypublicKey () const override
 
QByteArray toPem () const override
 
QByteArray toDer () const override
 
QString toText () const override
 
Qt::HANDLE handle () const override
 
size_t hash (size_t seed) const noexcept override
 
- Public Member Functions inherited from QTlsPrivate::X509CertificateBase
bool isNull () const override
 
QByteArray version () const override
 
QByteArray serialNumber () const override
 
QStringList issuerInfo (QSslCertificate::SubjectInfo info) const override
 
QStringList issuerInfo (const QByteArray &attribute) const override
 
QStringList subjectInfo (QSslCertificate::SubjectInfo info) const override
 
QStringList subjectInfo (const QByteArray &attribute) const override
 
QList< QByteArraysubjectInfoAttributes () const override
 
QList< QByteArrayissuerInfoAttributes () const override
 
QDateTime effectiveDate () const override
 
QDateTime expiryDate () const override
 
qsizetype numberOfExtensions () const override
 
QString oidForExtension (qsizetype index) const override
 
QString nameForExtension (qsizetype index) const override
 
QVariant valueForExtension (qsizetype index) const override
 
bool isExtensionCritical (qsizetype index) const override
 
bool isExtensionSupported (qsizetype index) const override
 
- Public Member Functions inherited from QTlsPrivate::X509Certificate
virtual ~X509Certificate ()
 

Static Public Member Functions

static QSslCertificate certificateFromX509 (X509 *x)
 
static QList< QSslCertificatestackOfX509ToQSslCertificates (STACK_OF(X509) *x509)
 
static QSslErrorEntry errorEntryFromStoreContext (X509_STORE_CTX *ctx)
 
static QList< QSslErrorverify (const QList< QSslCertificate > &chain, const QString &hostName)
 
static QList< QSslErrorverify (const QList< QSslCertificate > &caCertificates, const QList< QSslCertificate > &certificateChain, const QString &hostName)
 
static QList< QSslCertificatecertificatesFromPem (const QByteArray &pem, int count)
 
static QList< QSslCertificatecertificatesFromDer (const QByteArray &der, int count)
 
static bool importPkcs12 (QIODevice *device, QSslKey *key, QSslCertificate *cert, QList< QSslCertificate > *caCertificates, const QByteArray &passPhrase)
 
static QSslError openSSLErrorToQSslError (int errorCode, const QSslCertificate &cert)
 
- Static Public Member Functions inherited from QTlsPrivate::X509CertificateBase
static QByteArray subjectInfoToString (QSslCertificate::SubjectInfo info)
 
static bool matchLineFeed (const QByteArray &pem, int *offset)
 

Additional Inherited Members

- Protected Member Functions inherited from QTlsPrivate::X509CertificateBase
bool validIndex (qsizetype index) const
 
- Protected Attributes inherited from QTlsPrivate::X509CertificateBase
bool null = true
 
QByteArray versionString
 
QByteArray serialNumberString
 
QMultiMap< QByteArray, QStringissuerInfoEntries
 
QMultiMap< QByteArray, QStringsubjectInfoEntries
 
QDateTime notValidAfter
 
QDateTime notValidBefore
 
QList< X509CertificateExtensionextensions
 

Detailed Description

Definition at line 36 of file qx509_openssl_p.h.

Constructor & Destructor Documentation

◆ X509CertificateOpenSSL()

QTlsPrivate::X509CertificateOpenSSL::X509CertificateOpenSSL ( )
default

◆ ~X509CertificateOpenSSL()

QTlsPrivate::X509CertificateOpenSSL::~X509CertificateOpenSSL ( )

Definition at line 399 of file qx509_openssl.cpp.

References q_X509_free().

+ Here is the call graph for this function:

Member Function Documentation

◆ certificateFromX509()

QSslCertificate QTlsPrivate::X509CertificateOpenSSL::certificateFromX509 ( X509 * x)
static

Definition at line 539 of file qx509_openssl.cpp.

References QByteArray::data(), QByteArray::length(), QByteArray::number(), q_X509_dup(), q_X509_get_issuer_name(), q_X509_get_serialNumber(), q_X509_get_subject_name(), q_X509_get_version(), q_X509_getm_notAfter(), q_X509_getm_notBefore(), QByteArray::reserve(), and QTlsPrivate::X509CertificateBase::serialNumber().

Referenced by certificatesFromDer(), certificatesFromPem(), QTlsPrivate::TlsCryptographOpenSSL::emitErrorFromCallback(), importPkcs12(), stackOfX509ToQSslCertificates(), QTlsPrivate::TlsCryptographOpenSSL::storePeerCertificates(), and QTlsPrivate::TlsCryptographOpenSSL::transmit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ certificatesFromDer()

QList< QSslCertificate > QTlsPrivate::X509CertificateOpenSSL::certificatesFromDer ( const QByteArray & der,
int count )
static

Definition at line 754 of file qx509_openssl.cpp.

References certificateFromX509(), q_d2i_X509(), and q_X509_free().

Referenced by QTlsBackendOpenSSL::X509DerReader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ certificatesFromPem()

QList< QSslCertificate > QTlsPrivate::X509CertificateOpenSSL::certificatesFromPem ( const QByteArray & pem,
int count )
static

Definition at line 720 of file qx509_openssl.cpp.

References BEGINCERTSTRING, certificateFromX509(), QByteArray::data(), ENDCERTSTRING, QByteArray::fromBase64(), QByteArray::fromRawData(), QTlsPrivate::X509CertificateBase::matchLineFeed(), q_d2i_X509(), q_X509_free(), and QByteArray::size().

Referenced by QTlsBackendOpenSSL::X509PemReader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ errorEntryFromStoreContext()

QSslErrorEntry QTlsPrivate::X509CertificateOpenSSL::errorEntryFromStoreContext ( X509_STORE_CTX * ctx)
static

Definition at line 592 of file qx509_openssl.cpp.

References Q_ASSERT, q_X509_STORE_CTX_get_error(), and q_X509_STORE_CTX_get_error_depth().

Referenced by QTlsPrivate::TlsCryptographOpenSSL::emitErrorFromCallback(), QTlsPrivate::q_X509Callback(), dtlscallbacks::q_X509DtlsCallback(), and QTlsPrivate::qt_X509Callback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handle()

Qt::HANDLE QTlsPrivate::X509CertificateOpenSSL::handle ( ) const
overridevirtual

This function is expected to return a pointer to the native certificate handle, if there is one, else nullptr.

Implements QTlsPrivate::X509Certificate.

Definition at line 521 of file qx509_openssl.cpp.

Referenced by verify().

+ Here is the caller graph for this function:

◆ hash()

size_t QTlsPrivate::X509CertificateOpenSSL::hash ( size_t seed) const
overridevirtualnoexcept

This function is expected to return the hash value for this certificate, using seed to seed the calculation.

Implements QTlsPrivate::X509Certificate.

Definition at line 526 of file qx509_openssl.cpp.

References q_EVP_sha1(), q_X509_digest(), qHashBits(), and seed.

+ Here is the call graph for this function:

◆ importPkcs12()

bool QTlsPrivate::X509CertificateOpenSSL::importPkcs12 ( QIODevice * device,
QSslKey * key,
QSslCertificate * cert,
QList< QSslCertificate > * caCertificates,
const QByteArray & passPhrase )
static

Definition at line 774 of file qx509_openssl.cpp.

References cert, certificateFromX509(), device, Q_ASSERT, q_BIO_free(), q_BIO_new_mem_buf(), q_d2i_PKCS12_bio(), q_ERR_error_string(), q_ERR_get_error(), q_EVP_PKEY_free(), q_OPENSSL_sk_pop_free(), q_PKCS12_free(), q_PKCS12_parse(), q_X509_free(), qCWarning, qScopeGuard(), STACK_OF(), and stackOfX509ToQSslCertificates().

Referenced by QTlsBackendOpenSSL::X509Pkcs12Reader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEqual()

bool QTlsPrivate::X509CertificateOpenSSL::isEqual ( const X509Certificate & other) const
overridevirtual

This function is expected to return true if this certificate is the same as the other, false otherwise. Used by QSslCertificate's comparison operators.

Implements QTlsPrivate::X509Certificate.

Definition at line 405 of file qx509_openssl.cpp.

References QTlsBackendOpenSSL::logAndClearErrorQueue(), other(), q_X509_cmp(), and ret.

+ Here is the call graph for this function:

◆ isSelfSigned()

bool QTlsPrivate::X509CertificateOpenSSL::isSelfSigned ( ) const
overridevirtual

This function is needed to implement QSslCertificate::isSelfSigned()

See also
QSslCertificate::isSelfSigned()

Implements QTlsPrivate::X509Certificate.

Definition at line 419 of file qx509_openssl.cpp.

References q_X509_check_issued().

+ Here is the call graph for this function:

◆ openSSLErrorToQSslError()

◆ publicKey()

TlsKey * QTlsPrivate::X509CertificateOpenSSL::publicKey ( ) const
overridevirtual

Returns the certificate subject's public key.

Reimplemented from QTlsPrivate::X509Certificate.

Definition at line 489 of file qx509_openssl.cpp.

References QTlsPrivate::TlsKeyOpenSSL::publicKeyFromX509().

+ Here is the call graph for this function:

◆ stackOfX509ToQSslCertificates()

QList< QSslCertificate > QTlsPrivate::X509CertificateOpenSSL::stackOfX509ToQSslCertificates ( STACK_OF(X509) * x509)
static

Definition at line 578 of file qx509_openssl.cpp.

References certificateFromX509(), i, q_sk_X509_num, and q_sk_X509_value.

Referenced by importPkcs12(), and QTlsPrivate::TlsCryptographOpenSSL::storePeerCertificates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ subjectAlternativeNames()

QMultiMap< QSsl::AlternativeNameEntryType, QString > QTlsPrivate::X509CertificateOpenSSL::subjectAlternativeNames ( ) const
overridevirtual

This function is expected to return the list of alternative subject names for this certificate. The alternative names typically contain host names, optionally with wildcards, that are valid for this certificate.

See also
subjectInfo()

Implements QTlsPrivate::X509Certificate.

Definition at line 428 of file qx509_openssl.cpp.

References QSsl::DnsEntry, QSsl::EmailEntry, QString::fromLatin1(), i, QSsl::IpAddressEntry, q_ASN1_STRING_get0_data(), q_ASN1_STRING_length(), q_GENERAL_NAME_free(), q_OPENSSL_sk_pop_free(), q_sk_GENERAL_NAME_num, q_sk_GENERAL_NAME_value, q_X509_get_ext_d2i(), qFromBigEndian(), and STACK_OF().

+ Here is the call graph for this function:

◆ toDer()

QByteArray QTlsPrivate::X509CertificateOpenSSL::toDer ( ) const
overridevirtual

This function is expected to return this certificate converted to a DER (binary) encoded representation.

Implements QTlsPrivate::X509Certificate.

Definition at line 505 of file qx509_openssl.cpp.

References QSsl::Der.

◆ toPem()

QByteArray QTlsPrivate::X509CertificateOpenSSL::toPem ( ) const
overridevirtual

This function is expected to return this certificate converted to a PEM (Base64) encoded representation.

Implements QTlsPrivate::X509Certificate.

Definition at line 497 of file qx509_openssl.cpp.

References QSsl::Pem.

◆ toText()

QString QTlsPrivate::X509CertificateOpenSSL::toText ( ) const
overridevirtual

This function is expected to return this certificate converted to a human-readable text representation.

Implements QTlsPrivate::X509Certificate.

Definition at line 513 of file qx509_openssl.cpp.

◆ verify() [1/2]

◆ verify() [2/2]

QList< QSslError > QTlsPrivate::X509CertificateOpenSSL::verify ( const QList< QSslCertificate > & chain,
const QString & hostName )
static

Definition at line 599 of file qx509_openssl.cpp.

References QSslConfiguration::defaultConfiguration(), QSslSocketPrivate::rootCertOnDemandLoadingSupported(), QSslSocketPrivate::systemCaCertificates(), and verify().

Referenced by verify(), and QTlsBackendOpenSSL::X509Verifier().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: