2005-01-01 02:44:28 +00:00
|
|
|
/*
|
|
|
|
* qca_core.h - Qt Cryptographic Architecture
|
|
|
|
* Copyright (C) 2003-2005 Justin Karneges <justin@affinix.com>
|
|
|
|
* Copyright (C) 2004,2005 Brad Hards <bradh@frogmouth.net>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2007-01-02 05:10:11 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-01-01 02:44:28 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-03-26 03:27:54 +00:00
|
|
|
/**
|
|
|
|
\file qca_core.h
|
|
|
|
|
|
|
|
Header file for core %QCA infrastructure
|
|
|
|
|
|
|
|
\note You should not use this header directly from an
|
|
|
|
application. You should just use <tt> \#include \<QtCrypto>
|
|
|
|
</tt> instead.
|
|
|
|
*/
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
#ifndef QCA_CORE_H
|
|
|
|
#define QCA_CORE_H
|
|
|
|
|
2006-03-26 03:27:54 +00:00
|
|
|
/**
|
|
|
|
The current version of %QCA
|
2006-12-18 07:08:16 +00:00
|
|
|
|
|
|
|
This provides you a compile time check of the %QCA version.
|
|
|
|
|
|
|
|
\sa qcaVersion for a runtime check.
|
2006-03-26 03:27:54 +00:00
|
|
|
*/
|
2007-03-30 00:49:11 +00:00
|
|
|
#define QCA_VERSION 0x016363
|
2005-01-01 02:44:28 +00:00
|
|
|
|
2005-02-27 01:12:26 +00:00
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QList>
|
2005-03-01 01:05:21 +00:00
|
|
|
#include <QSharedData>
|
|
|
|
#include <QSharedDataPointer>
|
2005-01-01 02:44:28 +00:00
|
|
|
#include "qca_export.h"
|
2005-07-03 03:06:45 +00:00
|
|
|
#include "qca_support.h"
|
2005-01-01 02:44:28 +00:00
|
|
|
#include "qca_tools.h"
|
|
|
|
|
2006-12-18 07:08:16 +00:00
|
|
|
/**
|
|
|
|
The current version of %QCA.
|
|
|
|
|
|
|
|
This is equivalent to QCA_VERSION, except it provides
|
|
|
|
a runtime check of the version of %QCA that is being used.
|
|
|
|
*/
|
2006-11-12 23:01:27 +00:00
|
|
|
QCA_EXPORT int qcaVersion();
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
/**
|
|
|
|
* QCA - the Qt Cryptographic Architecture
|
|
|
|
*/
|
|
|
|
namespace QCA
|
|
|
|
{
|
|
|
|
class Provider;
|
|
|
|
class Random;
|
2005-03-28 07:11:58 +00:00
|
|
|
class CertificateCollection;
|
2005-04-09 07:43:15 +00:00
|
|
|
class Global;
|
|
|
|
class KeyStore;
|
2007-04-13 06:32:02 +00:00
|
|
|
class KeyStoreEntry;
|
2007-04-26 01:55:37 +00:00
|
|
|
class KeyStoreInfo;
|
2005-03-28 07:11:58 +00:00
|
|
|
class KeyStoreManager;
|
2007-01-20 07:05:31 +00:00
|
|
|
class Logger;
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Convenience representation for the plugin providers
|
|
|
|
*
|
|
|
|
* You can get a list of providers using the providers()
|
|
|
|
* function
|
|
|
|
*
|
|
|
|
* \sa ProviderListIterator
|
|
|
|
* \sa providers()
|
|
|
|
*/
|
2005-02-27 01:12:26 +00:00
|
|
|
typedef QList<Provider*> ProviderList;
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mode settings for memory allocation
|
|
|
|
*
|
|
|
|
* QCA can use secure memory, however most operating systems
|
|
|
|
* restrict the amount of memory that can be pinned by user
|
|
|
|
* applications, to prevent a denial-of-service attack.
|
|
|
|
*
|
|
|
|
* QCA supports two approaches to getting memory - the mlock
|
|
|
|
* method, which generally requires root (administrator) level
|
|
|
|
* privileges, and the mmap method which is not as secure, but
|
|
|
|
* which should be able to be used by any process.
|
|
|
|
*
|
|
|
|
* \sa Initializer
|
|
|
|
*/
|
|
|
|
enum MemoryMode
|
|
|
|
{
|
|
|
|
Practical, ///< mlock and drop root if available, else mmap
|
|
|
|
Locking, ///< mlock and drop root
|
|
|
|
LockingKeepPrivileges ///< mlock, retaining root privileges
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Direction settings for symmetric algorithms
|
|
|
|
*
|
|
|
|
* For some algorithms, it makes sense to have a "direction", such
|
|
|
|
* as Cipher algorithms which can be used to encrypt or decrypt.
|
|
|
|
*/
|
|
|
|
enum Direction
|
|
|
|
{
|
|
|
|
Encode, ///< Operate in the "forward" direction; for example, encrypting
|
|
|
|
Decode ///< Operate in the "reverse" direction; for example, decrypting
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialise %QCA.
|
|
|
|
* This call is not normally required, because it is cleaner
|
|
|
|
* to use an Initializer.
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \overload
|
|
|
|
*
|
|
|
|
* \param m the MemoryMode to use
|
|
|
|
* \param prealloc the amount of memory in kilobytes to allocate
|
|
|
|
* for secure storage
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void init(MemoryMode m, int prealloc);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean up routine
|
|
|
|
*
|
|
|
|
* This routine cleans up %QCA, including memory allocations
|
|
|
|
* This call is not normally required, because it is cleaner
|
|
|
|
* to use an Initializer
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void deinit();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test if secure storage memory is available
|
|
|
|
*
|
|
|
|
* \return true if secure storage memory is available
|
|
|
|
*/
|
|
|
|
QCA_EXPORT bool haveSecureMemory();
|
|
|
|
|
2007-04-10 23:34:45 +00:00
|
|
|
/**
|
|
|
|
* Test if secure random is available
|
|
|
|
*
|
|
|
|
* Secure random is considered available if the global random
|
|
|
|
* provider is not the default provider.
|
|
|
|
*
|
|
|
|
* \return true if secure random is available
|
|
|
|
*/
|
|
|
|
QCA_EXPORT bool haveSecureRandom();
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
/**
|
|
|
|
* Test if a capability (algorithm) is available.
|
|
|
|
*
|
|
|
|
* Since capabilities are made available at runtime, you
|
|
|
|
* should always check before using a capability the first
|
|
|
|
* time, as shown below.
|
|
|
|
* \code
|
|
|
|
* QCA::init();
|
|
|
|
* if(!QCA::isSupported("sha1"))
|
|
|
|
* printf("SHA1 not supported!\n");
|
|
|
|
* else {
|
|
|
|
* QString result = QCA::SHA1::hashToString(myString);
|
2007-05-11 00:34:10 +00:00
|
|
|
* printf("sha1(\"%s\") = [%s]\n", myString.data(), qPrintable(result));
|
2005-01-01 02:44:28 +00:00
|
|
|
* }
|
|
|
|
* \endcode
|
|
|
|
*
|
|
|
|
* \param features the name of the capability to test for
|
2005-04-17 23:43:32 +00:00
|
|
|
* \param provider if specified, only check for the capability in that
|
|
|
|
specific provider. If not provided, or provided as an empty
|
|
|
|
string, then check for capabilities in all available providers
|
2005-01-01 02:44:28 +00:00
|
|
|
* \return true if the capability is available, otherwise false
|
|
|
|
*
|
|
|
|
* Note that you can test for a combination of capabilities,
|
|
|
|
* using a comma delimited list:
|
|
|
|
* \code
|
|
|
|
* QCA::isSupported("sha1,md5"):
|
|
|
|
* \endcode
|
|
|
|
* which will return true if all of the capabilities listed
|
|
|
|
* are present.
|
|
|
|
*
|
|
|
|
*/
|
2005-04-14 10:28:50 +00:00
|
|
|
QCA_EXPORT bool isSupported(const char *features, const QString &provider = QString());
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
2005-04-17 23:43:32 +00:00
|
|
|
\overload
|
|
|
|
|
|
|
|
\param features a list of features to test for
|
|
|
|
\param provider if specified, only check for the capability in that
|
|
|
|
specific provider. If not provided, or provided as an empty
|
|
|
|
string, then check for capabilities in all available providers
|
|
|
|
*/
|
2005-04-14 10:28:50 +00:00
|
|
|
QCA_EXPORT bool isSupported(const QStringList &features, const QString &provider = QString());
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate a list of all the supported features in plugins,
|
|
|
|
* and in built in capabilities
|
|
|
|
*
|
|
|
|
* \return a list containing the names of the features
|
|
|
|
*
|
|
|
|
* The following code writes a list of features to standard out
|
|
|
|
* \code
|
|
|
|
* QStringList capabilities;
|
|
|
|
* capabilities = QCA::supportedFeatures();
|
|
|
|
* std::cout << "Supported:" << capabilities.join(",") << std::endl;
|
|
|
|
* \endcode
|
|
|
|
*
|
|
|
|
* \sa isSupported(const char *features)
|
|
|
|
* \sa isSupported(const QStringList &features)
|
|
|
|
* \sa defaultFeatures()
|
|
|
|
*/
|
|
|
|
QCA_EXPORT QStringList supportedFeatures();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate a list of the built in features. This differs from
|
|
|
|
* supportedFeatures() in that it does not include features provided
|
|
|
|
* by plugins.
|
|
|
|
*
|
|
|
|
* \return a list containing the names of the features
|
|
|
|
*
|
|
|
|
* The following code writes a list of features to standard out
|
|
|
|
* \code
|
|
|
|
* QStringList capabilities;
|
|
|
|
* capabilities = QCA::defaultFeatures();
|
|
|
|
* std::cout << "Default:" << capabilities.join(",") << std::endl;
|
|
|
|
* \endcode
|
|
|
|
*
|
|
|
|
* \sa isSupported(const char *features)
|
|
|
|
* \sa isSupported(const QStringList &features)
|
|
|
|
* \sa supportedFeatures()
|
|
|
|
*/
|
|
|
|
QCA_EXPORT QStringList defaultFeatures();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a provider to the current list of providers
|
|
|
|
*
|
|
|
|
* This function allows you to add a provider to the
|
|
|
|
* current plugin providers at a specified priority. If
|
|
|
|
* a provider with the name already exists, this call fails.
|
|
|
|
*
|
|
|
|
* \param p a pointer to a Provider object, which must be
|
|
|
|
* set up.
|
|
|
|
* \param priority the priority level to set the provider to
|
|
|
|
*
|
|
|
|
* \return true if the provider is added, and false if the
|
|
|
|
* provider is not added (failure)
|
|
|
|
*
|
|
|
|
* \sa setProviderPriority for a description of the provider priority system
|
|
|
|
*/
|
|
|
|
QCA_EXPORT bool insertProvider(Provider *p, int priority = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Change the priority of a specified provider
|
|
|
|
*
|
|
|
|
* QCA supports a number of providers, and if a number of providers
|
|
|
|
* support the same algorithm, it needs to choose between them. You
|
|
|
|
* can do this at object instantiation time (by specifying the name
|
|
|
|
* of the provider that should be used). Alternatively, you can provide a
|
|
|
|
* relative priority level at an application level, using this call.
|
|
|
|
*
|
|
|
|
* Priority is used at object instantiation time. The provider is selected
|
|
|
|
* according to the following logic:
|
|
|
|
* - if a particular provider is nominated, and that provider supports
|
|
|
|
* the required algorithm, then the nominated provider is used
|
|
|
|
* - if no provider is nominated, or it doesn't support the required
|
|
|
|
* algorithm, then the provider with the lowest priority number will be used,
|
|
|
|
* if that provider supports the algorithm.
|
|
|
|
* - if the provider with the lowest priority number doesn't support
|
|
|
|
* the required algorithm, the provider with the next lowest priority number
|
|
|
|
* will be tried,and so on through to the provider with the largest priority number
|
|
|
|
* - if none of the plugin providers support the required algorithm, then
|
|
|
|
* the default (built-in) provider will be tried.
|
|
|
|
*
|
|
|
|
* \param name the name of the provider
|
|
|
|
* \param priority the new priority of the provider. As a special case, if
|
|
|
|
* you pass in -1, then this provider gets the same priority as the
|
|
|
|
* the last provider that was added or had its priority set using this
|
|
|
|
* call.
|
|
|
|
*
|
|
|
|
* \sa providerPriority
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void setProviderPriority(const QString &name, int priority);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the priority of a specified provider
|
|
|
|
*
|
|
|
|
* The name of the provider (eg "qca-openssl") is used to look up the
|
|
|
|
* current priority associated with that provider. If the provider
|
|
|
|
* is not found (or something else went wrong), -1 is returned.
|
|
|
|
*
|
|
|
|
* \param name the name of the provider
|
|
|
|
*
|
|
|
|
* \return the current priority level
|
|
|
|
*
|
|
|
|
* \sa setProviderPriority for a description of the provider priority system
|
|
|
|
*/
|
|
|
|
QCA_EXPORT int providerPriority(const QString &name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a list of the current providers
|
|
|
|
*
|
|
|
|
* The current plugin providers are provided as a list, which you
|
|
|
|
* can iterate over using ProviderListIterator.
|
|
|
|
*
|
|
|
|
* \sa ProviderList
|
|
|
|
* \sa ProviderListIterator
|
|
|
|
*/
|
2005-04-09 07:43:15 +00:00
|
|
|
QCA_EXPORT ProviderList providers();
|
|
|
|
|
2005-04-14 10:28:50 +00:00
|
|
|
/**
|
|
|
|
* Return the named provider, or 0 if not found
|
|
|
|
*/
|
|
|
|
QCA_EXPORT Provider *findProvider(const QString &name);
|
|
|
|
|
2005-04-09 07:43:15 +00:00
|
|
|
/**
|
|
|
|
* Return the default provider
|
|
|
|
*/
|
|
|
|
QCA_EXPORT Provider *defaultProvider();
|
2005-01-01 02:44:28 +00:00
|
|
|
|
2005-02-28 02:28:23 +00:00
|
|
|
/**
|
|
|
|
* Scan for new plugins
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void scanForPlugins();
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
/**
|
|
|
|
* Unload the current plugins
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void unloadAllPlugins();
|
|
|
|
|
2006-02-24 08:08:43 +00:00
|
|
|
/**
|
|
|
|
* Retrieve plugin diagnostic text
|
|
|
|
*/
|
|
|
|
QCA_EXPORT QString pluginDiagnosticText();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear plugin diagnostic text
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void clearPluginDiagnosticText();
|
|
|
|
|
2007-05-08 07:50:11 +00:00
|
|
|
/**
|
|
|
|
* Add plugin diagnostic text
|
|
|
|
*
|
|
|
|
* This function should only be called by providers.
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void appendPluginDiagnosticText(const QString &text);
|
|
|
|
|
2005-04-14 10:47:29 +00:00
|
|
|
/**
|
|
|
|
* Set a global property
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void setProperty(const QString &name, const QVariant &value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve a global property
|
|
|
|
*/
|
|
|
|
QCA_EXPORT QVariant getProperty(const QString &name);
|
|
|
|
|
2006-11-15 07:05:50 +00:00
|
|
|
/**
|
|
|
|
* Set provider configuration
|
|
|
|
*
|
|
|
|
* Allowed value types: QString, int, bool
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void setProviderConfig(const QString &name, const QVariantMap &config);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve provider configuration
|
|
|
|
*/
|
|
|
|
QCA_EXPORT QVariantMap getProviderConfig(const QString &name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save provider configuration to persistent storage
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void saveProviderConfig(const QString &name);
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
/**
|
2007-04-10 23:34:45 +00:00
|
|
|
* Return the name of the global random number provider
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
2007-04-10 23:34:45 +00:00
|
|
|
QCA_EXPORT QString globalRandomProvider();
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
2007-04-10 23:34:45 +00:00
|
|
|
* Change the global random number provider
|
2005-01-01 02:44:28 +00:00
|
|
|
*
|
|
|
|
* The Random capabilities of %QCA are provided as part of the
|
|
|
|
* built in capabilities, however the generator can be changed
|
|
|
|
* if required.
|
|
|
|
*/
|
2007-04-10 23:34:45 +00:00
|
|
|
QCA_EXPORT void setGlobalRandomProvider(const QString &provider);
|
2005-01-01 02:44:28 +00:00
|
|
|
|
2007-01-20 07:05:31 +00:00
|
|
|
/**
|
|
|
|
Return a reference to the %QCA Logger, which is used for diagnostics
|
|
|
|
and error recording.
|
|
|
|
|
|
|
|
The system Logger is automatically created for you on start.
|
|
|
|
*/
|
|
|
|
QCA_EXPORT Logger *logger();
|
|
|
|
|
|
|
|
/**
|
2007-04-08 12:29:44 +00:00
|
|
|
Log a text message. This is an efficient function
|
|
|
|
to avoid overhead of argument executions when log level
|
|
|
|
blocks the message.
|
2007-01-20 07:05:31 +00:00
|
|
|
|
|
|
|
\param message the text to log
|
|
|
|
\param severity the type of information to log
|
2007-04-08 12:29:44 +00:00
|
|
|
|
|
|
|
\note This is a macro, so arguments may or may not be evaluated.
|
2007-01-20 07:05:31 +00:00
|
|
|
*/
|
2007-04-08 12:29:44 +00:00
|
|
|
# define QCA_logTextMessage(message, severity) \
|
|
|
|
do { \
|
|
|
|
register QCA::Logger::Severity s = severity; \
|
|
|
|
register QCA::Logger *l = QCA::logger (); \
|
|
|
|
if (s <= l->level ()) { \
|
|
|
|
l->logTextMessage (message, s); \
|
|
|
|
} \
|
|
|
|
} while (false)
|
|
|
|
|
|
|
|
/**
|
|
|
|
Log a binary message. This is an efficient function
|
|
|
|
to avoid overhead of argument executions when log level
|
|
|
|
blocks the message.
|
2007-01-20 07:05:31 +00:00
|
|
|
|
2007-04-08 12:29:44 +00:00
|
|
|
\param blob the blob to log
|
|
|
|
\param severity the type of information to log
|
|
|
|
|
|
|
|
\note This is a macro, so arguments may or may not be evaluated.
|
|
|
|
*/
|
|
|
|
# define QCA_logBinaryMessage(blob, severity) \
|
|
|
|
do { \
|
|
|
|
register QCA::Logger::Severity s = severity; \
|
|
|
|
register QCA::Logger *l = QCA::logger (); \
|
|
|
|
if (s <= l->level ()) { \
|
|
|
|
l->logBinaryMessage (blob, s); \
|
|
|
|
} \
|
|
|
|
} while (false)
|
2007-04-13 00:42:19 +00:00
|
|
|
|
2005-01-12 10:36:39 +00:00
|
|
|
/**
|
|
|
|
Test if QCA can access the root CA certificates
|
|
|
|
|
2005-03-28 07:11:58 +00:00
|
|
|
If root certificates are available, this function returns true,
|
2005-01-12 10:36:39 +00:00
|
|
|
otherwise it returns false.
|
|
|
|
|
|
|
|
\sa systemStore
|
|
|
|
*/
|
2005-01-01 02:44:28 +00:00
|
|
|
QCA_EXPORT bool haveSystemStore();
|
2005-01-12 10:36:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Get system-wide root CA certificates
|
|
|
|
|
|
|
|
\sa haveSystemStore
|
|
|
|
*/
|
2005-04-09 07:43:15 +00:00
|
|
|
QCA_EXPORT CertificateCollection systemStore();
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the application name that will be used by SASL server mode
|
|
|
|
*
|
|
|
|
* The application name is used by SASL in server mode, as some systems might
|
|
|
|
* have different security policies depending on the app.
|
|
|
|
* The default application name is 'qca'
|
|
|
|
*/
|
|
|
|
QCA_EXPORT QString appName();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the application name that will be used by SASL server mode
|
|
|
|
*
|
|
|
|
* The application name is used by SASL in server mode, as some systems might
|
|
|
|
* have different security policies depending on the app. This should be set
|
|
|
|
* before using SASL objects, and it cannot be changed later.
|
|
|
|
*
|
|
|
|
* \param name the name string to use for SASL server mode
|
|
|
|
*/
|
|
|
|
QCA_EXPORT void setAppName(const QString &name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a byte array to printable hexadecimal
|
|
|
|
* representation.
|
|
|
|
*
|
|
|
|
* This is a convenience function to convert an arbitrary
|
2007-04-13 19:04:16 +00:00
|
|
|
* SecureArray to a printable representation.
|
2005-01-01 02:44:28 +00:00
|
|
|
*
|
|
|
|
* \code
|
2007-04-13 19:04:16 +00:00
|
|
|
* SecureArray test(10);
|
2005-01-01 02:44:28 +00:00
|
|
|
* test.fill('a');
|
|
|
|
* // 0x61 is 'a' in ASCII
|
|
|
|
* if (QString("61616161616161616161") == QCA::arrayToHex(test) ) {
|
|
|
|
* printf ("arrayToHex passed\n");
|
|
|
|
* }
|
|
|
|
* \endcode
|
|
|
|
*
|
|
|
|
* \param array the array to be converted
|
|
|
|
* \return a printable representation
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
QCA_EXPORT QString arrayToHex(const SecureArray &array);
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a QString containing a hexadecimal representation
|
|
|
|
* of a byte array into a QByteArray
|
|
|
|
*
|
|
|
|
* This is a convenience function to convert a printable
|
|
|
|
* representation into a QByteArray - effectively the inverse
|
|
|
|
* of QCA::arrayToHex.
|
|
|
|
*
|
|
|
|
* \code
|
|
|
|
* QCA::init();
|
|
|
|
* QByteArray test(10);
|
|
|
|
*
|
|
|
|
* test.fill('b'); // 0x62 in hexadecimal
|
|
|
|
* test[7] = 0x00; // can handle strings with nulls
|
|
|
|
*
|
|
|
|
* if (QCA::hexToArray(QString("62626262626262006262") ) == test ) {
|
|
|
|
* printf ("hexToArray passed\n");
|
|
|
|
* }
|
|
|
|
* \endcode
|
|
|
|
*
|
|
|
|
* \param hexString the string containing a printable
|
|
|
|
* representation to be converted
|
|
|
|
* \return the equivalent QByteArray
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
QCA_EXPORT QByteArray hexToArray(const QString &hexString);
|
|
|
|
|
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
\class Initializer qca_core.h QtCrypto
|
|
|
|
|
|
|
|
Convenience method for initialising and cleaning up %QCA
|
|
|
|
|
|
|
|
To ensure that QCA is properly initialised and cleaned up,
|
|
|
|
it is convenient to create an Initializer object, and let it
|
|
|
|
go out of scope at the end of %QCA usage.
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
|
|
|
class QCA_EXPORT Initializer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Standard constructor
|
|
|
|
*
|
|
|
|
* \param m the MemoryMode to use for secure memory
|
|
|
|
* \param prealloc the amount of secure memory to pre-allocate,
|
|
|
|
* in units of 1024 bytes (1K).
|
|
|
|
*/
|
2007-04-18 21:02:46 +00:00
|
|
|
explicit Initializer(MemoryMode m = Practical, int prealloc = 64);
|
2005-01-01 02:44:28 +00:00
|
|
|
~Initializer();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
\class KeyLength qca_core.h QtCrypto
|
|
|
|
|
|
|
|
Simple container for acceptable key lengths
|
|
|
|
|
|
|
|
The KeyLength specifies the minimum and maximum byte sizes
|
|
|
|
allowed for a key, as well as a "multiple" which the key
|
|
|
|
size must evenly divide into.
|
|
|
|
|
|
|
|
As an example, if the key can be 4, 8 or 12 bytes, you can
|
|
|
|
express this as
|
|
|
|
\code
|
|
|
|
KeyLength keyLen( 4, 12, 4 );
|
|
|
|
\endcode
|
|
|
|
|
|
|
|
If you want to express a KeyLength that takes any number
|
|
|
|
of bytes (including zero), you may want to use
|
|
|
|
\code
|
|
|
|
#include<limits>
|
|
|
|
KeyLength( 0, std::numeric_limits<int>::max(), 1 );
|
|
|
|
\endcode
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
|
|
|
class QCA_EXPORT KeyLength
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Construct a %KeyLength object
|
|
|
|
*
|
|
|
|
* \param min the minimum length of the key, in bytes
|
|
|
|
* \param max the maximum length of the key, in bytes
|
|
|
|
* \param multiple the number of bytes that the key must be a
|
|
|
|
* multiple of.
|
|
|
|
*/
|
|
|
|
KeyLength(int min, int max, int multiple)
|
|
|
|
: _min( min ), _max(max), _multiple( multiple )
|
|
|
|
{ }
|
2007-06-01 01:08:25 +00:00
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
/**
|
|
|
|
* Obtain the minimum length for the key, in bytes
|
|
|
|
*/
|
|
|
|
int minimum() const { return _min; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the maximum length for the key, in bytes
|
|
|
|
*/
|
|
|
|
int maximum() const { return _max; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the number of bytes that the key must be a multiple of
|
|
|
|
*
|
2007-01-01 09:01:23 +00:00
|
|
|
* If this is one, then anything between minimum and maximum (inclusive)
|
2005-01-01 02:44:28 +00:00
|
|
|
* is acceptable.
|
|
|
|
*/
|
|
|
|
int multiple() const { return _multiple; }
|
|
|
|
|
|
|
|
private:
|
2007-06-01 01:08:25 +00:00
|
|
|
const int _min, _max, _multiple;
|
2005-01-01 02:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
\class Provider qca_core.h QtCrypto
|
|
|
|
|
|
|
|
Algorithm provider
|
|
|
|
|
|
|
|
Provider represents a plugin provider (or as a special case, the
|
|
|
|
built-in provider). This is the class you need to inherit
|
|
|
|
from to create your own plugin. You don't normally need to
|
|
|
|
worry about this class if you are just using existing
|
|
|
|
QCA capabilities and plugins, however there is nothing stopping
|
|
|
|
you from using it to obtain information about specific plugins,
|
|
|
|
as shown in the example below.
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
|
|
|
class QCA_EXPORT Provider
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~Provider();
|
|
|
|
|
2006-11-13 00:47:46 +00:00
|
|
|
class Context;
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialisation routine.
|
|
|
|
*
|
|
|
|
* This routine will be called when your plugin
|
|
|
|
* is loaded, so this is a good place to do any
|
|
|
|
* one-off initialisation tasks. If you don't need
|
|
|
|
* any initialisation, just implement it as an empty
|
|
|
|
* routine.
|
|
|
|
*/
|
|
|
|
virtual void init();
|
|
|
|
|
2006-11-12 23:01:27 +00:00
|
|
|
/**
|
|
|
|
* Target QCA version for the provider.
|
|
|
|
*
|
|
|
|
* This is used to verify compatibility between the
|
|
|
|
* provider and QCA. For a provider to be used, it
|
|
|
|
* must have major and minor version numbers that are
|
|
|
|
* less-than or equal to the QCA version (the patch
|
|
|
|
* version number is ignored). This means an older
|
|
|
|
* provider may be used with a newer QCA, but a newer
|
|
|
|
* provider cannot be used with an older QCA.
|
|
|
|
*/
|
|
|
|
virtual int version() const = 0;
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
/**
|
|
|
|
* The name of the provider.
|
|
|
|
*
|
|
|
|
* Typically you just return a string containing a
|
|
|
|
* convenient name.
|
|
|
|
*
|
|
|
|
* \code
|
|
|
|
* QString name() const
|
|
|
|
* {
|
|
|
|
* return "qca-myplugin";
|
|
|
|
* }
|
|
|
|
* \endcode
|
|
|
|
*
|
|
|
|
* \note The name is used to tell if a provider is
|
|
|
|
* already loaded, so you need to make sure it is
|
|
|
|
* unique amongst the various plugins.
|
|
|
|
*/
|
|
|
|
virtual QString name() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The capabilities (algorithms) of the provider.
|
|
|
|
*
|
|
|
|
* Typically you just return a fixed QStringList:
|
|
|
|
* \code
|
|
|
|
* QStringList features() const
|
|
|
|
* {
|
|
|
|
* QStringList list;
|
|
|
|
* list += "sha1";
|
|
|
|
* list += "sha256";
|
|
|
|
* list += "hmac(md5)";
|
|
|
|
* return list;
|
|
|
|
* }
|
|
|
|
* \endcode
|
|
|
|
*/
|
|
|
|
virtual QStringList features() const = 0;
|
|
|
|
|
2006-02-25 02:43:31 +00:00
|
|
|
/**
|
|
|
|
* Optional credit text for the provider.
|
|
|
|
*
|
|
|
|
* You might display this information in a credits or
|
|
|
|
* "About" dialog. Returns an empty string if the
|
|
|
|
* provider has no credit text.
|
|
|
|
*/
|
|
|
|
virtual QString credit() const;
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
/**
|
|
|
|
* Routine to create a plugin context
|
|
|
|
*
|
|
|
|
* You need to return a pointer to an algorithm
|
|
|
|
* Context that corresponds with the algorithm
|
|
|
|
* name specified.
|
|
|
|
*
|
|
|
|
* \param type the name of the algorithm required
|
|
|
|
*
|
|
|
|
* \code
|
|
|
|
* Context *createContext(const QString &type)
|
|
|
|
* {
|
|
|
|
* if ( type == "sha1" )
|
|
|
|
* return new SHA1Context( this );
|
|
|
|
* else if ( type == "sha256" )
|
|
|
|
* return new SHA0256Context( this );
|
|
|
|
* else if ( type == "hmac(sha1)" )
|
|
|
|
* return new HMACSHA1Context( this );
|
|
|
|
* else
|
|
|
|
* return 0;
|
|
|
|
* }
|
|
|
|
* \endcode
|
|
|
|
*
|
|
|
|
* Naturally you also need to implement
|
|
|
|
* the specified Context subclasses as well.
|
|
|
|
*/
|
|
|
|
virtual Context *createContext(const QString &type) = 0;
|
2006-11-15 07:05:50 +00:00
|
|
|
|
|
|
|
virtual QVariantMap defaultConfig() const;
|
|
|
|
virtual void configChanged(const QVariantMap &config);
|
2005-01-01 02:44:28 +00:00
|
|
|
};
|
|
|
|
|
2006-11-13 00:47:46 +00:00
|
|
|
/**
|
|
|
|
\class Context qca_core.h QtCrypto
|
|
|
|
|
|
|
|
Internal context class used for the plugin
|
|
|
|
|
|
|
|
\internal
|
|
|
|
*/
|
|
|
|
class QCA_EXPORT Provider::Context : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
virtual ~Context();
|
|
|
|
|
|
|
|
/**
|
|
|
|
The Provider associated with this Context
|
|
|
|
*/
|
|
|
|
Provider *provider() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
The type of context, as passed to the constructor
|
|
|
|
*/
|
|
|
|
QString type() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Create a duplicate of this Context
|
|
|
|
*/
|
|
|
|
virtual Context *clone() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Test if two Contexts have the same Provider
|
|
|
|
|
|
|
|
\param c pointer to the Context to compare to
|
|
|
|
|
|
|
|
\return true if the argument and this Context
|
|
|
|
have the same provider.
|
|
|
|
*/
|
|
|
|
bool sameProvider(const Context *c) const;
|
|
|
|
|
2007-05-30 07:02:34 +00:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
Standard constructor
|
|
|
|
|
|
|
|
\param parent the parent provider for this
|
|
|
|
context
|
|
|
|
\param type the name of the provider context type
|
|
|
|
*/
|
|
|
|
Context(Provider *parent, const QString &type);
|
|
|
|
|
|
|
|
// copy constructor
|
|
|
|
Context(const Context &from);
|
|
|
|
|
2006-11-13 00:47:46 +00:00
|
|
|
private:
|
2007-05-30 07:02:34 +00:00
|
|
|
// disable assignment
|
|
|
|
Context & operator=(const Context &from);
|
|
|
|
|
2006-11-13 00:47:46 +00:00
|
|
|
Provider *_provider;
|
|
|
|
QString _type;
|
|
|
|
};
|
|
|
|
|
2007-04-24 17:17:12 +00:00
|
|
|
class QCA_EXPORT BasicContext : public Provider::Context
|
2006-11-13 00:47:46 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-05-30 07:02:34 +00:00
|
|
|
~BasicContext();
|
|
|
|
|
|
|
|
protected:
|
2006-11-13 00:47:46 +00:00
|
|
|
BasicContext(Provider *parent, const QString &type);
|
|
|
|
BasicContext(const BasicContext &from);
|
2007-05-30 07:02:34 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// disable assignment
|
|
|
|
BasicContext & operator=(const BasicContext &from);
|
2006-11-13 00:47:46 +00:00
|
|
|
};
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
\class BufferedComputation qca_core.h QtCrypto
|
|
|
|
|
|
|
|
General superclass for buffered computation algorithms
|
2005-01-01 02:44:28 +00:00
|
|
|
|
2005-01-18 09:59:10 +00:00
|
|
|
A buffered computation is characterised by having the
|
|
|
|
algorithm take data in an incremental way, then having
|
|
|
|
the results delivered at the end. Conceptually, the
|
|
|
|
algorithm has some internal state that is modified
|
|
|
|
when you call update() and returned when you call
|
|
|
|
final().
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
|
|
|
class QCA_EXPORT BufferedComputation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~BufferedComputation();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Reset the internal state
|
|
|
|
*/
|
|
|
|
virtual void clear() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Update the internal state with a byte array
|
|
|
|
|
|
|
|
\param a the byte array of data that is to
|
|
|
|
be used to update the internal state.
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
virtual void update(const SecureArray &a) = 0;
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Complete the algorithm and return the internal state
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
virtual SecureArray final() = 0;
|
2005-01-01 02:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Perform an "all in one" update, returning
|
|
|
|
the result. This is appropriate if you
|
|
|
|
have all the data in one array - just
|
|
|
|
call process on that array, and you will
|
|
|
|
get back the results of the computation.
|
|
|
|
|
|
|
|
\note This will invalidate any previous
|
|
|
|
computation using this object.
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
SecureArray process(const SecureArray &a);
|
2005-01-01 02:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
\class Filter qca_core.h QtCrypto
|
2005-01-01 02:44:28 +00:00
|
|
|
|
2005-01-18 09:59:10 +00:00
|
|
|
General superclass for filtering transformation algorithms
|
2005-01-09 10:11:12 +00:00
|
|
|
|
2005-01-18 09:59:10 +00:00
|
|
|
A filtering computation is characterised by having the
|
|
|
|
algorithm take input data in an incremental way, with results
|
|
|
|
delivered for each input, or block of input. Some internal
|
|
|
|
state may be managed, with the transformation completed
|
|
|
|
when final() is called.
|
|
|
|
|
|
|
|
If this seems a big vague, then you might try deriving
|
|
|
|
your class from a subclass with stronger semantics, or if your
|
|
|
|
update() function is always returning null results, and
|
|
|
|
everything comes out at final(), try BufferedComputation.
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
|
|
|
class QCA_EXPORT Filter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~Filter();
|
|
|
|
|
2005-01-09 10:11:12 +00:00
|
|
|
/**
|
|
|
|
Reset the internal state
|
|
|
|
*/
|
2005-01-01 02:44:28 +00:00
|
|
|
virtual void clear() = 0;
|
2005-01-09 10:11:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Process more data, returning the corresponding
|
|
|
|
filtered version of the data.
|
|
|
|
|
|
|
|
\param a the array containing data to process
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
virtual SecureArray update(const SecureArray &a) = 0;
|
2005-01-09 10:11:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Complete the algorithm, returning any
|
|
|
|
additional results.
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
virtual SecureArray final() = 0;
|
2005-01-09 10:11:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Test if an update() or final() call succeeded.
|
|
|
|
|
|
|
|
\return true if the previous call succeeded
|
|
|
|
*/
|
2005-01-01 02:44:28 +00:00
|
|
|
virtual bool ok() const = 0;
|
2005-01-09 10:11:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Perform an "all in one" update, returning
|
|
|
|
the result. This is appropriate if you
|
|
|
|
have all the data in one array - just
|
|
|
|
call process on that array, and you will
|
|
|
|
get back the results of the computation.
|
|
|
|
|
|
|
|
\note This will invalidate any previous
|
|
|
|
computation using this object.
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
SecureArray process(const SecureArray &a);
|
2005-01-01 02:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
\class Algorithm qca_core.h QtCrypto
|
|
|
|
|
2006-03-25 10:44:30 +00:00
|
|
|
General superclass for an algorithm.
|
|
|
|
|
|
|
|
This is a fairly abstract class, mainly used for
|
|
|
|
implementing the backend "provider" interface.
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
|
|
|
class QCA_EXPORT Algorithm
|
|
|
|
{
|
|
|
|
public:
|
2005-01-09 10:11:12 +00:00
|
|
|
/**
|
|
|
|
Standard copy constructor
|
|
|
|
|
|
|
|
\param from the Algorithm to copy from
|
|
|
|
*/
|
2005-01-01 02:44:28 +00:00
|
|
|
Algorithm(const Algorithm &from);
|
2005-03-01 01:05:21 +00:00
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
virtual ~Algorithm();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Assignment operator
|
|
|
|
|
|
|
|
\param from the Algorithm to copy state from
|
|
|
|
*/
|
|
|
|
Algorithm & operator=(const Algorithm &from);
|
|
|
|
|
|
|
|
/**
|
2006-03-25 10:44:30 +00:00
|
|
|
The name of the algorithm type.
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
|
|
|
QString type() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
The name of the provider
|
|
|
|
|
|
|
|
Each algorithm is implemented by a provider. This
|
|
|
|
allows you to figure out which provider is associated
|
|
|
|
*/
|
|
|
|
Provider *provider() const;
|
|
|
|
|
2005-04-09 07:43:15 +00:00
|
|
|
// Note: The next five functions are not public!
|
2005-01-09 10:11:12 +00:00
|
|
|
|
|
|
|
/**
|
2006-03-25 10:44:30 +00:00
|
|
|
\internal
|
|
|
|
|
|
|
|
The context associated with this algorithm
|
2005-01-09 10:11:12 +00:00
|
|
|
*/
|
2005-03-01 01:05:21 +00:00
|
|
|
Provider::Context *context();
|
|
|
|
|
|
|
|
/**
|
2006-03-25 10:44:30 +00:00
|
|
|
\internal
|
|
|
|
|
|
|
|
The context associated with this algorithm
|
2005-03-01 01:05:21 +00:00
|
|
|
*/
|
|
|
|
const Provider::Context *context() const;
|
2005-01-09 10:11:12 +00:00
|
|
|
|
|
|
|
/**
|
2006-03-25 10:44:30 +00:00
|
|
|
\internal
|
|
|
|
|
|
|
|
Set the Provider for this algorithm
|
2005-01-09 10:11:12 +00:00
|
|
|
|
|
|
|
\param c the context for the Provider to use
|
|
|
|
*/
|
2005-01-01 02:44:28 +00:00
|
|
|
void change(Provider::Context *c);
|
2005-01-09 10:11:12 +00:00
|
|
|
|
|
|
|
/**
|
2006-03-25 10:44:30 +00:00
|
|
|
\internal
|
|
|
|
|
2005-01-09 10:11:12 +00:00
|
|
|
\overload
|
|
|
|
|
|
|
|
\param type the name of the algorithm to use
|
|
|
|
\param provider the name of the preferred provider
|
|
|
|
*/
|
2005-01-01 02:44:28 +00:00
|
|
|
void change(const QString &type, const QString &provider);
|
2005-01-09 10:11:12 +00:00
|
|
|
|
2005-04-09 07:43:15 +00:00
|
|
|
/**
|
2006-03-25 10:44:30 +00:00
|
|
|
\internal
|
|
|
|
|
|
|
|
Take the Provider from this algorithm
|
2005-04-09 07:43:15 +00:00
|
|
|
*/
|
|
|
|
Provider::Context *takeContext();
|
|
|
|
|
2005-03-03 21:56:23 +00:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
Constructor for empty algorithm
|
|
|
|
*/
|
|
|
|
Algorithm();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor of a particular algorithm.
|
|
|
|
|
|
|
|
\param type the algorithm to construct
|
|
|
|
\param provider the name of a particular Provider
|
|
|
|
*/
|
|
|
|
Algorithm(const QString &type, const QString &provider);
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
private:
|
|
|
|
class Private;
|
2005-03-01 01:05:21 +00:00
|
|
|
QSharedDataPointer<Private> d;
|
2005-01-01 02:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2005-03-01 01:50:20 +00:00
|
|
|
\class SymmetricKey qca_core.h QtCrypto
|
2005-01-18 09:59:10 +00:00
|
|
|
|
|
|
|
Container for keys for symmetric encryption algorithms.
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
class QCA_EXPORT SymmetricKey : public SecureArray
|
2005-01-01 02:44:28 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Construct an empty (zero length) key
|
|
|
|
*/
|
|
|
|
SymmetricKey();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct an key of specified size, with random contents
|
|
|
|
*
|
|
|
|
* This is intended to be used as a random session key.
|
|
|
|
*
|
|
|
|
* \param size the number of bytes for the key
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
SymmetricKey(int size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a key from a provided byte array
|
|
|
|
*
|
|
|
|
* \param a the byte array to copy
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
SymmetricKey(const SecureArray &a);
|
2005-01-01 02:44:28 +00:00
|
|
|
|
2005-03-02 08:04:56 +00:00
|
|
|
/**
|
|
|
|
* Construct a key from a provided byte array
|
|
|
|
*
|
|
|
|
* \param a the byte array to copy
|
|
|
|
*/
|
|
|
|
SymmetricKey(const QByteArray &a);
|
|
|
|
|
2005-01-01 02:44:28 +00:00
|
|
|
/**
|
|
|
|
* Test for weak DES keys
|
|
|
|
*
|
|
|
|
* \return true if the key is a weak key for DES
|
|
|
|
*/
|
|
|
|
bool isWeakDESKey();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
\class InitializationVector qca_core.h QtCrypto
|
|
|
|
|
|
|
|
Container for initialisation vectors and nonces
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
class QCA_EXPORT InitializationVector : public SecureArray
|
2005-01-01 02:44:28 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
Construct an empty (zero length) initisation vector
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
|
|
|
InitializationVector();
|
|
|
|
|
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
Construct an initialisation vector of the specified size
|
|
|
|
|
|
|
|
\param size the length of the initialisation vector, in bytes
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
|
|
|
InitializationVector(int size);
|
|
|
|
|
|
|
|
/**
|
2005-01-18 09:59:10 +00:00
|
|
|
Construct an initialisation vector from a provided byte array
|
|
|
|
|
|
|
|
\param a the byte array to copy
|
2005-01-01 02:44:28 +00:00
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
InitializationVector(const SecureArray &a);
|
2005-03-02 08:04:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Construct an initialisation vector from a provided byte array
|
|
|
|
|
|
|
|
\param a the byte array to copy
|
|
|
|
*/
|
|
|
|
InitializationVector(const QByteArray &a);
|
2005-01-01 02:44:28 +00:00
|
|
|
};
|
2006-04-06 21:43:31 +00:00
|
|
|
|
2006-10-13 11:29:30 +00:00
|
|
|
/**
|
|
|
|
An asynchronous event
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
Events are produced in response to the library's need for some user
|
|
|
|
intervention, such as entering a pin or password, or inserting a cryptographic
|
|
|
|
token.
|
|
|
|
|
|
|
|
Event is an abstraction, so you can handle this need in a way that makes sense
|
|
|
|
for your application.
|
2006-10-13 11:29:30 +00:00
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
class QCA_EXPORT Event
|
|
|
|
{
|
|
|
|
public:
|
2006-10-13 11:29:30 +00:00
|
|
|
/**
|
2007-03-19 09:28:19 +00:00
|
|
|
%Type of event
|
|
|
|
|
|
|
|
\sa type()
|
2006-10-13 11:29:30 +00:00
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
enum Type
|
|
|
|
{
|
2007-03-19 09:28:19 +00:00
|
|
|
Password, ///< Asking for a password, PIN or passphrase.
|
2006-04-06 21:43:31 +00:00
|
|
|
Token ///< Asking for a token
|
|
|
|
};
|
|
|
|
|
2006-10-13 11:29:30 +00:00
|
|
|
/**
|
2007-03-19 09:28:19 +00:00
|
|
|
%Source of the event
|
|
|
|
|
|
|
|
Events are associated with access to a KeyStore, or access to
|
|
|
|
a file (or bytearray/stream or equivalent). This tells you the
|
|
|
|
type of source that caused the Event.
|
|
|
|
|
|
|
|
\sa source()
|
|
|
|
\sa fileName() for the name, if source is Event::Data
|
2007-04-26 01:55:37 +00:00
|
|
|
\sa keyStoreInfo() and keyStoreEntry() for the keystore and entry, if
|
2007-03-19 09:28:19 +00:00
|
|
|
the source is Event::KeyStore
|
2006-10-13 11:29:30 +00:00
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
enum Source
|
|
|
|
{
|
|
|
|
KeyStore, ///< KeyStore generated the event
|
2007-03-19 09:28:19 +00:00
|
|
|
Data ///< File or bytearray generated the event
|
2006-04-06 21:43:31 +00:00
|
|
|
};
|
|
|
|
|
2006-10-13 11:29:30 +00:00
|
|
|
/**
|
|
|
|
password variation
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
If the Type of Event is Password, PasswordStyle tells you whether
|
|
|
|
it is a PIN, passphrase or password.
|
|
|
|
|
|
|
|
\sa passwordStyle()
|
2006-10-13 11:29:30 +00:00
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
enum PasswordStyle
|
|
|
|
{
|
|
|
|
StylePassword, ///< User should be prompted for a "Password"
|
|
|
|
StylePassphrase, ///< User should be prompted for a "Passphrase"
|
|
|
|
StylePIN ///< User should be prompted for a "PIN"
|
|
|
|
};
|
|
|
|
|
2006-10-13 11:29:30 +00:00
|
|
|
/**
|
|
|
|
Constructor
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
Event();
|
2006-10-13 11:29:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Copy constructor
|
|
|
|
|
|
|
|
\param from the Event to copy from
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
Event(const Event &from);
|
2006-10-13 11:29:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
~Event();
|
2006-10-13 11:29:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Assignment operator
|
|
|
|
|
|
|
|
\param from the Event to copy from
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
Event & operator=(const Event &from);
|
|
|
|
|
2006-10-13 11:29:30 +00:00
|
|
|
/**
|
|
|
|
test if this event has been setup correctly
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
bool isNull() const;
|
|
|
|
|
2006-10-13 11:29:30 +00:00
|
|
|
/**
|
|
|
|
the Type of this event
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
Type type() const;
|
|
|
|
|
2006-10-13 11:29:30 +00:00
|
|
|
/**
|
|
|
|
the Source of this event
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
Source source() const;
|
2006-10-13 11:29:30 +00:00
|
|
|
|
|
|
|
/**
|
2007-03-19 09:28:19 +00:00
|
|
|
the style of password required.
|
|
|
|
|
|
|
|
This is not meaningful unless the Type is Event::Password.
|
|
|
|
|
|
|
|
\sa PasswordStyle
|
2006-10-13 11:29:30 +00:00
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
PasswordStyle passwordStyle() const;
|
2006-10-13 11:29:30 +00:00
|
|
|
|
2006-12-18 07:08:16 +00:00
|
|
|
/**
|
2007-04-26 01:55:37 +00:00
|
|
|
The info of the KeyStore associated with this event
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
This is not meaningful unless the Source is KeyStore.
|
2006-12-18 07:08:16 +00:00
|
|
|
*/
|
2007-04-26 01:55:37 +00:00
|
|
|
KeyStoreInfo keyStoreInfo() const;
|
2007-04-26 01:19:55 +00:00
|
|
|
|
2006-12-18 07:08:16 +00:00
|
|
|
/**
|
2007-04-13 06:32:02 +00:00
|
|
|
The KeyStoreEntry associated with this event
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
This is not meaningful unless the Source is KeyStore.
|
2006-12-18 07:08:16 +00:00
|
|
|
*/
|
2007-04-13 06:32:02 +00:00
|
|
|
KeyStoreEntry keyStoreEntry() const;
|
2006-12-18 07:08:16 +00:00
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Name or other identifier for the file or byte array
|
|
|
|
associated with this event.
|
|
|
|
|
|
|
|
This is not meaningful unless the Source is Data.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
QString fileName() const;
|
2006-10-13 11:29:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
opaque data
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void *ptr() const;
|
|
|
|
|
2006-10-13 11:29:30 +00:00
|
|
|
/**
|
|
|
|
Set the values for this Event
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
This creates a Password type event, for a keystore.
|
|
|
|
|
|
|
|
\param pstyle the style of information required (e.g. PIN, password or passphrase)
|
2007-04-26 01:55:37 +00:00
|
|
|
\param keyStoreInfo info about the keystore that the information is required for
|
2007-04-13 06:32:02 +00:00
|
|
|
\param keyStoreEntry the entry in the keystore that the information is required for
|
2006-10-13 11:29:30 +00:00
|
|
|
\param ptr opaque data
|
|
|
|
*/
|
2007-04-26 01:55:37 +00:00
|
|
|
void setPasswordKeyStore(PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr);
|
2006-10-13 11:29:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Set the values for this Event
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
This creates a Password type event, for a file.
|
|
|
|
|
|
|
|
\param pstyle the style of information required (e.g. PIN, password or passphrase)
|
|
|
|
\param fileName the name of the file (or other identifier) that the information is required for
|
2006-10-13 11:29:30 +00:00
|
|
|
\param ptr opaque data
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void setPasswordData(PasswordStyle pstyle, const QString &fileName, void *ptr);
|
2006-10-13 11:29:30 +00:00
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Set the values for this Event
|
|
|
|
|
|
|
|
This creates a Token type event.
|
|
|
|
|
2007-04-26 01:55:37 +00:00
|
|
|
\param keyStoreInfo info about the keystore that the token is required for
|
2007-04-13 06:32:02 +00:00
|
|
|
\param keyStoreEntry the entry in the keystore that the token is required for
|
2007-03-19 09:28:19 +00:00
|
|
|
\param ptr opaque data
|
|
|
|
*/
|
2007-04-26 01:55:37 +00:00
|
|
|
void setToken(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr);
|
2006-04-06 21:43:31 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
class Private;
|
|
|
|
QSharedDataPointer<Private> d;
|
|
|
|
};
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Interface class for password / passphrase / PIN and token handlers
|
|
|
|
|
|
|
|
This class is used on client side applications to handle
|
|
|
|
the provision of passwords, passphrases and PINs by users, and
|
|
|
|
to indicate that tokens have been correctly inserted.
|
|
|
|
|
|
|
|
The concept behind this class is that the library can raise
|
|
|
|
events (typically using PasswordAsker or TokenAsker), which
|
|
|
|
may (or may not) be handled by the application using a
|
|
|
|
handler object (that has-a EventHandler, or possibly is-a
|
|
|
|
EventHandler) that is connected to the eventReady() signal.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
class QCA_EXPORT EventHandler : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Constructor
|
|
|
|
|
|
|
|
\param parent the parent object for this object
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
EventHandler(QObject *parent = 0);
|
|
|
|
~EventHandler();
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
mandatory function to call after connecting the
|
|
|
|
signal to a slot in your application specific password
|
|
|
|
/ passphrase / PIN or token handler
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void start();
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
function to call to return the user provided
|
|
|
|
password, passphrase or PIN.
|
|
|
|
|
|
|
|
\param id the id corresponding to the password request
|
|
|
|
\param password the user-provided password, passphrase or PIN.
|
|
|
|
|
|
|
|
\note the id parameter is the same as that provided in the
|
|
|
|
eventReady() signal.
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
void submitPassword(int id, const SecureArray &password);
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
function to call to indicate that the token has been inserted
|
|
|
|
by the user.
|
|
|
|
|
|
|
|
\param id the id corresponding to the password request
|
|
|
|
|
|
|
|
\note the id parameter is the same as that provided in the
|
|
|
|
eventReady() signal.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void tokenOkay(int id);
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
function to call to indicate that the user declined to
|
|
|
|
provide a password, passphrase, PIN or token.
|
|
|
|
|
|
|
|
\param id the id corresponding to the password request
|
|
|
|
|
|
|
|
\note the id parameter is the same as that provided in the
|
|
|
|
eventReady() signal.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void reject(int id);
|
|
|
|
|
2007-04-03 11:03:38 +00:00
|
|
|
Q_SIGNALS:
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
signal emitted when an Event requires attention.
|
|
|
|
|
|
|
|
You typically need to connect this signal to
|
|
|
|
a compatible slot in your callback handler
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void eventReady(int id, const QCA::Event &context);
|
|
|
|
|
|
|
|
private:
|
2007-05-30 07:02:34 +00:00
|
|
|
Q_DISABLE_COPY(EventHandler)
|
|
|
|
|
2007-04-07 18:31:59 +00:00
|
|
|
class Private;
|
|
|
|
friend class Private;
|
|
|
|
Private *d;
|
2006-04-06 21:43:31 +00:00
|
|
|
};
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
User password / passphrase / PIN handler
|
|
|
|
|
|
|
|
This class is used to obtain a password from a user.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
class QCA_EXPORT PasswordAsker : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Construct a new asker
|
|
|
|
|
|
|
|
\param parent the parent object for this QObject
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
PasswordAsker(QObject *parent = 0);
|
|
|
|
~PasswordAsker();
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
queue a password / passphrase request associated with a key store
|
|
|
|
|
|
|
|
\param pstyle the type of information required (e.g. PIN, passphrase or password)
|
2007-04-26 01:55:37 +00:00
|
|
|
\param keyStoreInfo info of the key store that the information is required for
|
2007-04-13 06:32:02 +00:00
|
|
|
\param keyStoreEntry the item in the key store that the information is required for (if applicable)
|
2007-03-19 09:28:19 +00:00
|
|
|
\param ptr opaque data
|
|
|
|
*/
|
2007-04-26 01:55:37 +00:00
|
|
|
void ask(Event::PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr);
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
queue a password / passphrase request associated with a file
|
|
|
|
|
|
|
|
\param pstyle the type of information required (e.g. PIN, passphrase or password)
|
|
|
|
\param fileName the name of the file that the information is required for
|
|
|
|
\param ptr opaque data
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void ask(Event::PasswordStyle pstyle, const QString &fileName, void *ptr);
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Cancel the pending password / passphrase request
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void cancel();
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Block until the password / passphrase request is
|
|
|
|
completed
|
|
|
|
|
|
|
|
You can use the responseReady signal instead of
|
|
|
|
blocking, if appropriate.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void waitForResponse();
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Determine whether the password / passphrase was accepted or not
|
|
|
|
|
|
|
|
In this context, returning true is indicative of the user clicking "Ok"
|
|
|
|
or equivalent; and returning false indicates that either the user
|
|
|
|
clicked "Cancel" or equivalent, or that the cancel() function was
|
|
|
|
called, or that the request is still pending.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
bool accepted() const;
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The password / passphrase / PIN provided by the user in response to
|
|
|
|
the asker request. This may be empty.
|
|
|
|
*/
|
2007-04-13 19:04:16 +00:00
|
|
|
SecureArray password() const;
|
2006-04-06 21:43:31 +00:00
|
|
|
|
2007-04-03 11:03:38 +00:00
|
|
|
Q_SIGNALS:
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Emitted when the asker process has been completed.
|
|
|
|
|
|
|
|
You should check whether the user accepted() the response
|
|
|
|
prior to relying on the password().
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void responseReady();
|
|
|
|
|
|
|
|
private:
|
2007-05-30 07:02:34 +00:00
|
|
|
Q_DISABLE_COPY(PasswordAsker)
|
|
|
|
|
2007-04-07 18:31:59 +00:00
|
|
|
class Private;
|
|
|
|
friend class Private;
|
|
|
|
Private *d;
|
2006-04-06 21:43:31 +00:00
|
|
|
};
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
User token handler
|
|
|
|
|
|
|
|
This class is used to request the user to insert a token.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
class QCA_EXPORT TokenAsker : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Construct a new asker
|
|
|
|
|
|
|
|
\param parent the parent object for this QObject
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
TokenAsker(QObject *parent = 0);
|
|
|
|
~TokenAsker();
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
queue a token request associated with a key store
|
|
|
|
|
2007-04-26 01:55:37 +00:00
|
|
|
\param keyStoreInfo info of the key store that the information is required for
|
2007-04-13 06:32:02 +00:00
|
|
|
\param keyStoreEntry the item in the key store that the information is required for (if applicable)
|
2007-03-19 09:28:19 +00:00
|
|
|
\param ptr opaque data
|
|
|
|
*/
|
2007-04-26 01:55:37 +00:00
|
|
|
void ask(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr);
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Cancel the pending password / passphrase request
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void cancel();
|
2007-03-19 09:28:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Block until the token request is completed
|
|
|
|
|
|
|
|
You can use the responseReady signal instead of
|
|
|
|
blocking, if appropriate.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void waitForResponse();
|
|
|
|
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Test if the token request was accepted or not.
|
|
|
|
|
|
|
|
\return true if the token request was accepted
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
bool accepted() const;
|
|
|
|
|
2007-04-03 11:03:38 +00:00
|
|
|
Q_SIGNALS:
|
2007-03-19 09:28:19 +00:00
|
|
|
/**
|
|
|
|
Emitted when the asker process has been completed.
|
|
|
|
|
|
|
|
You should check whether the user accepted() the response
|
|
|
|
prior to relying on token being present.
|
|
|
|
*/
|
2006-04-06 21:43:31 +00:00
|
|
|
void responseReady();
|
|
|
|
|
|
|
|
private:
|
2007-05-30 07:02:34 +00:00
|
|
|
Q_DISABLE_COPY(TokenAsker)
|
|
|
|
|
2007-04-07 18:31:59 +00:00
|
|
|
class Private;
|
|
|
|
friend class Private;
|
|
|
|
Private *d;
|
2006-04-06 21:43:31 +00:00
|
|
|
};
|
2005-01-01 02:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|