![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QSslKey class provides an interface for private and public keys. More...
#include <qsslkey.h>
Public Member Functions | |
QSslKey () | |
Constructs a null key. | |
QSslKey (const QByteArray &encoded, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat format=QSsl::Pem, QSsl::KeyType type=QSsl::PrivateKey, const QByteArray &passPhrase=QByteArray()) | |
Constructs a QSslKey by decoding the string in the byte array encoded using a specified algorithm and encoding format. | |
QSslKey (QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat format=QSsl::Pem, QSsl::KeyType type=QSsl::PrivateKey, const QByteArray &passPhrase=QByteArray()) | |
Constructs a QSslKey by reading and decoding data from a device using a specified algorithm and encoding format. | |
QSslKey (Qt::HANDLE handle, QSsl::KeyType type=QSsl::PrivateKey) | |
QSslKey (const QSslKey &other) | |
Constructs an identical copy of other. | |
QSslKey (QSslKey &&other) noexcept | |
QSslKey & | operator= (QSslKey &&other) noexcept |
QSslKey & | operator= (const QSslKey &other) |
Copies the contents of other into this key, making the two keys identical. | |
~QSslKey () | |
Destroys the QSslKey object. | |
void | swap (QSslKey &other) noexcept |
bool | isNull () const |
Returns true if this is a null key; otherwise false. | |
void | clear () |
Clears the contents of this key, making it a null key. | |
int | length () const |
Returns the length of the key in bits, or -1 if the key is null. | |
QSsl::KeyType | type () const |
Returns the type of the key (i.e., PublicKey or PrivateKey). | |
QSsl::KeyAlgorithm | algorithm () const |
Returns the key algorithm. | |
QByteArray | toPem (const QByteArray &passPhrase=QByteArray()) const |
Returns the key in PEM encoding. | |
QByteArray | toDer (const QByteArray &passPhrase=QByteArray()) const |
Returns the key in DER encoding. | |
Qt::HANDLE | handle () const |
Returns a pointer to the native key handle, if there is one, else \nullptr. | |
bool | operator== (const QSslKey &key) const |
Returns true if this key is equal to other; otherwise returns false . | |
bool | operator!= (const QSslKey &key) const |
Returns true if this key is not equal to key other; otherwise returns false . | |
Friends | |
class | QTlsBackend |
The QSslKey class provides an interface for private and public keys.
\reentrant
\inmodule QtNetwork
QSslKey provides a simple API for managing keys.
QSslKey::QSslKey | ( | ) |
QSslKey::QSslKey | ( | const QByteArray & | encoded, |
QSsl::KeyAlgorithm | algorithm, | ||
QSsl::EncodingFormat | encoding = QSsl::Pem, | ||
QSsl::KeyType | type = QSsl::PrivateKey, | ||
const QByteArray & | passPhrase = QByteArray() ) |
Constructs a QSslKey by decoding the string in the byte array encoded using a specified algorithm and encoding format.
type specifies whether the key is public or private.
If the key is encrypted then passPhrase is used to decrypt it.
After construction, use isNull() to check if encoded contained a valid key.
Definition at line 117 of file qsslkey_p.cpp.
QSslKey::QSslKey | ( | QIODevice * | device, |
QSsl::KeyAlgorithm | algorithm, | ||
QSsl::EncodingFormat | encoding = QSsl::Pem, | ||
QSsl::KeyType | type = QSsl::PrivateKey, | ||
const QByteArray & | passPhrase = QByteArray() ) |
Constructs a QSslKey by reading and decoding data from a device using a specified algorithm and encoding format.
type specifies whether the key is public or private.
If the key is encrypted then passPhrase is used to decrypt it.
After construction, use isNull() to check if device provided a valid key.
Definition at line 139 of file qsslkey_p.cpp.
|
explicit |
QSslKey will take ownership for this key and you must not free the key using the native library.
Definition at line 163 of file qsslkey_p.cpp.
QSslKey::QSslKey | ( | const QSslKey & | other | ) |
Constructs an identical copy of other.
Definition at line 173 of file qsslkey_p.cpp.
|
noexcept |
Definition at line 177 of file qsslkey_p.cpp.
QSslKey::~QSslKey | ( | ) |
Destroys the QSslKey object.
Definition at line 198 of file qsslkey_p.cpp.
QSsl::KeyAlgorithm QSslKey::algorithm | ( | ) | const |
Returns the key algorithm.
Definition at line 268 of file qsslkey_p.cpp.
void QSslKey::clear | ( | ) |
Clears the contents of this key, making it a null key.
Definition at line 238 of file qsslkey_p.cpp.
Qt::HANDLE QSslKey::handle | ( | ) | const |
Returns a pointer to the native key handle, if there is one, else \nullptr.
You can use this handle together with the native API to access extended information about the key.
Definition at line 322 of file qsslkey_p.cpp.
bool QSslKey::isNull | ( | ) | const |
Returns true
if this is a null key; otherwise false.
Definition at line 225 of file qsslkey_p.cpp.
int QSslKey::length | ( | ) | const |
Returns the length of the key in bits, or -1 if the key is null.
Definition at line 246 of file qsslkey_p.cpp.
|
inline |
Copies the contents of other into this key, making the two keys identical.
Returns a reference to this QSslKey.
Definition at line 208 of file qsslkey_p.cpp.
Definition at line 183 of file qsslkey_p.cpp.
bool QSslKey::operator== | ( | const QSslKey & | key | ) | const |
Returns true
if this key is equal to other; otherwise returns false
.
Definition at line 333 of file qsslkey_p.cpp.
QByteArray QSslKey::toDer | ( | const QByteArray & | passPhrase = QByteArray() | ) | const |
Returns the key in DER encoding.
The passPhrase argument should be omitted as DER cannot be encrypted. It will be removed in a future version of Qt.
Definition at line 282 of file qsslkey_p.cpp.
QByteArray QSslKey::toPem | ( | const QByteArray & | passPhrase = QByteArray() | ) | const |
Returns the key in PEM encoding.
The result is encrypted with passPhrase if the key is a private key and passPhrase is non-empty.
Definition at line 303 of file qsslkey_p.cpp.
QSsl::KeyType QSslKey::type | ( | ) | const |
Returns the type of the key (i.e., PublicKey or PrivateKey).
Definition at line 257 of file qsslkey_p.cpp.
|
friend |