CopperSpice API  1.9.0
QSslCertificateExtension Class Reference

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

Public Methods

 QSslCertificateExtension ()
 QSslCertificateExtension (const QSslCertificateExtension &other)
 ~QSslCertificateExtension ()
bool isCritical () const
bool isSupported () const
QString name () const
QString oid () const
QSslCertificateExtension & operator= (const QSslCertificateExtension &other)
QSslCertificateExtension & operator= (QSslCertificateExtension &&other)
void swap (QSslCertificateExtension &other)
QVariant value () const

Detailed Description

The QSslCertificateExtension class provides an API for accessing the extensions of an X509 certificate. The class provides access to an extension stored in an X509 certificate. The information depends on the type of extension being accessed.

All X509 certificate extensions have the following properties:

name Human readable name of the extension, eg. 'basicConstraints'
criticality Boolean value indicating if the extension is critical to correctly interpreting the certificate
oid ASN.1 object identifier specifying which extension this is
supported If true then the structure of the extension's value will not change between CopperSpice versions
value QVariant with a structure dependent on the type of extension

While 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:

basicConstraint Returns a QVariantMap. The key 'ca' contains a boolean value, the optional key 'pathLenConstraint' contains an integer.
authorityInfoAccess Returns a QVariantMap. There is a key for each access method, with the value being a URI.
subjectKeyIdentifier Returns a QVariant containing a QString. The string is the key identifier.
authorityKeyIdentifier Returns 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 qint64. Currently there is no support for the general names field of this extension.

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

Constructor & Destructor Documentation

QSslCertificateExtension::QSslCertificateExtension ( )

Constructs a QSslCertificateExtension.

QSslCertificateExtension::QSslCertificateExtension ( const QSslCertificateExtension &  other)

Copy constructs from other.

QSslCertificateExtension::~QSslCertificateExtension ( )

Destroys the extension.

Method Documentation

bool QSslCertificateExtension::isCritical ( ) const

Returns the criticality of the extension.

bool QSslCertificateExtension::isSupported ( ) const

Returns 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 the returned data will have the same structure between versions.

QString QSslCertificateExtension::name ( ) const

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

QString QSslCertificateExtension::oid ( ) const

Returns the ASN.1 OID of this extension.

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

Copy assigns from other and returns a reference to this object.

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

Move assigns from other and returns a reference to this object.

void QSslCertificateExtension::swap ( QSslCertificateExtension &  other)

Swaps this certificate extension instance with other. This method is very fast and never fails.

QVariant QSslCertificateExtension::value ( ) const

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