Qt 4.8
|
The QSslKey class provides an interface for private and public keys. More...
#include <qsslkey.h>
Public Functions | |
QSsl::KeyAlgorithm | algorithm () const |
Returns the key algorithm. More... | |
void | clear () |
Clears the contents of this key, making it a null key. More... | |
Qt::HANDLE | handle () const |
Returns a pointer to the native key handle, if it is available; otherwise a null pointer is returned. More... | |
bool | isNull () const |
Returns true if this is a null key; otherwise false. More... | |
int | length () const |
Returns the length of the key in bits, or -1 if the key is null. More... | |
bool | operator!= (const QSslKey &key) const |
Returns true if this key is not equal to key other; otherwise returns false. More... | |
QSslKey & | operator= (const QSslKey &other) |
Copies the contents of other into this key, making the two keys identical. More... | |
bool | operator== (const QSslKey &key) const |
Returns true if this key is equal to other; otherwise returns false. More... | |
QSslKey () | |
Constructs a null key. More... | |
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. More... | |
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. More... | |
QSslKey (const QSslKey &other) | |
Constructs an identical copy of other. More... | |
QByteArray | toDer (const QByteArray &passPhrase=QByteArray()) const |
Returns the key in DER encoding. More... | |
QByteArray | toPem (const QByteArray &passPhrase=QByteArray()) const |
Returns the key in PEM encoding. More... | |
QSsl::KeyType | type () const |
Returns the type of the key (i.e., PublicKey or PrivateKey). More... | |
~QSslKey () | |
Destroys the QSslKey object. More... | |
Properties | |
QExplicitlySharedDataPointer< QSslKeyPrivate > | d |
Friends | |
class | QSslCertificate |
The QSslKey class provides an interface for private and public keys.
QSslKey provides a simple API for managing keys.
QSslKey::QSslKey | ( | ) |
Constructs a null key.
Definition at line 152 of file qsslkey.cpp.
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.
If the encoded key is encrypted, passPhrase is used to decrypt it. type specifies whether the key is public or private.
After construction, use isNull() to check if encoded contained a valid key.
Definition at line 245 of file qsslkey.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.
If the encoded key is encrypted, passPhrase is used to decrypt it. type specifies whether the key is public or private.
After construction, use isNull() to check if device provided a valid key.
Definition at line 265 of file qsslkey.cpp.
QSslKey::QSslKey | ( | const QSslKey & | other | ) |
QSslKey::~QSslKey | ( | ) |
QSsl::KeyAlgorithm QSslKey::algorithm | ( | ) | const |
Returns the key algorithm.
Definition at line 347 of file qsslkey.cpp.
Referenced by QSslSocketBackendPrivate::initSslContext(), operator<<(), operator==(), QSslKeyPrivate::pemFooter(), QSslKeyPrivate::pemHeader(), and QSslKey().
void QSslKey::clear | ( | ) |
Clears the contents of this key, making it a null key.
Definition at line 320 of file qsslkey.cpp.
Qt::HANDLE QSslKey::handle | ( | ) | const |
Returns a pointer to the native key handle, if it is available; otherwise a null pointer is returned.
You can use this handle together with the native API to access extended information about the key.
Definition at line 430 of file qsslkey.cpp.
Referenced by QSslSocketBackendPrivate::initSslContext().
bool QSslKey::isNull | ( | ) | const |
Returns true if this is a null key; otherwise false.
Definition at line 310 of file qsslkey.cpp.
Referenced by QSslSocketBackendPrivate::initSslContext(), QSslConfiguration::isNull(), and operator==().
int QSslKey::length | ( | ) | const |
Returns the length of the key in bits, or -1 if the key is null.
Definition at line 328 of file qsslkey.cpp.
Referenced by operator<<(), and operator==().
|
inline |
Returns true if this key is not equal to key other; otherwise returns false.
Definition at line 93 of file qsslkey.h.
Copies the contents of other into this key, making the two keys identical.
Returns a reference to this QSslKey.
Definition at line 299 of file qsslkey.cpp.
bool QSslKey::operator== | ( | const QSslKey & | key | ) | const |
Returns true if this key is equal to other; otherwise returns false.
Definition at line 438 of file qsslkey.cpp.
QByteArray QSslKey::toDer | ( | const QByteArray & | passPhrase = QByteArray() | ) | const |
Returns the key in DER encoding.
The result is encrypted with passPhrase if the key is a private key and passPhrase is non-empty.
Definition at line 358 of file qsslkey.cpp.
Referenced by operator==().
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 370 of file qsslkey.cpp.
Referenced by toDer().
QSsl::KeyType QSslKey::type | ( | ) | const |
Returns the type of the key (i.e., PublicKey or PrivateKey).
Definition at line 339 of file qsslkey.cpp.
Referenced by operator<<(), operator==(), QSslKeyPrivate::pemFooter(), QSslKeyPrivate::pemHeader(), and QSslKey().
|
friend |
|
private |
Definition at line 96 of file qsslkey.h.
Referenced by algorithm(), clear(), handle(), isNull(), length(), operator=(), QSslCertificate::publicKey(), QSslKey(), toDer(), toPem(), and type().