![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <qtlskey_openssl_p.h>
Public Member Functions | |
TlsKeyOpenSSL () | |
~TlsKeyOpenSSL () | |
void | decodeDer (KeyType type, KeyAlgorithm algorithm, const QByteArray &der, const QByteArray &passPhrase, bool deepClear) override |
void | decodePem (KeyType type, KeyAlgorithm algorithm, const QByteArray &pem, const QByteArray &passPhrase, bool deepClear) override |
QByteArray | toPem (const QByteArray &passPhrase) const override |
QByteArray | derFromPem (const QByteArray &pem, QMap< QByteArray, QByteArray > *headers) const override |
void | fromHandle (Qt::HANDLE opaque, KeyType expectedType) override |
void | clear (bool deep) override |
Qt::HANDLE | handle () const override |
int | length () const override |
QByteArray | decrypt (Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv) const override |
QByteArray | encrypt (Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv) const override |
bool | fromEVP_PKEY (EVP_PKEY *pkey) |
Public Member Functions inherited from QTlsPrivate::TlsKeyBase | |
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 () |
QByteArray | pemHeader () const |
QByteArray | pemFooter () const |
Static Public Member Functions | |
static TlsKeyOpenSSL * | publicKeyFromX509 (X509 *x) |
Public Attributes | |
union { | |
EVP_PKEY * opaque | |
RSA * rsa | |
DSA * dsa | |
DH * dh | |
EC_KEY * ec | |
EVP_PKEY * genericKey | |
}; |
Additional Inherited Members | |
Public Types inherited from QTlsPrivate::TlsKey | |
using | KeyType = QSsl::KeyType |
using | KeyAlgorithm = QSsl::KeyAlgorithm |
Static Protected Member Functions inherited from QTlsPrivate::TlsKeyBase | |
static QByteArray | pkcs8Header (bool encrypted) |
static QByteArray | pkcs8Footer (bool encrypted) |
static bool | isEncryptedPkcs8 (const QByteArray &der) |
Protected Attributes inherited from QTlsPrivate::TlsKeyBase | |
bool | keyIsNull = true |
KeyType | keyType = QSsl::PublicKey |
KeyAlgorithm | keyAlgorithm = QSsl::Opaque |
Definition at line 49 of file qtlskey_openssl_p.h.
|
inline |
Definition at line 52 of file qtlskey_openssl_p.h.
References clear(), and opaque.
|
inline |
Definition at line 57 of file qtlskey_openssl_p.h.
References clear().
|
overridevirtual |
Clears the contents of this key, making it a null key. The meaning of deep is implementation-specific (e.g. if some internal objects representing a key can be shared using reference counting, deep equal to true
would imply decrementing a reference count).
Implements QTlsPrivate::TlsKey.
Definition at line 166 of file qtlskey_openssl.cpp.
References QTlsPrivate::TlsKeyBase::keyIsNull, q_DH_free(), q_DSA_free(), q_EC_KEY_free(), q_EVP_PKEY_free(), and q_RSA_free().
Referenced by TlsKeyOpenSSL(), ~TlsKeyOpenSSL(), and decodePem().
|
overridevirtual |
If a support of public and private keys in DER format is required, this function must be overridden and should initialize this key using the type, algorithm, der and passPhrase. If this key was initialized previously, deepClear has an implementation-specific meaning (e.g., if an implementation is using reference-counting and can share internally some data structures, a value true
may trigger decrementing a reference counter on some implementation-specific object).
Implements QTlsPrivate::TlsKey.
Definition at line 19 of file qtlskey_openssl.cpp.
|
overridevirtual |
If a support of public and private keys in PEM format is required, this function must be overridden and should initialize this key using the type, algorithm, pem and passPhrase. If this key was initialized previously, deepClear has an implementation-specific meaning (e.g., in an implementation using reference-counting, a value true
may trigger decrementing a reference counter on some implementation-specific object).
Implements QTlsPrivate::TlsKey.
Definition at line 45 of file qtlskey_openssl.cpp.
References clear(), QTlsPrivate::TlsKeyBase::keyIsNull, q_BIO_free(), q_EVP_PKEY_free(), and q_EVP_PKEY_get1_DH().
|
overridevirtual |
This function allows to decrypt data (for example, a private key read from a file), using passPhrase, initialization vector iv. cipher is describing a block cipher and its mode (for example, AES256 + CBC). decrypt() is needed to implement QSslKey's constructor.
Implements QTlsPrivate::TlsKey.
Definition at line 517 of file qtlskey_openssl.cpp.
|
overridevirtual |
Converts pem to DER format, using this key's type and algorithm. The parameter headers must be a valid, non-null pointer. When parsing pem, the headers found there will be saved into headers.
Implements QTlsPrivate::TlsKey.
Definition at line 104 of file qtlskey_openssl.cpp.
|
overridevirtual |
This function is needed to implement QSslKey::toPem() with encryption (for a private key). cipher names a block cipher to use to encrypt data, using passPhrase and initialization vector iv.
Implements QTlsPrivate::TlsKey.
Definition at line 523 of file qtlskey_openssl.cpp.
bool QTlsPrivate::TlsKeyOpenSSL::fromEVP_PKEY | ( | EVP_PKEY * | pkey | ) |
Definition at line 387 of file qtlskey_openssl.cpp.
References QTlsPrivate::TlsKeyBase::keyIsNull, q_EVP_PKEY_get1_DH(), q_EVP_PKEY_get1_DSA(), q_EVP_PKEY_get1_EC_KEY(), q_EVP_PKEY_get1_RSA(), q_EVP_PKEY_type(), and q_EVP_PKEY_up_ref().
|
overridevirtual |
Initializes this key using the handle and type, taking the ownership of the handle.
Implements QTlsPrivate::TlsKey.
Definition at line 373 of file qtlskey_openssl.cpp.
|
overridevirtual |
If a TLS backend supports opaque keys, returns a native handle that this key was initialized with.
Implements QTlsPrivate::TlsKey.
Definition at line 210 of file qtlskey_openssl.cpp.
|
overridevirtual |
Returns the length of the key in bits, or -1 if the key is null.
Implements QTlsPrivate::TlsKey.
Definition at line 237 of file qtlskey_openssl.cpp.
References q_DH_bits(), q_DSA_bits(), q_EC_GROUP_get_degree(), q_EC_KEY_get0_group(), and q_RSA_bits().
|
static |
Definition at line 529 of file qtlskey_openssl.cpp.
References dsa, ec, genericKey, QTlsPrivate::TlsKeyBase::keyIsNull, q_EVP_PKEY_free(), q_EVP_PKEY_get1_DSA(), q_EVP_PKEY_get1_EC_KEY(), q_EVP_PKEY_get1_RSA(), q_EVP_PKEY_type(), q_X509_get_pubkey(), and rsa.
Referenced by QTlsPrivate::X509CertificateOpenSSL::publicKey().
|
overridevirtual |
This function must be overridden, if converting a key to PEM format, potentially with encryption, is needed (e.g. to save a QSslKey into a file). If this key is private and passPhrase is not empty, the key's data is expected to be encrypted using some conventional encryption algorithm (e.g. DES or AES - the one that different tools or even the class QSslKey can understand later).
Implements QTlsPrivate::TlsKey.
Definition at line 270 of file qtlskey_openssl.cpp.
References QTlsBackendOpenSSL::logAndClearErrorQueue(), q_BIO_free(), q_BIO_new(), q_BIO_s_mem(), q_EVP_des_ede3_cbc(), q_EVP_PKEY_free(), q_EVP_PKEY_new(), q_EVP_PKEY_set1_DH(), q_PEM_write_bio_DSA_PUBKEY(), q_PEM_write_bio_EC_PUBKEY(), q_PEM_write_bio_PUBKEY(), and q_PEM_write_bio_RSA_PUBKEY().
union { ... } QTlsPrivate::TlsKeyOpenSSL |
DH* QTlsPrivate::TlsKeyOpenSSL::dh |
Definition at line 87 of file qtlskey_openssl_p.h.
DSA* QTlsPrivate::TlsKeyOpenSSL::dsa |
Definition at line 86 of file qtlskey_openssl_p.h.
Referenced by publicKeyFromX509().
EC_KEY* QTlsPrivate::TlsKeyOpenSSL::ec |
Definition at line 89 of file qtlskey_openssl_p.h.
Referenced by publicKeyFromX509().
EVP_PKEY* QTlsPrivate::TlsKeyOpenSSL::genericKey |
Definition at line 91 of file qtlskey_openssl_p.h.
Referenced by publicKeyFromX509().
EVP_PKEY* QTlsPrivate::TlsKeyOpenSSL::opaque |
Definition at line 84 of file qtlskey_openssl_p.h.
Referenced by TlsKeyOpenSSL().
RSA* QTlsPrivate::TlsKeyOpenSSL::rsa |
Definition at line 85 of file qtlskey_openssl_p.h.
Referenced by publicKeyFromX509().