• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE Support
  • Sitemap
  • Contact Us
 

qca

QCA::KeyLoader

QCA::KeyLoader Class Reference
[QCA user API]

Asynchronous private key loader. More...

#include <QtCrypto>

Inheritance diagram for QCA::KeyLoader:
Inheritance graph
[legend]

List of all members.

Signals

void finished ()

Public Member Functions

 KeyLoader (QObject *parent=0)
 ~KeyLoader ()
ConvertResult convertResult () const
KeyBundle keyBundle () const
void loadKeyBundleFromArray (const QByteArray &a)
void loadKeyBundleFromFile (const QString &fileName)
void loadPrivateKeyFromDER (const SecureArray &a)
void loadPrivateKeyFromPEM (const QString &s)
void loadPrivateKeyFromPEMFile (const QString &fileName)
PrivateKey privateKey () const

Detailed Description

Asynchronous private key loader.

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.

Note:
QCA also provides synchronous private key loading using QCA::PrivateKey::fromPEMFile(), QCA::PrivateKey::fromPEM() and QCA::PrivateKey::fromDER(). QCA provides synchronous key bundle loading using QCA::KeyBundle::fromArray() and QCA::KeyBundle::fromFile().

Definition at line 2566 of file qca_cert.h.


Constructor & Destructor Documentation

QCA::KeyLoader::KeyLoader ( QObject *  parent = 0  ) 

Create a KeyLoader object.

Parameters:
parent the parent object for this object

Definition at line 2899 of file qca_cert.cpp.

QCA::KeyLoader::~KeyLoader (  ) 

Definition at line 2905 of file qca_cert.cpp.


Member Function Documentation

ConvertResult QCA::KeyLoader::convertResult (  )  const

The result of the loading process.

This is not valid until the finished() signal has been emitted.

Definition at line 2970 of file qca_cert.cpp.

void QCA::KeyLoader::finished (  )  [signal]

Signal that is emitted when the load process has completed.

Note:
The load process may not have completed successfully - check the result of convertResult() to confirm this before using the privateKey() or keyBundle() results.
KeyBundle QCA::KeyLoader::keyBundle (  )  const

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).

Definition at line 2980 of file qca_cert.cpp.

void QCA::KeyLoader::loadKeyBundleFromArray ( const QByteArray &  a  ) 

Initiate an asynchronous loading of a KeyBundle from an array.

This function will return immediately.

Parameters:
a the array containing the key bundle

Definition at line 2958 of file qca_cert.cpp.

void QCA::KeyLoader::loadKeyBundleFromFile ( const QString &  fileName  ) 

Initiate an asynchronous loading of a KeyBundle from a file.

This function will return immediately.

Parameters:
fileName the name of the file (and path, if necessary) to load the key bundle from

Definition at line 2946 of file qca_cert.cpp.

void QCA::KeyLoader::loadPrivateKeyFromDER ( const SecureArray &  a  ) 

Initiate an asynchronous loading of a PrivateKey from a DER format array.

This function will return immediately.

Parameters:
a the array containing the DER formatted key

Definition at line 2934 of file qca_cert.cpp.

void QCA::KeyLoader::loadPrivateKeyFromPEM ( const QString &  s  ) 

Initiate an asynchronous loading of a PrivateKey from a PEM format string.

This function will return immediately.

Parameters:
s the string containing the PEM formatted key

Definition at line 2922 of file qca_cert.cpp.

void QCA::KeyLoader::loadPrivateKeyFromPEMFile ( const QString &  fileName  ) 

Initiate an asynchronous loading of a PrivateKey from a PEM format file.

This function will return immediately.

Parameters:
fileName the name of the file (and path, if necessary) to load the key from

Definition at line 2910 of file qca_cert.cpp.

PrivateKey QCA::KeyLoader::privateKey (  )  const

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).

Definition at line 2975 of file qca_cert.cpp.


The documentation for this class was generated from the following files:
  • qca_cert.h
  • qca_cert.cpp

qca

Skip menu "qca"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE Support

Skip menu "KDE Support"
  • akonadi
  • Decibel
  • grantlee
  • kdewin
  • phonon
  •     Backend
  • polkit-qt
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for KDE Support by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal