Qt Cryptographic Architecture
qca_core.h
Go to the documentation of this file.
1 /*
2  * qca_core.h - Qt Cryptographic Architecture
3  * Copyright (C) 2003-2007 Justin Karneges <justin@affinix.com>
4  * Copyright (C) 2004,2005 Brad Hards <bradh@frogmouth.net>
5  * Copyright (C) 2014-2016 Ivan Romanov <drizt@land.ru>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23 
34 #ifndef QCA_CORE_H
35 #define QCA_CORE_H
36 
37 #include "qca_export.h"
38 #include "qca_support.h"
39 #include "qca_tools.h"
40 #include "qca_version.h"
41 #include <QList>
42 #include <QSharedData>
43 #include <QSharedDataPointer>
44 #include <QString>
45 #include <QStringList>
46 
53 QCA_EXPORT int qcaVersion();
54 
61 QCA_EXPORT const char *qcaVersionStr();
62 
69 QCA_EXPORT int qcaMajorVersion();
70 
77 QCA_EXPORT int qcaMinorVersion();
78 
85 QCA_EXPORT int qcaPatchVersion();
86 
90 namespace QCA {
91 
92 class Provider;
93 class Random;
94 class CertificateCollection;
95 class Global;
96 class KeyStore;
97 class KeyStoreEntry;
98 class KeyStoreInfo;
99 class KeyStoreManager;
100 class Logger;
101 
112 
128 {
132 };
133 
141 {
143  Decode
144 };
145 
151 QCA_EXPORT void init();
152 
160 QCA_EXPORT void init(MemoryMode m, int prealloc);
161 
169 QCA_EXPORT void deinit();
170 
176 QCA_EXPORT bool haveSecureMemory();
177 
186 QCA_EXPORT bool haveSecureRandom();
187 
219 QCA_EXPORT bool isSupported(const char *features, const QString &provider = QString());
220 
229 QCA_EXPORT bool isSupported(const QStringList &features, const QString &provider = QString());
230 
247 QCA_EXPORT QStringList supportedFeatures();
248 
266 QCA_EXPORT QStringList defaultFeatures();
267 
286 QCA_EXPORT bool insertProvider(Provider *p, int priority = 0);
287 
300 QCA_EXPORT bool unloadProvider(const QString &name);
301 
333 QCA_EXPORT void setProviderPriority(const QString &name, int priority);
334 
348 QCA_EXPORT int providerPriority(const QString &name);
349 
359 QCA_EXPORT ProviderList providers();
360 
366 QCA_EXPORT Provider *findProvider(const QString &name);
367 
371 QCA_EXPORT Provider *defaultProvider();
372 
384 QCA_EXPORT QStringList pluginPaths();
385 
389 QCA_EXPORT void scanForPlugins();
390 
394 QCA_EXPORT void unloadAllPlugins();
395 
399 QCA_EXPORT QString pluginDiagnosticText();
400 
404 QCA_EXPORT void clearPluginDiagnosticText();
405 
413 QCA_EXPORT void appendPluginDiagnosticText(const QString &text);
414 
423 QCA_EXPORT void setProperty(const QString &name, const QVariant &value);
424 
432 QCA_EXPORT QVariant getProperty(const QString &name);
433 
442 QCA_EXPORT void setProviderConfig(const QString &name, const QVariantMap &config);
443 
449 QCA_EXPORT QVariantMap getProviderConfig(const QString &name);
450 
456 QCA_EXPORT void saveProviderConfig(const QString &name);
457 
461 QCA_EXPORT QString globalRandomProvider();
462 
473 QCA_EXPORT void setGlobalRandomProvider(const QString &provider);
474 
481 QCA_EXPORT Logger *logger();
482 
493 #define QCA_logTextMessage(message, severity) \
494  do { \
495  QCA::Logger::Severity s = severity; \
496  QCA::Logger * l = QCA::logger(); \
497  if (s <= l->level()) { \
498  l->logTextMessage(message, s); \
499  } \
500  } while (false)
501 
512 #define QCA_logBinaryMessage(blob, severity) \
513  do { \
514  QCA::Logger::Severity s = severity; \
515  QCA::Logger * l = QCA::logger(); \
516  if (s <= l->level()) { \
517  l->logBinaryMessage(blob, s); \
518  } \
519  } while (false)
520 
529 QCA_EXPORT bool haveSystemStore();
530 
552 
560 QCA_EXPORT QString appName();
561 
571 QCA_EXPORT void setAppName(const QString &name);
572 
593 QCA_EXPORT QString arrayToHex(const QByteArray &array);
594 
620 QCA_EXPORT QByteArray hexToArray(const QString &hexString);
621 
632 QCA_EXPORT QString arrayToBase64(const QByteArray &array);
633 
646 QCA_EXPORT QByteArray base64ToArray(const QString &base64String);
647 
659 class QCA_EXPORT Initializer
660 {
661 public:
669  explicit Initializer(MemoryMode m = Practical, int prealloc = 64);
670  ~Initializer();
671 
672  Initializer(const Initializer &) = delete;
673  Initializer &operator=(const Initializer &) = delete;
674 };
675 
700 class QCA_EXPORT KeyLength
701 {
702 public:
711  KeyLength(int min, int max, int multiple)
712  : _min(min)
713  , _max(max)
714  , _multiple(multiple)
715  {
716  }
717 
721  int minimum() const
722  {
723  return _min;
724  }
725 
729  int maximum() const
730  {
731  return _max;
732  }
733 
740  int multiple() const
741  {
742  return _multiple;
743  }
744 
745 private:
746  const int _min, _max, _multiple;
747 };
748 
764 class QCA_EXPORT Provider
765 {
766 public:
767  virtual ~Provider();
768 
769  class Context;
770 
780  virtual void init();
781 
791  virtual void deinit();
792 
801  virtual int version() const;
802 
814  virtual int qcaVersion() const = 0;
815 
833  virtual QString name() const = 0;
834 
850  virtual QStringList features() const = 0;
851 
862  virtual QString credit() const;
863 
890  virtual Context *createContext(const QString &type) = 0;
891 
916  virtual QVariantMap defaultConfig() const;
917 
927  virtual void configChanged(const QVariantMap &config);
928 };
929 
939 class QCA_EXPORT Provider::Context : public QObject
940 {
941  Q_OBJECT
942 public:
943  ~Context() override;
944 
948  Provider *provider() const;
949 
953  QString type() const;
954 
958  virtual Context *clone() const = 0;
959 
968  bool sameProvider(const Context *c) const;
969 
970 protected:
978  Context(Provider *parent, const QString &type);
979 
985  Context(const Context &from);
986 
987 private:
988  // disable assignment
989  Context &operator=(const Context &from);
990 
991  Provider *_provider;
992  QString _type;
993 };
994 
1009 class QCA_EXPORT BasicContext : public Provider::Context
1010 {
1011  Q_OBJECT
1012 public:
1013  ~BasicContext() override;
1014 
1015 protected:
1023  BasicContext(Provider *parent, const QString &type);
1024 
1031 
1032 private:
1033  // disable assignment
1034  BasicContext &operator=(const BasicContext &from);
1035 };
1036 
1051 class QCA_EXPORT BufferedComputation
1052 {
1053 public:
1054  virtual ~BufferedComputation();
1055 
1059  virtual void clear() = 0;
1060 
1067  virtual void update(const MemoryRegion &a) = 0;
1068 
1072  virtual MemoryRegion final() = 0;
1073 
1087 };
1088 
1107 class QCA_EXPORT Filter
1108 {
1109 public:
1110  virtual ~Filter();
1111 
1115  virtual void clear() = 0;
1116 
1123  virtual MemoryRegion update(const MemoryRegion &a) = 0;
1124 
1129  virtual MemoryRegion final() = 0;
1130 
1136  virtual bool ok() const = 0;
1137 
1151 };
1152 
1163 class QCA_EXPORT Algorithm
1164 {
1165 public:
1171  Algorithm(const Algorithm &from);
1172 
1173  virtual ~Algorithm();
1174 
1181 
1185  QString type() const;
1186 
1193  Provider *provider() const;
1194 
1195  // Note: The next five functions are not public!
1196 
1203 
1209  const Provider::Context *context() const;
1210 
1219 
1228  void change(const QString &type, const QString &provider);
1229 
1236 
1237 protected:
1242 
1249  Algorithm(const QString &type, const QString &provider);
1250 
1251 private:
1252  class Private;
1253  QSharedDataPointer<Private> d;
1254 };
1255 
1263 class QCA_EXPORT SymmetricKey : public SecureArray
1264 {
1265 public:
1270 
1278  SymmetricKey(int size);
1279 
1286 
1292  SymmetricKey(const QByteArray &a);
1293 
1300 };
1301 
1309 class QCA_EXPORT InitializationVector : public SecureArray
1310 {
1311 public:
1316 
1323 
1330 
1336  InitializationVector(const QByteArray &a);
1337 };
1338 
1346 class QCA_EXPORT AuthTag : public SecureArray
1347 {
1348 public:
1353 
1359  AuthTag(int size);
1360 
1367 
1373  AuthTag(const QByteArray &a);
1374 };
1375 
1390 class QCA_EXPORT Event
1391 {
1392 public:
1398  enum Type
1399  {
1401  Token
1402  };
1403 
1416  enum Source
1417  {
1419  Data
1420  };
1421 
1431  {
1434  StylePIN
1435  };
1436 
1441 
1447  Event(const Event &from);
1448 
1453 
1459  Event &operator=(const Event &from);
1460 
1464  bool isNull() const;
1465 
1469  Type type() const;
1470 
1474  Source source() const;
1475 
1484 
1491 
1498 
1505  QString fileName() const;
1506 
1510  void *ptr() const;
1511 
1526  const KeyStoreInfo & keyStoreInfo,
1527  const KeyStoreEntry &keyStoreEntry,
1528  void * ptr);
1529 
1541  void setPasswordData(PasswordStyle pstyle, const QString &fileName, void *ptr);
1542 
1554  void setToken(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr);
1555 
1556 private:
1557  class Private;
1558  QSharedDataPointer<Private> d;
1559 };
1560 
1578 class QCA_EXPORT EventHandler : public QObject
1579 {
1580  Q_OBJECT
1581 public:
1587  EventHandler(QObject *parent = nullptr);
1588  ~EventHandler() override;
1589 
1595  void start();
1596 
1607  void submitPassword(int id, const SecureArray &password);
1608 
1618  void tokenOkay(int id);
1619 
1629  void reject(int id);
1630 
1631 Q_SIGNALS:
1641  void eventReady(int id, const QCA::Event &context);
1642 
1643 private:
1644  Q_DISABLE_COPY(EventHandler)
1645 
1646  class Private;
1647  friend class Private;
1648  Private *d;
1649 };
1650 
1660 class QCA_EXPORT PasswordAsker : public QObject
1661 {
1662  Q_OBJECT
1663 public:
1669  PasswordAsker(QObject *parent = nullptr);
1670  ~PasswordAsker() override;
1671 
1683  void
1684  ask(Event::PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr);
1685 
1695  void ask(Event::PasswordStyle pstyle, const QString &fileName, void *ptr);
1696 
1700  void cancel();
1701 
1710 
1719  bool accepted() const;
1720 
1726 
1727 Q_SIGNALS:
1735 
1736 private:
1737  Q_DISABLE_COPY(PasswordAsker)
1738 
1739  class Private;
1740  friend class Private;
1741  Private *d;
1742 };
1743 
1753 class QCA_EXPORT TokenAsker : public QObject
1754 {
1755  Q_OBJECT
1756 public:
1762  TokenAsker(QObject *parent = nullptr);
1763  ~TokenAsker() override;
1764 
1774  void ask(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr);
1775 
1779  void cancel();
1780 
1788 
1794  bool accepted() const;
1795 
1796 Q_SIGNALS:
1804 
1805 private:
1806  Q_DISABLE_COPY(TokenAsker)
1807 
1808  class Private;
1809  friend class Private;
1810  Private *d;
1811 };
1812 
1813 }
1814 
1815 #endif
QCA::SymmetricKey::SymmetricKey
SymmetricKey(const QByteArray &a)
Construct a key from a provided byte array.
QCA::Event::keyStoreEntry
KeyStoreEntry keyStoreEntry() const
The KeyStoreEntry associated with this event.
QCA::Event::Source
Source
Source of the event
Definition: qca_core.h:1417
QCA::unloadAllPlugins
QCA_EXPORT void unloadAllPlugins()
Unload the current plugins.
QCA::Logger
A simple logging system.
Definition: qca_support.h:962
QCA::Algorithm::Algorithm
Algorithm(const Algorithm &from)
Standard copy constructor.
QCA::Event::operator=
Event & operator=(const Event &from)
Assignment operator.
QCA::Event
An asynchronous event.
Definition: qca_core.h:1391
QCA::Filter::update
virtual MemoryRegion update(const MemoryRegion &a)=0
Process more data, returning the corresponding filtered version of the data.
QObject
QCA::Direction
Direction
Direction settings for symmetric algorithms.
Definition: qca_core.h:141
QCA::haveSecureMemory
QCA_EXPORT bool haveSecureMemory()
Test if secure storage memory is available.
QCA::InitializationVector::InitializationVector
InitializationVector(const QByteArray &a)
Construct an initialisation vector from a provided byte array.
QCA::KeyStoreEntry
Single entry in a KeyStore.
Definition: qca_keystore.h:141
QCA::Event::StylePassword
@ StylePassword
User should be prompted for a "Password".
Definition: qca_core.h:1432
QCA::Provider::provider
Provider * provider() const
The Provider associated with this Context.
QCA::KeyStoreInfo
Key store information, outside of a KeyStore object.
Definition: qca_keystore.h:624
QCA::Practical
@ Practical
mlock and drop root if available, else mmap
Definition: qca_core.h:129
QCA::Provider
Algorithm provider.
Definition: qca_core.h:765
QCA::systemStore
QCA_EXPORT CertificateCollection systemStore()
Get system-wide root Certificate Authority (CA) certificates.
QCA::findProvider
QCA_EXPORT Provider * findProvider(const QString &name)
Return the named provider, or 0 if not found.
QCA::scanForPlugins
QCA_EXPORT void scanForPlugins()
Scan for new plugins.
QCA::TokenAsker
User token handler.
Definition: qca_core.h:1754
QCA::MemoryMode
MemoryMode
Mode settings for memory allocation.
Definition: qca_core.h:128
QCA::Event::type
Type type() const
the Type of this event
QCA::InitializationVector::InitializationVector
InitializationVector(const SecureArray &a)
Construct an initialisation vector from a provided byte array.
QCA::init
QCA_EXPORT void init()
Initialise QCA.
QCA::Provider::Context
Context(const Context &from)
Copy constructor.
QCA::Algorithm::Algorithm
Algorithm()
Constructor for empty algorithm.
QCA::defaultFeatures
QCA_EXPORT QStringList defaultFeatures()
Generate a list of the built in features.
QCA::Provider::sameProvider
bool sameProvider(const Context *c) const
Test if two Contexts have the same Provider.
QCA::EventHandler
Interface class for password / passphrase / PIN and token handlers.
Definition: qca_core.h:1579
QCA::insertProvider
QCA_EXPORT bool insertProvider(Provider *p, int priority=0)
Add a provider to the current list of providers.
QCA::providerPriority
QCA_EXPORT int providerPriority(const QString &name)
Return the priority of a specified provider.
QCA::setProperty
QCA_EXPORT void setProperty(const QString &name, const QVariant &value)
Set a global property.
QCA::Provider::version
virtual int version() const
Version number of the plugin.
QCA::Event::KeyStore
@ KeyStore
KeyStore generated the event.
Definition: qca_core.h:1418
QCA::TokenAsker::cancel
void cancel()
Cancel the pending password / passphrase request.
QCA
QCA - the Qt Cryptographic Architecture.
Definition: qca_basic.h:41
QCA::Encode
@ Encode
Operate in the "forward" direction; for example, encrypting.
Definition: qca_core.h:142
QCA::EventHandler::tokenOkay
void tokenOkay(int id)
function to call to indicate that the token has been inserted by the user.
QCA::Algorithm
General superclass for an algorithm.
Definition: qca_core.h:1164
QCA::Decode
@ Decode
Operate in the "reverse" direction; for example, decrypting.
Definition: qca_core.h:143
qca_version.h
Header file with QCA version.
QCA::PasswordAsker::accepted
bool accepted() const
Determine whether the password / passphrase was accepted or not.
QCA::SymmetricKey
Container for keys for symmetric encryption algorithms.
Definition: qca_core.h:1264
QCA::PasswordAsker::password
SecureArray password() const
The password / passphrase / PIN provided by the user in response to the asker request.
QList
qca_export.h
Preprocessor magic to allow export of library symbols.
QCA::Event::isNull
bool isNull() const
test if this event has been setup correctly
QCA::Event::setPasswordKeyStore
void setPasswordKeyStore(PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
Set the values for this Event.
QCA::BasicContext::BasicContext
BasicContext(const BasicContext &from)
Copy constructor.
qcaPatchVersion
QCA_EXPORT int qcaPatchVersion()
The current version of QCA.
QCA::Event::StylePassphrase
@ StylePassphrase
User should be prompted for a "Passphrase".
Definition: qca_core.h:1433
QCA::AuthTag::AuthTag
AuthTag(const SecureArray &a)
Construct an authentication tag from a provided byte array.
QCA::arrayToBase64
QCA_EXPORT QString arrayToBase64(const QByteArray &array)
Convert a byte array to printable base64 representation.
QCA::Algorithm::provider
Provider * provider() const
The name of the provider.
Context
Internal context class used for the plugin.
QCA::Event::setPasswordData
void setPasswordData(PasswordStyle pstyle, const QString &fileName, void *ptr)
Set the values for this Event.
QCA::appendPluginDiagnosticText
QCA_EXPORT void appendPluginDiagnosticText(const QString &text)
Add plugin diagnostic text.
QCA::PasswordAsker::PasswordAsker
PasswordAsker(QObject *parent=nullptr)
Construct a new asker.
QCA::CertificateCollection
Bundle of Certificates and CRLs.
Definition: qca_cert.h:1929
QCA::LockingKeepPrivileges
@ LockingKeepPrivileges
mlock, retaining root privileges
Definition: qca_core.h:131
QCA::Event::setToken
void setToken(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
Set the values for this Event.
QCA::InitializationVector
Container for initialisation vectors and nonces.
Definition: qca_core.h:1310
QCA::saveProviderConfig
QCA_EXPORT void saveProviderConfig(const QString &name)
Save provider configuration to persistent storage.
qcaVersionStr
QCA_EXPORT const char * qcaVersionStr()
The current version of QCA.
QCA::hexToArray
QCA_EXPORT QByteArray hexToArray(const QString &hexString)
Convert a QString containing a hexadecimal representation of a byte array into a QByteArray.
qcaMajorVersion
QCA_EXPORT int qcaMajorVersion()
The current version of QCA.
QCA::globalRandomProvider
QCA_EXPORT QString globalRandomProvider()
Return the name of the global random number provider.
QCA::PasswordAsker::ask
void ask(Event::PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
queue a password / passphrase request associated with a key store
QCA::TokenAsker::ask
void ask(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
queue a token request associated with a key store
QCA::supportedFeatures
QCA_EXPORT QStringList supportedFeatures()
Generate a list of all the supported features in plugins, and in built in capabilities.
QCA::PasswordAsker::cancel
void cancel()
Cancel the pending password / passphrase request.
QCA::Initializer::Initializer
Initializer(MemoryMode m=Practical, int prealloc=64)
Standard constructor.
QCA::Event::Password
@ Password
Asking for a password, PIN or passphrase.
Definition: qca_core.h:1400
QCA::SymmetricKey::SymmetricKey
SymmetricKey(int size)
Construct an key of specified size, with random contents.
QCA::SymmetricKey::SymmetricKey
SymmetricKey()
Construct an empty (zero length) key.
QCA::Event::source
Source source() const
the Source of this event
QCA::pluginPaths
QCA_EXPORT QStringList pluginPaths()
Retrieve plugin paths.
QCA::AuthTag::AuthTag
AuthTag(int size)
Construct an empty authentication tag of the specified size.
QCA::getProviderConfig
QCA_EXPORT QVariantMap getProviderConfig(const QString &name)
Retrieve provider configuration.
QCA::Algorithm::context
const Provider::Context * context() const
qca_support.h
Header file for "support" classes used in QCA.
QCA::base64ToArray
QCA_EXPORT QByteArray base64ToArray(const QString &base64String)
Convert a QString containing a base64 representation of a byte array into a QByteArray.
QCA::TokenAsker::accepted
bool accepted() const
Test if the token request was accepted or not.
QCA::appName
QCA_EXPORT QString appName()
Get the application name that will be used by SASL server mode.
QCA::SymmetricKey::isWeakDESKey
bool isWeakDESKey()
Test for weak DES keys.
QCA::Filter::clear
virtual void clear()=0
Reset the internal state.
QCA::KeyLength::minimum
int minimum() const
Obtain the minimum length for the key, in bytes.
Definition: qca_core.h:721
QCA::Provider::credit
virtual QString credit() const
Optional credit text for the provider.
QCA::Algorithm::Algorithm
Algorithm(const QString &type, const QString &provider)
Constructor of a particular algorithm.
QCA::Provider::Context
Context(Provider *parent, const QString &type)
Standard constructor.
QCA::TokenAsker::waitForResponse
void waitForResponse()
Block until the token request is completed.
QCA::logger
QCA_EXPORT Logger * logger()
Return a reference to the QCA Logger, which is used for diagnostics and error recording.
QCA::SecureArray
Secure array of bytes.
Definition: qca_tools.h:317
QCA::Provider::deinit
virtual void deinit()
Deinitialisation routine.
QCA::AuthTag::AuthTag
AuthTag(const QByteArray &a)
Construct an authentication tag from a provided byte array.
QCA::haveSystemStore
QCA_EXPORT bool haveSystemStore()
Test if QCA can access the root CA certificates.
QCA::KeyLength::multiple
int multiple() const
Return the number of bytes that the key must be a multiple of.
Definition: qca_core.h:740
QCA::EventHandler::reject
void reject(int id)
function to call to indicate that the user declined to provide a password, passphrase,...
QCA::Provider::configChanged
virtual void configChanged(const QVariantMap &config)
Method to set the configuration options.
QCA::Filter::process
MemoryRegion process(const MemoryRegion &a)
Perform an "all in one" update, returning the result.
QCA::PasswordAsker::responseReady
void responseReady()
Emitted when the asker process has been completed.
QCA::EventHandler::submitPassword
void submitPassword(int id, const SecureArray &password)
function to call to return the user provided password, passphrase or PIN.
QCA::PasswordAsker
User password / passphrase / PIN handler.
Definition: qca_core.h:1661
QCA::getProperty
QCA_EXPORT QVariant getProperty(const QString &name)
Retrieve a global property.
QCA::Event::ptr
void * ptr() const
opaque data
QCA::Provider::features
virtual QStringList features() const =0
QCA::Event::fileName
QString fileName() const
Name or other identifier for the file or byte array associated with this event.
QCA::InitializationVector::InitializationVector
InitializationVector()
Construct an empty (zero length) initisation vector.
QCA::EventHandler::start
void start()
mandatory function to call after connecting the signal to a slot in your application specific passwor...
QCA::Provider::init
virtual void init()
Initialisation routine.
QCA::pluginDiagnosticText
QCA_EXPORT QString pluginDiagnosticText()
Retrieve plugin diagnostic text.
QCA::Provider::clone
virtual Context * clone() const =0
Create a duplicate of this Context.
QCA::Event::PasswordStyle
PasswordStyle
password variation
Definition: qca_core.h:1431
QCA::BufferedComputation::process
MemoryRegion process(const MemoryRegion &a)
Perform an "all in one" update, returning the result.
QCA::BufferedComputation::update
virtual void update(const MemoryRegion &a)=0
Update the internal state with a byte array.
QCA::TokenAsker::responseReady
void responseReady()
Emitted when the asker process has been completed.
QCA::BufferedComputation::clear
virtual void clear()=0
Reset the internal state.
QCA::setProviderPriority
QCA_EXPORT void setProviderPriority(const QString &name, int priority)
Change the priority of a specified provider.
QCA::Algorithm::takeContext
Provider::Context * takeContext()
QCA::TokenAsker::TokenAsker
TokenAsker(QObject *parent=nullptr)
Construct a new asker.
QCA::unloadProvider
QCA_EXPORT bool unloadProvider(const QString &name)
Unload specified provider.
QCA::Provider::defaultConfig
virtual QVariantMap defaultConfig() const
QCA::EventHandler::EventHandler
EventHandler(QObject *parent=nullptr)
Constructor.
QCA::defaultProvider
QCA_EXPORT Provider * defaultProvider()
Return the default provider.
QCA::Filter
General superclass for filtering transformation algorithms.
Definition: qca_core.h:1108
QCA::arrayToHex
QCA_EXPORT QString arrayToHex(const QByteArray &array)
Convert a byte array to printable hexadecimal representation.
QCA::setProviderConfig
QCA_EXPORT void setProviderConfig(const QString &name, const QVariantMap &config)
Set provider configuration.
QCA::Initializer
Convenience method for initialising and cleaning up QCA.
Definition: qca_core.h:660
QCA::InitializationVector::InitializationVector
InitializationVector(int size)
Construct an initialisation vector of the specified size.
QCA::isSupported
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
Test if a capability (algorithm) is available.
QCA::Event::Event
Event(const Event &from)
Copy constructor.
QCA::Provider::name
virtual QString name() const =0
QCA::deinit
QCA_EXPORT void deinit()
Clean up routine.
QCA::KeyLength::KeyLength
KeyLength(int min, int max, int multiple)
Construct a KeyLength object.
Definition: qca_core.h:711
QCA::MemoryRegion
Array of bytes that may be optionally secured.
Definition: qca_tools.h:91
QCA::Event::Type
Type
Type of event
Definition: qca_core.h:1399
QCA::Algorithm::operator=
Algorithm & operator=(const Algorithm &from)
Assignment operator.
qcaVersion
QCA_EXPORT int qcaVersion()
The current version of QCA.
QCA::Algorithm::change
void change(Provider::Context *c)
QCA::Filter::ok
virtual bool ok() const =0
Test if an update() or final() call succeeded.
QCA::haveSecureRandom
QCA_EXPORT bool haveSecureRandom()
Test if secure random is available.
QCA::Event::keyStoreInfo
KeyStoreInfo keyStoreInfo() const
The info of the KeyStore associated with this event.
QCA::EventHandler::eventReady
void eventReady(int id, const QCA::Event &context)
signal emitted when an Event requires attention.
QCA::PasswordAsker::waitForResponse
void waitForResponse()
Block until the password / passphrase request is completed.
QCA::AuthTag::AuthTag
AuthTag()
Construct an empty authentication tag.
QCA::Algorithm::type
QString type() const
The name of the algorithm type.
QCA::PasswordAsker::ask
void ask(Event::PasswordStyle pstyle, const QString &fileName, void *ptr)
queue a password / passphrase request associated with a file
QCA::ProviderList
QList< Provider * > ProviderList
Convenience representation for the plugin providers.
Definition: qca_core.h:100
QCA::AuthTag
Container for authentication tag.
Definition: qca_core.h:1347
QCA::BasicContext
Base class to use for primitive provider contexts.
Definition: qca_core.h:1010
QCA::Provider::createContext
virtual Context * createContext(const QString &type)=0
QCA::SymmetricKey::SymmetricKey
SymmetricKey(const SecureArray &a)
Construct a key from a provided byte array.
QCA::KeyLength
Simple container for acceptable key lengths.
Definition: qca_core.h:701
QCA::Algorithm::change
void change(const QString &type, const QString &provider)
QCA::BufferedComputation
General superclass for buffered computation algorithms.
Definition: qca_core.h:1052
QCA::Event::passwordStyle
PasswordStyle passwordStyle() const
the style of password required.
QCA::Event::~Event
~Event()
Destructor.
QCA::Provider::type
QString type() const
The type of context, as passed to the constructor.
QCA::setGlobalRandomProvider
QCA_EXPORT void setGlobalRandomProvider(const QString &provider)
Change the global random number provider.
qca_tools.h
Header file for "tool" classes used in QCA.
qcaMinorVersion
QCA_EXPORT int qcaMinorVersion()
The current version of QCA.
QCA::Algorithm::context
Provider::Context * context()
QCA::KeyLength::maximum
int maximum() const
Obtain the maximum length for the key, in bytes.
Definition: qca_core.h:729
QCA::Locking
@ Locking
mlock and drop root
Definition: qca_core.h:130
QCA::BasicContext::BasicContext
BasicContext(Provider *parent, const QString &type)
Standard constructor.
QCA::Event::Event
Event()
Constructor.
QCA::clearPluginDiagnosticText
QCA_EXPORT void clearPluginDiagnosticText()
Clear plugin diagnostic text.
QCA::providers
QCA_EXPORT ProviderList providers()
Return a list of the current providers.
QCA::setAppName
QCA_EXPORT void setAppName(const QString &name)
Set the application name that will be used by SASL server mode.
QCA::Provider::qcaVersion
virtual int qcaVersion() const =0
Target QCA version for the provider.