#include <qca_cert.h>
Inheritance diagram for QCA::KeyLoader:
Public Member Functions | |
KeyLoader (QObject *parent=0) | |
void | loadPrivateKeyFromPEMFile (const QString &fileName) |
void | loadPrivateKeyFromPEM (const QString &s) |
void | loadPrivateKeyFromDER (const SecureArray &a) |
void | loadKeyBundleFromFile (const QString &fileName) |
void | loadKeyBundleFromArray (const QByteArray &a) |
ConvertResult | convertResult () const |
PrivateKey | privateKey () const |
KeyBundle | keyBundle () const |
Public Attributes | |
Q_SIGNALS | __pad0__: void finished() |
Friends | |
class | Private |
GUI applications generally must use KeyLoader to load private keys. This is because the synchronous private key loading functions, for example QCA::PrivateKey::fromPEMFile(), cannot be used within the same thread as an EventHandler, and most GUI applications will use EventHandler from the main thread. KeyLoader does not have this problem. It can be used from any thread, including the same thread as EventHandler.
The KeyLoader class allows you to asynchronously load stand-alone private keys (QCA::PrivateKey) or private keys with a certificate (QCA::KeyBundle) with a signal that advises of completion.
To use this class to load a PrivateKey, you create a KeyLoader object then use one of the loadPrivateKeyFrom...() functions, depending on the format for your key. These functions return immediately. When you get the finished() signal, you can check that the loading operation succeeded (using convertResult()) and then obtain the PrivateKey using the privateKey() function.
The same process applies for loading a KeyBundle, except that you use either loadKeyBundleFromFile() or loadKeyBundleFromArray() instead of the loadPrivateKeyFrom...() function, and use keyBundle() instead of privateKey().
The loader may need a passphrase to complete the loading of the key or key bundle. You should use the QCA::EventHandler class to ensure that you deal with this correctly.
|
Create a KeyLoader object.
|
|
Initiate an asynchronous loading of a PrivateKey from a PEM format file. This function will return immediately.
|
|
Initiate an asynchronous loading of a PrivateKey from a PEM format string. This function will return immediately.
|
|
Initiate an asynchronous loading of a PrivateKey from a DER format array. This function will return immediately.
|
|
Initiate an asynchronous loading of a KeyBundle from a file. This function will return immediately.
|
|
Initiate an asynchronous loading of a KeyBundle from an array. This function will return immediately.
|
|
The result of the loading process. This is not valid until the finished() signal has been emitted. |
|
The private key that has been loaded. This is only valid if loadPrivateKeyFromPEMFile(), loadPrivateKeyFromPEM() or loadPrivateKeyFromDER() has been used, the load has completed (that is, finished() has been emitted), and the conversion succeeded (that is, convertResult() returned ConvertGood). |
|
The key bundle that has been loaded. This is only valid if loadKeyBundleFromFile() or loadKeyBundleFromArray() has been used, the load has completed (that is, finished() has been emitted), and the conversion succeeded (that is, convertResult() returned ConvertGood). |