Home · All Classes · Main Classes · Grouped Classes · Modules · Functions

QSslKey Class Reference
[QtNetwork module]

The QSslKey class provides an interface for private and public keys. More...

 #include <QSslKey>

Note: All the functions in this class are reentrant.

This class was introduced in Qt 4.3.

Public Types

Public Functions

Static Public Members


Detailed Description

The QSslKey class provides an interface for private and public keys.

QSslKey provides a simple API for managing keys.

See also QSslSocket, QSslCertificate, and QSslCipher.


Member Type Documentation

enum QSslKey::Algorithm

Describes the algorithm for the key.

ConstantValueDescription
QSslKey::Rsa0The RSA algorithm.
QSslKey::Dsa1The DSA algorithm.

enum QSslKey::Type

Describes the two types of keys QSslKey supports.

ConstantValueDescription
QSslKey::PrivateKey0A private key.
QSslKey::PublicKey1A public key.


Member Function Documentation

QSslKey::QSslKey ( const QByteArray & encoded = QByteArray() )

Constructs a QSslKey by parsing encoded. You can call isNull() later to check if encoded contained a valid key or not.

QSslKey::QSslKey ( const QSslKey & other )

Constructs an identical copy of other.

QSslKey::~QSslKey ()

Destroys the QSslKey object.

Algorithm QSslKey::algorithm () const

Returns the key algorithm.

void QSslKey::clear ()

Clears the contents of this key, making it a null key.

See also isNull().

const uchar * QSslKey::data () const

Returns a pointer to key bits.

See also keyLength().

QPair<QSslKey, QSslKey> QSslKey::generateKeyPair ( Algorithm algorithm, int keyLength )   [static]

Generates and returns a new pair of keys (the first is a PrivateKey, and the second is the PublicKey). algorithm specifies what algorithm to use when generting the keys, and keyLength specifies the number of bits.

This function can be time consuming, and will block the calling thread.

bool QSslKey::isNull () const

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

See also clear().

int QSslKey::length () const

Returns the length of the key in bits.

QByteArray QSslKey::toDer ( const QByteArray & passPhrase = QByteArray() ) const

Returns the key in DER encoding, optionally encrypted and protected by passPhrase.

QByteArray QSslKey::toPem ( const QByteArray & passPhrase = QByteArray() ) const

Returns the key in PEM encoding, optionally encrypted and protected by passPhrase.

Type QSslKey::type () const

Returns the type of the key (i.e., PublicKey or PrivateKey).

QSslKey & QSslKey::operator= ( const QSslKey & other )

Copies the contents of other into this key, making the two keys identical.

Returns a reference to this QSslKey.


Copyright © 2007 Trolltech Trademarks
Qt 4.3.0beta