#include <QtCrypto>
Inheritance diagram for QCA::PrivateKey:


Public Member Functions | |
| bool | canDecrypt () const |
| bool | canSign () const |
| bool | decrypt (const SecureArray &in, SecureArray *out, EncryptionAlgorithm alg) |
| SymmetricKey | deriveKey (const PublicKey &theirs) |
| PrivateKey & | operator= (const PrivateKey &from) |
| PrivateKey (const PrivateKey &from) | |
| PrivateKey (const QString &fileName, const SecureArray &passphrase=SecureArray()) | |
| PrivateKey () | |
| QByteArray | signature () |
| QByteArray | signMessage (const MemoryRegion &a, SignatureAlgorithm alg, SignatureFormat format=DefaultFormat) |
| void | startSign (SignatureAlgorithm alg, SignatureFormat format=DefaultFormat) |
| SecureArray | toDER (const SecureArray &passphrase=SecureArray(), PBEAlgorithm pbe=PBEDefault) const |
| DHPrivateKey | toDH () const |
| DSAPrivateKey | toDSA () const |
| QString | toPEM (const SecureArray &passphrase=SecureArray(), PBEAlgorithm pbe=PBEDefault) const |
| bool | toPEMFile (const QString &fileName, const SecureArray &passphrase=SecureArray(), PBEAlgorithm pbe=PBEDefault) const |
| RSAPrivateKey | toRSA () const |
| void | update (const MemoryRegion &a) |
Static Public Member Functions | |
| static PrivateKey | fromDER (const SecureArray &a, const SecureArray &passphrase=SecureArray(), ConvertResult *result=0, const QString &provider=QString()) |
| static PrivateKey | fromPEM (const QString &s, const SecureArray &passphrase=SecureArray(), ConvertResult *result=0, const QString &provider=QString()) |
| static PrivateKey | fromPEMFile (const QString &fileName, const SecureArray &passphrase=SecureArray(), ConvertResult *result=0, const QString &provider=QString()) |
| static QList< PBEAlgorithm > | supportedPBEAlgorithms (const QString &provider=QString()) |
Protected Member Functions | |
| PrivateKey (const QString &type, const QString &provider) | |
cmssigner/main.cpp, keyloader.cpp, publickeyexample.cpp, rsatest.cpp, and sslservtest.cpp.
| QCA::PrivateKey::PrivateKey | ( | ) |
Create an empty private key.
| QCA::PrivateKey::PrivateKey | ( | const QString & | fileName, | |
| const SecureArray & | passphrase = SecureArray() | |||
| ) | [explicit] |
Import a private key from a PEM representation in a file.
| fileName | the name of the file containing the private key | |
| passphrase | the pass phrase for the private key |
| QCA::PrivateKey::PrivateKey | ( | const PrivateKey & | from | ) |
Create a new private key.
| type | the type of key to create | |
| provider | the provider to use, if a specific provider is required. |
| bool QCA::PrivateKey::canDecrypt | ( | ) | const |
Test if this key can be used for decryption.
| bool QCA::PrivateKey::canSign | ( | ) | const |
Test if this key can be used for signing.
| bool QCA::PrivateKey::decrypt | ( | const SecureArray & | in, | |
| SecureArray * | out, | |||
| EncryptionAlgorithm | alg | |||
| ) |
Decrypt the message.
| in | the cipher (encrypted) data | |
| out | the plain text data | |
| alg | the algorithm to use |
| SymmetricKey QCA::PrivateKey::deriveKey | ( | const PublicKey & | theirs | ) |
Derive a shared secret key from a public key.
| theirs | the public key to derive from |
| static PrivateKey QCA::PrivateKey::fromDER | ( | const SecureArray & | a, | |
| const SecureArray & | passphrase = SecureArray(), |
|||
| ConvertResult * | result = 0, |
|||
| const QString & | provider = QString() | |||
| ) | [static] |
Import the key from Distinguished Encoding Rules (DER) format.
| a | the array containing the DER representation of the key | |
| passphrase | the pass phrase that is used to protect the key | |
| result | a pointer to a ConvertResult, that if specified, will be set to reflect the result of the import | |
| provider | the provider to use, if a particular provider is required |
QCA::KeyLoader for an asynchronous loader approach.
| static PrivateKey QCA::PrivateKey::fromPEM | ( | const QString & | s, | |
| const SecureArray & | passphrase = SecureArray(), |
|||
| ConvertResult * | result = 0, |
|||
| const QString & | provider = QString() | |||
| ) | [static] |
Import the key from Privacy Enhanced Mail (PEM) format.
| s | the string containing the PEM representation of the key | |
| passphrase | the pass phrase that is used to protect the key | |
| result | a pointer to a ConvertResult, that if specified, will be set to reflect the result of the import | |
| provider | the provider to use, if a particular provider is required |
QCA::KeyLoader for an asynchronous loader approach.
| static PrivateKey QCA::PrivateKey::fromPEMFile | ( | const QString & | fileName, | |
| const SecureArray & | passphrase = SecureArray(), |
|||
| ConvertResult * | result = 0, |
|||
| const QString & | provider = QString() | |||
| ) | [static] |
Import the key in Privacy Enhanced Mail (PEM) format from a file.
| fileName | the name (and path, if required) of the file containing the PEM representation of the key | |
| passphrase | the pass phrase that is used to protect the key | |
| result | a pointer to a ConvertResult, that if specified, will be set to reflect the result of the import | |
| provider | the provider to use, if a particular provider is required |
fromPEM which allows import from a string
QCA::KeyLoader for an asynchronous loader approach.
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.
| PrivateKey& QCA::PrivateKey::operator= | ( | const PrivateKey & | from | ) |
| QByteArray QCA::PrivateKey::signature | ( | ) |
The resulting signature.
| QByteArray QCA::PrivateKey::signMessage | ( | const MemoryRegion & | a, | |
| SignatureAlgorithm | alg, | |||
| SignatureFormat | format = DefaultFormat | |||
| ) |
One step signature process.
| a | the message to sign | |
| alg | the algorithm to use for the signature | |
| format | the signature format to use, for DSA |
| void QCA::PrivateKey::startSign | ( | SignatureAlgorithm | alg, | |
| SignatureFormat | format = DefaultFormat | |||
| ) |
Initialise the message signature process.
| alg | the algorithm to use for the message signature process | |
| format | the signature format to use, for DSA |
| static QList<PBEAlgorithm> QCA::PrivateKey::supportedPBEAlgorithms | ( | const QString & | provider = QString() |
) | [static] |
List the supported Password Based Encryption Algorithms that can be used to protect the key.
| provider | the provider to use, if a particular provider is required |
| SecureArray QCA::PrivateKey::toDER | ( | const SecureArray & | passphrase = SecureArray(), |
|
| PBEAlgorithm | pbe = PBEDefault | |||
| ) | const |
Export the key in Distinguished Encoding Rules (DER) format.
| passphrase | the pass phrase to use to protect the key | |
| pbe | the symmetric encryption algorithm to use to protect the key |
| DHPrivateKey QCA::PrivateKey::toDH | ( | ) | const |
Interpret / convert the key to a Diffie-Hellman key.
| DSAPrivateKey QCA::PrivateKey::toDSA | ( | ) | const |
Interpret / convert the key to a DSA key.
| QString QCA::PrivateKey::toPEM | ( | const SecureArray & | passphrase = SecureArray(), |
|
| PBEAlgorithm | pbe = PBEDefault | |||
| ) | const |
Export the key in Privacy Enhanced Mail (PEM) format.
| passphrase | the pass phrase to use to protect the key | |
| pbe | the symmetric encryption algorithm to use to protect the key |
fromPEM provides an inverse of toPEM, converting the PEM encoded key back to a PrivateKey
| bool QCA::PrivateKey::toPEMFile | ( | const QString & | fileName, | |
| const SecureArray & | passphrase = SecureArray(), |
|||
| PBEAlgorithm | pbe = PBEDefault | |||
| ) | const |
Export the key in Privacy Enhanced Mail (PEM) format to a file.
| fileName | the name (and path, if required) that the key should be exported to. | |
| passphrase | the pass phrase to use to protect the key | |
| pbe | the symmetric encryption algorithm to use to protect the key |
fromPEM provides an inverse of toPEM, converting the PEM encoded key back to a PrivateKey
| RSAPrivateKey QCA::PrivateKey::toRSA | ( | ) | const |
Interpret / convert the key to an RSA key.
| void QCA::PrivateKey::update | ( | const MemoryRegion & | a | ) |
Update the signature process.
| a | the message to use to update the signature |
1.5.2