|
Qt Cryptographic Architecture
|
#include <QtCrypto>

Public Types | |
| enum | Type { RSA , DSA , DH } |
Public Member Functions | |
| int | bitSize () const |
| bool | canExport () const |
| bool | canKeyAgree () const |
| bool | isDH () const |
| bool | isDSA () const |
| bool | isNull () const |
| bool | isPrivate () const |
| bool | isPublic () const |
| bool | isRSA () const |
| bool | operator!= (const PKey &a) const |
| PKey & | operator= (const PKey &from) |
| bool | operator== (const PKey &a) const |
| PKey () | |
| PKey (const PKey &from) | |
| PrivateKey | toPrivateKey () const |
| PublicKey | toPublicKey () const |
| Type | type () const |
| Public Member Functions inherited from QCA::Algorithm | |
| Algorithm (const Algorithm &from) | |
| void | change (const QString &type, const QString &provider) |
| void | change (Provider::Context *c) |
| Provider::Context * | context () |
| const Provider::Context * | context () const |
| Algorithm & | operator= (const Algorithm &from) |
| Provider * | provider () const |
| Provider::Context * | takeContext () |
| QString | type () const |
Static Public Member Functions | |
| static QList< Type > | supportedIOTypes (const QString &provider=QString()) |
| static QList< Type > | supportedTypes (const QString &provider=QString()) |
Protected Member Functions | |
| PKey (const QString &type, const QString &provider) | |
| void | set (const PKey &k) |
| DHPrivateKey | toDHPrivateKey () const |
| DHPublicKey | toDHPublicKey () const |
| DSAPrivateKey | toDSAPrivateKey () const |
| DSAPublicKey | toDSAPublicKey () const |
| RSAPrivateKey | toRSAPrivateKey () const |
| RSAPublicKey | toRSAPublicKey () const |
| Protected Member Functions inherited from QCA::Algorithm | |
| Algorithm () | |
| Algorithm (const QString &type, const QString &provider) | |
General superclass for public (PublicKey) and private (PrivateKey) keys used with asymmetric encryption techniques.
| enum QCA::PKey::Type |
Types of public key cryptography keys supported by QCA.
| Enumerator | |
|---|---|
| RSA | RSA key. |
| DSA | DSA key. |
| DH | Diffie Hellman key. |
| QCA::PKey::PKey | ( | ) |
Standard constructor.
Referenced by operator!=(), operator=(), operator==(), PKey(), set(), and toDHPrivateKey().
| QCA::PKey::PKey | ( | const PKey & | from | ) |
|
protected |
Create a key of the specified type.
| type | the name of the type of key to create |
| provider | the name of the provider to create the key in |
References QCA::Algorithm::provider(), and type().
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:
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.
| provider | the name of the provider to use, if a particular provider is required. |
References QCA::Algorithm::provider().
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:
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.
| provider | the name of the provider to use, if a particular provider is required. |
References QCA::Algorithm::provider().
| bool QCA::PKey::isNull | ( | ) | const |
| Type QCA::PKey::type | ( | ) | const |
Report the Type of key (eg RSA, DSA or Diffie Hellman).
Referenced by PKey(), QCA::PrivateKey::PrivateKey(), and QCA::PublicKey::PublicKey().
| int QCA::PKey::bitSize | ( | ) | const |
Report the number of bits in the key.
| bool QCA::PKey::isRSA | ( | ) | const |
Test if the key is an RSA key.
| bool QCA::PKey::isDSA | ( | ) | const |
Test if the key is a DSA key.
| bool QCA::PKey::isDH | ( | ) | const |
Test if the key is a Diffie Hellman key.
| bool QCA::PKey::isPublic | ( | ) | const |
Test if the key is a public key.
| bool QCA::PKey::isPrivate | ( | ) | const |
Test if the key is a private key.
| bool QCA::PKey::canExport | ( | ) | const |
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.
| bool QCA::PKey::canKeyAgree | ( | ) | const |
Test if the key can be used for key agreement.
| PublicKey QCA::PKey::toPublicKey | ( | ) | const |
Interpret this key as a PublicKey.
| PrivateKey QCA::PKey::toPrivateKey | ( | ) | const |
Interpret this key as a PrivateKey.
| bool QCA::PKey::operator== | ( | const PKey & | a | ) | const |
| bool QCA::PKey::operator!= | ( | const PKey & | a | ) | const |
|
protected |
|
protected |
Interpret this key as an RSAPublicKey.
|
protected |
Interpret this key as an RSAPrivateKey.
|
protected |
Interpret this key as an DSAPublicKey.
|
protected |
Interpret this key as a DSAPrivateKey.
|
protected |
Interpret this key as an DHPublicKey.
|
protected |
Interpret this key as a DHPrivateKey.
References PKey().