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
QSslCertificateExtension Class Reference

The QSslCertificateExtension class provides an API for accessing the extensions of an X509 certificate. More...

#include <qsslcertificateextension.h>

+ Collaboration diagram for QSslCertificateExtension:

Public Member Functions

 QSslCertificateExtension ()
 Constructs a QSslCertificateExtension.
 
 QSslCertificateExtension (const QSslCertificateExtension &other)
 Constructs a copy of other.
 
QSslCertificateExtensionoperator= (QSslCertificateExtension &&other) noexcept
 
QSslCertificateExtensionoperator= (const QSslCertificateExtension &other)
 Assigns other to this extension and returns a reference to this extension.
 
 ~QSslCertificateExtension ()
 Destroys the extension.
 
void swap (QSslCertificateExtension &other) noexcept
 Swaps this certificate extension instance with other.
 
QString oid () const
 Returns the ASN.1 OID of this extension.
 
QString name () const
 Returns the name of the extension.
 
QVariant value () const
 Returns the value of the extension.
 
bool isCritical () const
 Returns the criticality of the extension.
 
bool isSupported () const
 Returns the true if this extension is supported.
 

Friends

class QSslCertificatePrivate
 

Detailed Description

The QSslCertificateExtension class provides an API for accessing the extensions of an X509 certificate.

Since
5.0

\reentrant

\inmodule QtNetwork

QSslCertificateExtension provides access to an extension stored in an X509 certificate. The information available depends on the type of extension being accessed.

All X509 certificate extensions have the following properties:

\table \header

  • Property
  • Description \row
  • name
  • The human readable name of the extension, eg. 'basicConstraints'. \row
  • criticality
  • This is a boolean value indicating if the extension is critical to correctly interpreting the certificate. \row
  • oid
  • The ASN.1 object identifier that specifies which extension this is. \row
  • supported
  • If this is true the structure of the extension's value will not change between Qt versions. \row
  • value
  • A QVariant with a structure dependent on the type of extension. \endtable

Whilst this class provides access to any type of extension, only some are guaranteed to be returned in a format that will remain unchanged between releases. The isSupported() method returns true for extensions where this is the case.

The extensions currently supported, and the structure of the value returned are as follows:

\table \header

  • Name
  • OID
  • Details \row
  • basicConstraints
  • 2.5.29.19
  • Returned as a QVariantMap. The key 'ca' contains a boolean value, the optional key 'pathLenConstraint' contains an integer. \row
  • authorityInfoAccess
  • 1.3.6.1.5.5.7.1.1
  • Returned as a QVariantMap. There is a key for each access method, with the value being a URI. \row
  • subjectKeyIdentifier
  • 2.5.29.14
  • Returned as a QVariant containing a QString. The string is the key identifier. \row
  • authorityKeyIdentifier
  • 2.5.29.35
  • Returned as a QVariantMap. The optional key 'keyid' contains the key identifier as a hex string stored in a QByteArray. The optional key 'serial' contains the authority key serial number as a qlonglong. Currently there is no support for the general names field of this extension. \endtable

In addition to the supported extensions above, many other common extensions will be returned in a reasonably structured way. Extensions that the SSL backend has no support for at all will be returned as a QByteArray.

Further information about the types of extensions certificates can contain can be found in RFC 5280.

See also
QSslCertificate::extensions()

Definition at line 17 of file qsslcertificateextension.h.

Constructor & Destructor Documentation

◆ QSslCertificateExtension() [1/2]

QT_BEGIN_NAMESPACE QSslCertificateExtension::QSslCertificateExtension ( )

Constructs a QSslCertificateExtension.

Definition at line 102 of file qsslcertificateextension.cpp.

◆ QSslCertificateExtension() [2/2]

QSslCertificateExtension::QSslCertificateExtension ( const QSslCertificateExtension & other)

Constructs a copy of other.

Definition at line 110 of file qsslcertificateextension.cpp.

◆ ~QSslCertificateExtension()

QSslCertificateExtension::~QSslCertificateExtension ( )

Destroys the extension.

Definition at line 118 of file qsslcertificateextension.cpp.

Member Function Documentation

◆ isCritical()

bool QSslCertificateExtension::isCritical ( ) const

Returns the criticality of the extension.

Definition at line 167 of file qsslcertificateextension.cpp.

References QSslCertificateExtensionPrivate::critical.

◆ isSupported()

bool QSslCertificateExtension::isSupported ( ) const

Returns the true if this extension is supported.

In this case, supported simply means that the structure of the QVariant returned by the value() accessor will remain unchanged between versions. Unsupported extensions can be freely used, however there is no guarantee that the returned data will have the same structure between versions.

Definition at line 180 of file qsslcertificateextension.cpp.

References QSslCertificateExtensionPrivate::supported.

◆ name()

QString QSslCertificateExtension::name ( ) const

Returns the name of the extension.

If no name is known for the extension then the OID will be returned.

Definition at line 150 of file qsslcertificateextension.cpp.

References QSslCertificateExtensionPrivate::name.

◆ oid()

QString QSslCertificateExtension::oid ( ) const

Returns the ASN.1 OID of this extension.

Definition at line 141 of file qsslcertificateextension.cpp.

References QSslCertificateExtensionPrivate::oid.

◆ operator=() [1/2]

QSslCertificateExtension & QSslCertificateExtension::operator= ( const QSslCertificateExtension & other)

Assigns other to this extension and returns a reference to this extension.

Definition at line 125 of file qsslcertificateextension.cpp.

References other().

+ Here is the call graph for this function:

◆ operator=() [2/2]

QSslCertificateExtension & QSslCertificateExtension::operator= ( QSslCertificateExtension && other)
inlinenoexcept

Definition at line 22 of file qsslcertificateextension.h.

References other(), and swap().

+ Here is the call graph for this function:

◆ swap()

void QSslCertificateExtension::swap ( QSslCertificateExtension & other)
inlinenoexcept

Swaps this certificate extension instance with other.

This function is very fast and never fails.

Definition at line 26 of file qsslcertificateextension.h.

References d, and other().

+ Here is the call graph for this function:

◆ value()

QVariant QSslCertificateExtension::value ( ) const

Returns the value of the extension.

The structure of the value returned depends on the extension type.

Definition at line 159 of file qsslcertificateextension.cpp.

References QSslCertificateExtensionPrivate::value.

Friends And Related Symbol Documentation

◆ QSslCertificatePrivate

friend class QSslCertificatePrivate
friend

Definition at line 36 of file qsslcertificateextension.h.


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