Qt Cryptographic Architecture
|
#include <QtCrypto>
Public Member Functions | |
CertificateChain | certificateChain () const |
bool | isNull () const |
KeyBundle () | |
KeyBundle (const QString &fileName, const SecureArray &passphrase=SecureArray()) | |
KeyBundle (const KeyBundle &from) | |
QString | name () const |
KeyBundle & | operator= (const KeyBundle &from) |
PrivateKey | privateKey () const |
void | setCertificateChainAndKey (const CertificateChain &c, const PrivateKey &key) |
void | setName (const QString &s) |
QByteArray | toArray (const SecureArray &passphrase, const QString &provider=QString()) const |
bool | toFile (const QString &fileName, const SecureArray &passphrase, const QString &provider=QString()) const |
Static Public Member Functions | |
static KeyBundle | fromArray (const QByteArray &a, const SecureArray &passphrase=SecureArray(), ConvertResult *result=0, const QString &provider=QString()) |
static KeyBundle | fromFile (const QString &fileName, const SecureArray &passphrase=SecureArray(), ConvertResult *result=0, const QString &provider=QString()) |
Certificate chain and private key pair.
KeyBundle is essentially a convience class that holds a certificate chain and an associated private key. This class has a number of methods that make it particularly suitable for accessing a PKCS12 (.p12) format file, however it can be used as just a container for a Certificate, its associated PrivateKey and optionally additional X.509 Certificate that form a chain.
For more information on PKCS12 "Personal Information Exchange Syntax Standard", see ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12v1.pdf.
QCA::KeyBundle::KeyBundle | ( | ) |
Create an empty KeyBundle.
|
explicit |
Create a KeyBundle from a PKCS12 (.p12) encoded file.
This constructor requires appropriate plugin (provider) support. You must check for the "pkcs12" feature before using this constructor.
fileName | the name of the file to read from |
passphrase | the passphrase that is applicable to the file |
QCA::KeyBundle::KeyBundle | ( | const KeyBundle & | from | ) |
Standard copy constructor.
from | the KeyBundle to use as source |
Standard assignment operator.
from | the KeyBundle to use as source |
bool QCA::KeyBundle::isNull | ( | ) | const |
Test if this key is empty (null)
QString QCA::KeyBundle::name | ( | ) | const |
The name associated with this key.
This is also known as the "friendly name", and if present, is typically suitable to be displayed to the user.
CertificateChain QCA::KeyBundle::certificateChain | ( | ) | const |
The public certificate part of this bundle.
PrivateKey QCA::KeyBundle::privateKey | ( | ) | const |
The private key part of this bundle.
void QCA::KeyBundle::setName | ( | const QString & | s | ) |
Specify the name of this bundle.
s | the name to use |
void QCA::KeyBundle::setCertificateChainAndKey | ( | const CertificateChain & | c, |
const PrivateKey & | key | ||
) |
Set the public certificate and private key.
c | the CertificateChain containing the public part of the Bundle |
key | the private key part of the Bundle |
QByteArray QCA::KeyBundle::toArray | ( | const SecureArray & | passphrase, |
const QString & | provider = QString() |
||
) | const |
Export the key bundle to an array in PKCS12 format.
This method requires appropriate plugin (provider) support - you must check for the "pkcs12" feature, as shown below.
passphrase | the passphrase to use to protect the bundle |
provider | the provider to use, if a specific provider is required |
bool QCA::KeyBundle::toFile | ( | const QString & | fileName, |
const SecureArray & | passphrase, | ||
const QString & | provider = QString() |
||
) | const |
Export the key bundle to a file in PKCS12 (.p12) format.
This method requires appropriate plugin (provider) support - you must check for the "pkcs12" feature, as shown below.
fileName | the name of the file to save to |
passphrase | the passphrase to use to protect the bundle |
provider | the provider to use, if a specific provider is required |
|
static |
Import the key bundle from an array in PKCS12 format.
This method requires appropriate plugin (provider) support - you must check for the "pkcs12" feature, as shown below.
a | the array to import from |
passphrase | the passphrase for the encoded bundle |
result | pointer to the result of the import process |
provider | the provider to use, if a specific provider is required |
|
static |
Import the key bundle from a file in PKCS12 (.p12) format.
This method requires appropriate plugin (provider) support - you must check for the "pkcs12" feature, as shown below.
fileName | the name of the file to read from |
passphrase | the passphrase for the encoded bundle |
result | pointer to the result of the import process |
provider | the provider to use, if a specific provider is required |