#include <QtCrypto>
Inheritance diagram for QCA::PKey:
Public Types | |
enum | Type { RSA, DSA, DH } |
Public Member Functions | |
PKey (const PKey &from) | |
PKey & | operator= (const PKey &from) |
bool | isNull () const |
Type | type () const |
int | bitSize () const |
bool | isRSA () const |
bool | isDSA () const |
bool | isDH () const |
bool | isPublic () const |
bool | isPrivate () const |
bool | canExport () const |
bool | canKeyAgree () const |
PublicKey | toPublicKey () const |
PrivateKey | toPrivateKey () const |
bool | operator== (const PKey &a) const |
bool | operator!= (const PKey &a) const |
Static Public Member Functions | |
static QList< Type > | supportedTypes (const QString &provider=QString()) |
static QList< Type > | supportedIOTypes (const QString &provider=QString()) |
Protected Member Functions | |
PKey (const QString &type, const QString &provider) | |
void | set (const PKey &k) |
RSAPublicKey | toRSAPublicKey () const |
RSAPrivateKey | toRSAPrivateKey () const |
DSAPublicKey | toDSAPublicKey () const |
DSAPrivateKey | toDSAPrivateKey () const |
DHPublicKey | toDHPublicKey () const |
DHPrivateKey | toDHPrivateKey () const |
|
Types of public key cryptography keys supported by QCA.
|
|
Standard copy constructor.
|
|
Create a key of the specified type.
|
|
Standard assignment operator.
|
|
Test what types of keys are supported. Normally you would just test if the capability is present, however for PKey, you also need to test which types of keys are available. So if you want to figure out if RSA keys are supported, you need to do something like: if(!QCA::isSupported("pkey") || !QCA::PKey::supportedTypes().contains(QCA::PKey::RSA)) { // then there is no RSA key support } else { // there is RSA key support } To make things a bit more complex, supportedTypes() only checks for basic functionality. If you want to check that you can do operations with PEM or DER (eg toPEM(), fromPEM(), and the equivalent DER and PEMfile operations, plus anything else that uses them, including the constructor form that takes a fileName), then you need to check for supportedIOTypes() instead.
|
|
Test what types of keys are supported for IO operations. If you are using PKey DER or PEM operations, then you need to check for appropriate support using this method. For example, if you want to check if you can export or import an RSA key, then you need to do something like: if(!QCA::isSupported("pkey") || !QCA::PKey::supportedIOTypes().contains(QCA::PKey::RSA)) { // then there is no RSA key IO support } else { // there is RSA key IO support } Note that if you only want to check for basic functionality (ie not PEM or DER import/export), then you can use supportedTypes(). There is no need to use both - if the key type is supported for IO, then is also supported for basic operations.
|
|
Test if the key is null (empty).
|
|
Report the Type of key (eg RSA, DSA or Diffie Hellman).
Reimplemented from QCA::Algorithm. |
|
Report the number of bits in the key.
|
|
Test if the key is an RSA key.
|
|
Test if the key is a DSA key.
|
|
Test if the key is a Diffie Hellman key.
|
|
Test if the key is a public key.
|
|
Test if the key is a private key.
|
|
Test if the key data can be exported. If the key resides on a smart card or other such device, this will likely return false. |
|
Test if the key can be used for key agreement.
|
|
Interpret this key as a PublicKey.
|
|
Interpret this key as a PrivateKey.
|
|
test if two keys are equal
|
|
test if two keys are not equal
|
|
Set the key.
|
|
Interpret this key as an RSAPublicKey.
|
|
Interpret this key as an RSAPrivateKey.
|
|
Interpret this key as an DSAPublicKey.
|
|
Interpret this key as a DSAPrivateKey.
|
|
Interpret this key as an DHPublicKey.
|
|
Interpret this key as a DHPrivateKey.
|