API documentation update

svn path=/trunk/kdesupport/qca/; revision=661327
This commit is contained in:
Brad Hards 2007-05-05 07:31:08 +00:00
parent 39d2a245c1
commit e6296a5755
4 changed files with 159 additions and 14 deletions

View File

@ -496,6 +496,7 @@ EXAMPLE_PATH = examples/aes-cmac \
examples/certtest \
examples/ciphertest \
examples/cms \
examples/cmssigner \
examples/eventhandlerdemo \
examples/hashtest \
examples/hextest \
@ -509,7 +510,8 @@ EXAMPLE_PATH = examples/aes-cmac \
examples/saslservtest \
examples/sasltest \
examples/ssltest \
examples/sslservtest
examples/sslservtest \
examples/tlssocket
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp

View File

@ -12,6 +12,7 @@ There are three important parts to this:
*/
/** \example base64test.cpp
The code below shows some simple operations on a QCA::Base64 object, converting
@ -19,6 +20,7 @@ between QCA::SecureArray and QString.
*/
/** \example certtest.cpp
This example shows how QCA::Certificate and QCA::CertificateCollection
@ -27,18 +29,29 @@ PEM encoded file collection.
*/
/** \example ciphertest.cpp
The code below shows the normal way to use the QCA::Cipher class.
*/
/** \example cmsexample.cpp
The code below shows the normal way to use the QCA::CMS class.
*/
/** \example main.cpp
The code below shows how to use Cryptographic Message Syntax (CMS)
in a GUI application.
*/
/** \example eventhandlerdemo.cpp
The code below shows to implement a client side handler for
@ -47,12 +60,14 @@ associated providers.
*/
/** \example hashtest.cpp
The code below shows how to use the QCA::Hash class
*/
/** \example hextest.cpp
The code below shows some simple operations on a QCA::Hex object, converting
@ -60,6 +75,16 @@ between QCA::SecureArray and QString.
*/
/** \example keyloader.cpp
The code below shows how to load a private key from a PEM format file,
including handling any requirement for a passphrase. This is done using
the QCA::KeyLoader class.
*/
/** \example mactest.cpp
The code below shows how to use the QCA::MessageAuthenticationCode class
@ -67,12 +92,6 @@ The code below shows how to use the QCA::MessageAuthenticationCode class
*/
/** \example keyloader.cpp
The code below shows how to use the QCA::KeyLoader class
*/
/** \example md5crypt.cpp
The code below shows how to calculate an md5crypt based password. This
@ -80,6 +99,7 @@ code is compatible with the glibc code.
*/
/** \example providertest.cpp
The code below shows some simple operations on a QCA::Provider object, including
@ -87,18 +107,21 @@ use of iterators and some member functions.
*/
/** \example publickeyexample.cpp
The code below shows how to do public key encryption, decryption,
signing and verification.
*/
/** \example randomtest.cpp
The code below shows the normal way to use the QCA::Random class.
*/
/** \example rsatest.cpp
The code below shows some of the capabilities for how to use
@ -107,23 +130,20 @@ to a file, using PEM encoding.
*/
/** \example saslservtest.cpp
The code below shows how to create a SASL server.
*/
/** \example sasltest.cpp
The code below shows how to create a SASL client.
*/
/** \example ssltest.cpp
The code below shows how to create an SSL client
*/
/** \example sslservtest.cpp
@ -141,4 +161,18 @@ just create a TlsConnection for each server connection.
*/
/** \example ssltest.cpp
The code below shows how to create an SSL client
*/
/** \example tlssocket.cpp
The code below shows how to create a socket that can operate
over an Transport Layer Security (TLS, also known as SSL) connection.
*/

View File

@ -103,10 +103,13 @@ namespace QCA
class QCA_EXPORT CertificateInfoPair
{
public:
/**
Section of the certificate that the information belongs in
*/
enum Section
{
DN,
AltName
DN, ///< Distinguished name (the primary name)
AltName ///< Alternate name
};
/**
@ -1735,6 +1738,8 @@ namespace QCA
\param passphrase the passphrase for the encoded bundle
\param result pointer to the result of the import process
\param provider the provider to use, if a specific provider is required
\sa QCA::KeyLoader for an asynchronous loader approach.
*/
static KeyBundle fromArray(const QByteArray &a, const SecureArray &passphrase = SecureArray(), ConvertResult *result = 0, const QString &provider = QString());
@ -1758,6 +1763,8 @@ namespace QCA
\param passphrase the passphrase for the encoded bundle
\param result pointer to the result of the import process
\param provider the provider to use, if a specific provider is required
\sa QCA::KeyLoader for an asynchronous loader approach.
*/
static KeyBundle fromFile(const QString &fileName, const SecureArray &passphrase = SecureArray(), ConvertResult *result = 0, const QString &provider = QString());
@ -1936,25 +1943,121 @@ namespace QCA
/**
Asynchronous private key loader
Under some circumstances, it may take an extended period to load a private key. The KeyLoader
class allows you to asynchronously load private keys (QCA::PrivateKey) or groups of keys
(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, password or token 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().
*/
class QCA_EXPORT KeyLoader : public QObject
{
Q_OBJECT
public:
/**
Create a KeyLoader object.
\param parent the parent object for this object
*/
KeyLoader(QObject *parent = 0);
~KeyLoader();
/**
Initiate an asynchronous loading of a PrivateKey from a PEM format file.
This function will return immediately.
\param fileName the name of the file (and path, if neccessary) to load
the key from
*/
void loadPrivateKeyFromPEMFile(const QString &fileName);
/**
Initiate an asynchronous loading of a PrivateKey from a PEM format string.
This function will return immediately.
\param s the string containing the PEM formatted key
*/
void loadPrivateKeyFromPEM(const QString &s);
/**
Initiate an asynchronous loading of a PrivateKey from a DER format array.
This function will return immediately.
\param a the array containing the DER formatted key
*/
void loadPrivateKeyFromDER(const SecureArray &a);
/**
Initiate an asynchronous loading of a KeyBundle from a file
This function will return immediately.
\param fileName the name of the file (and path, if neccessary) to load
the key bundle from
*/
void loadKeyBundleFromFile(const QString &fileName);
/**
Initiate an asynchronous loading of a KeyBundle from an array
This function will return immediately.
\param a the array containing the key bundle
*/
void loadKeyBundleFromArray(const QByteArray &a);
/**
The result of the loading process.
This is not valid until the finished() signal has been emitted.
*/
ConvertResult convertResult() 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).
*/
PrivateKey privateKey() 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).
*/
KeyBundle keyBundle() const;
Q_SIGNALS:
/**
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.
*/
void finished();
private:

View File

@ -853,6 +853,8 @@ namespace QCA
\param provider the provider to use, if a particular provider is required
\sa toDER provides an inverse of fromDER, exporting the key to an array
\sa QCA::KeyLoader for an asynchronous loader approach.
*/
static PrivateKey fromDER(const SecureArray &a, const SecureArray &passphrase = SecureArray(), ConvertResult *result = 0, const QString &provider = QString());
@ -866,6 +868,8 @@ namespace QCA
\param provider the provider to use, if a particular provider is required
\sa toPEM provides an inverse of fromPEM, exporting the key to a string in PEM encoding.
\sa QCA::KeyLoader for an asynchronous loader approach.
*/
static PrivateKey fromPEM(const QString &s, const SecureArray &passphrase = SecureArray(), ConvertResult *result = 0, const QString &provider = QString());
@ -881,6 +885,8 @@ namespace QCA
\sa toPEMFile provides an inverse of fromPEMFile
\sa fromPEM which allows import from a string
\sa QCA::KeyLoader for an asynchronous loader approach.
\note there is also a constructor form, that allows you to create the key directly
*/
static PrivateKey fromPEMFile(const QString &fileName, const SecureArray &passphrase = SecureArray(), ConvertResult *result = 0, const QString &provider = QString());