Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QTlsPrivate::TlsKeyBase Class Reference

#include <qtlskey_base_p.h>

Inheritance diagram for QTlsPrivate::TlsKeyBase:
Collaboration diagram for QTlsPrivate::TlsKeyBase:

Public Member Functions

 TlsKeyBase (KeyType type=QSsl::PublicKey, KeyAlgorithm algorithm=QSsl::Opaque)
bool isNull () const override
KeyType type () const override
KeyAlgorithm algorithm () const override
bool isPkcs8 () const override
QByteArray pemFromDer (const QByteArray &der, const QMap< QByteArray, QByteArray > &headers) const override
Public Member Functions inherited from QTlsPrivate::TlsKey
 TlsKey ()=default
virtual ~TlsKey ()
virtual void decodeDer (KeyType type, KeyAlgorithm algorithm, const QByteArray &der, const QByteArray &passPhrase, bool deepClear)=0
virtual void decodePem (KeyType type, KeyAlgorithm algorithm, const QByteArray &pem, const QByteArray &passPhrase, bool deepClear)=0
virtual QByteArray toPem (const QByteArray &passPhrase) const =0
virtual QByteArray derFromPem (const QByteArray &pem, QMap< QByteArray, QByteArray > *headers) const =0
virtual void fromHandle (Qt::HANDLE handle, KeyType type)=0
virtual Qt::HANDLE handle () const =0
virtual int length () const =0
virtual void clear (bool deepClear)=0
virtual QByteArray decrypt (Cipher cipher, const QByteArray &data, const QByteArray &passPhrase, const QByteArray &iv) const =0
virtual QByteArray encrypt (Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv) const =0
QByteArray pemHeader () const
QByteArray pemFooter () const

Static Protected Member Functions

static QByteArray pkcs8Header (bool encrypted)
static QByteArray pkcs8Footer (bool encrypted)
static bool isEncryptedPkcs8 (const QByteArray &der)

Protected Attributes

bool keyIsNull = true
KeyType keyType = QSsl::PublicKey
KeyAlgorithm keyAlgorithm = QSsl::Opaque

Additional Inherited Members

Public Types inherited from QTlsPrivate::TlsKey
using KeyType = QSsl::KeyType
using KeyAlgorithm = QSsl::KeyAlgorithm

Detailed Description

Definition at line 31 of file qtlskey_base_p.h.

Constructor & Destructor Documentation

◆ TlsKeyBase()

QTlsPrivate::TlsKeyBase::TlsKeyBase ( KeyType type = QSsl::PublicKey,
KeyAlgorithm algorithm = QSsl::Opaque )
inline

Definition at line 34 of file qtlskey_base_p.h.

References TlsKeyBase().

Referenced by TlsKeyBase().

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

Member Function Documentation

◆ algorithm()

KeyAlgorithm QTlsPrivate::TlsKeyBase::algorithm ( ) const
inlineoverridevirtual

Return this key's algorithm.

Implements QTlsPrivate::TlsKey.

Definition at line 48 of file qtlskey_base_p.h.

◆ isEncryptedPkcs8()

bool QTlsPrivate::TlsKeyBase::isEncryptedPkcs8 ( const QByteArray & der)
staticprotected

◆ isNull()

bool QTlsPrivate::TlsKeyBase::isNull ( ) const
inlineoverridevirtual

Returns true if this is a null key, false otherwise.

Note
A null key corresponds to the default-constructed QSslKey or the one, that was cleared via QSslKey::clear().
See also
QSslKey::isNull()

Implements QTlsPrivate::TlsKey.

Definition at line 40 of file qtlskey_base_p.h.

References keyIsNull.

◆ isPkcs8()

bool QTlsPrivate::TlsKeyBase::isPkcs8 ( ) const
inlineoverridevirtual

This function is internally used only by Qt's own TLS plugins and affects the way PEM file is generated by TlsKey. It's sufficient to override it and return false in case a new TLS backend is not using Qt's plugin as a base.

Implements QTlsPrivate::TlsKey.

Reimplemented in QTlsPrivate::TlsKeyGeneric.

Definition at line 52 of file qtlskey_base_p.h.

Referenced by pemFromDer().

Here is the caller graph for this function:

◆ pemFromDer()

QByteArray QTlsPrivate::TlsKeyBase::pemFromDer ( const QByteArray & der,
const QMap< QByteArray, QByteArray > & headers ) const
overridevirtual

If overridden, this function is expected to convert der, using headers, to PEM format.

Note
This function is very implementation-specific. As of now (Qt 6.1), it is only required by Qt's own non-OpenSSL backends, that internally use DER and implement QSslKey::toPem() via pemFromDer().

Implements QTlsPrivate::TlsKey.

Definition at line 12 of file qtlskey_base.cpp.

References isPkcs8().

Here is the call graph for this function:

◆ pkcs8Footer()

QByteArray QTlsPrivate::TlsKeyBase::pkcs8Footer ( bool encrypted)
staticprotected

Definition at line 56 of file qtlskey_base.cpp.

◆ pkcs8Header()

QByteArray QTlsPrivate::TlsKeyBase::pkcs8Header ( bool encrypted)
staticprotected

Definition at line 49 of file qtlskey_base.cpp.

◆ type()

KeyType QTlsPrivate::TlsKeyBase::type ( ) const
inlineoverridevirtual

Returns the type of this key (public or private).

Implements QTlsPrivate::TlsKey.

Definition at line 44 of file qtlskey_base_p.h.

Member Data Documentation

◆ keyAlgorithm

KeyAlgorithm QTlsPrivate::TlsKeyBase::keyAlgorithm = QSsl::Opaque
protected

Definition at line 66 of file qtlskey_base_p.h.

◆ keyIsNull

◆ keyType

KeyType QTlsPrivate::TlsKeyBase::keyType = QSsl::PublicKey
protected

Definition at line 65 of file qtlskey_base_p.h.


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