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::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
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 30 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 33 of file qtlskey_base_p.h.

Member Function Documentation

◆ algorithm()

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

Return this key's algorithm.

Implements QTlsPrivate::TlsKey.

Definition at line 47 of file qtlskey_base_p.h.

References keyAlgorithm.

Referenced by QTlsPrivate::TlsKeyOpenSSL::clear(), QTlsPrivate::TlsKeyOpenSSL::decodeDer(), QTlsPrivate::TlsKeyGeneric::decodeDer(), QTlsPrivate::TlsKeyOpenSSL::decodePem(), QTlsPrivate::TlsKeyGeneric::decodePem(), QTlsPrivate::TlsKeyOpenSSL::length(), and QTlsPrivate::TlsKeyOpenSSL::toPem().

+ Here is the caller graph for this function:

◆ isEncryptedPkcs8()

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

Definition at line 62 of file qtlskey_base.cpp.

References items, QAsn1Element::ObjectIdentifierType, QAsn1Element::OctetStringType, PKCS12_OID, PKCS5_MD2_DES_CBC_OID, PKCS5_MD2_RC2_CBC_OID, PKCS5_MD5_DES_CBC_OID, PKCS5_MD5_RC2_CBC_OID, PKCS5_PBES2_ENCRYPTION_OID, PKCS5_SHA1_DES_CBC_OID, PKCS5_SHA1_RC2_CBC_OID, QAsn1Element::SequenceType, QList< T >::size(), and QList< T >::toList().

Referenced by pemFromDer().

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

◆ 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 39 of file qtlskey_base_p.h.

References keyIsNull.

Referenced by QTlsPrivate::TlsKeyOpenSSL::length(), and QTlsPrivate::TlsKeyOpenSSL::toPem().

+ Here is the caller graph for this function:

◆ 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 51 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 11 of file qtlskey_base.cpp.

References QByteArray::append(), i, isEncryptedPkcs8(), isPkcs8(), it, QTlsPrivate::TlsKey::pemFooter(), QTlsPrivate::TlsKey::pemHeader(), pkcs8Footer(), pkcs8Header(), and QByteArray::prepend().

Referenced by QTlsPrivate::TlsKeyOpenSSL::decodeDer(), and QTlsPrivate::TlsKeyGeneric::toPem().

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

◆ pkcs8Footer()

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

Definition at line 55 of file qtlskey_base.cpp.

References QByteArrayLiteral.

Referenced by QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), and pemFromDer().

+ Here is the caller graph for this function:

◆ pkcs8Header()

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

Definition at line 48 of file qtlskey_base.cpp.

References QByteArrayLiteral.

Referenced by QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), and pemFromDer().

+ Here is the caller graph for this function:

◆ type()

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

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

Implements QTlsPrivate::TlsKey.

Definition at line 43 of file qtlskey_base_p.h.

References keyType.

Referenced by QTlsPrivate::TlsKeyOpenSSL::decodeDer(), QTlsPrivate::TlsKeyGeneric::decodeDer(), QTlsPrivate::TlsKeyOpenSSL::decodePem(), QTlsPrivate::TlsKeyGeneric::decodePem(), QTlsPrivate::TlsKeyOpenSSL::derFromPem(), QTlsPrivate::TlsKeyGeneric::derFromPem(), QTlsPrivate::TlsKeyOpenSSL::toPem(), and QTlsPrivate::TlsKeyGeneric::toPem().

+ Here is the caller graph for this function:

Member Data Documentation

◆ keyAlgorithm

◆ keyIsNull

◆ keyType


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