37 #include "qca_export.h"
42 #include <QSharedData>
43 #include <QSharedDataPointer>
45 #include <QStringList>
94 class CertificateCollection;
99 class KeyStoreManager;
219 QCA_EXPORT
bool isSupported(
const char *features,
const QString &provider = QString());
229 QCA_EXPORT
bool isSupported(
const QStringList &features,
const QString &provider = QString());
423 QCA_EXPORT
void setProperty(
const QString &name,
const QVariant &value);
493 #define QCA_logTextMessage(message, severity) \
495 QCA::Logger::Severity s = severity; \
496 QCA::Logger *l = QCA::logger(); \
497 if (s <= l->level()) { \
498 l->logTextMessage(message, s); \
512 #define QCA_logBinaryMessage(blob, severity) \
514 QCA::Logger::Severity s = severity; \
515 QCA::Logger *l = QCA::logger(); \
516 if (s <= l->level()) { \
517 l->logBinaryMessage(blob, s); \
714 , _multiple(multiple)
746 const int _min, _max, _multiple;
833 virtual QString
name()
const = 0;
1136 virtual bool ok()
const = 0;
1228 void change(
const QString &type,
const QString &provider);
1253 QSharedDataPointer<Private> d;
1558 QSharedDataPointer<Private> d;
1647 friend class Private;
1740 friend class Private;
1809 friend class Private;
General superclass for an algorithm.
Definition: qca_core.h:1164
QString type() const
The name of the algorithm type.
Algorithm()
Constructor for empty algorithm.
Provider * provider() const
The name of the provider.
Algorithm(const QString &type, const QString &provider)
Constructor of a particular algorithm.
const Provider::Context * context() const
void change(Provider::Context *c)
void change(const QString &type, const QString &provider)
Provider::Context * takeContext()
Algorithm(const Algorithm &from)
Standard copy constructor.
Provider::Context * context()
Algorithm & operator=(const Algorithm &from)
Assignment operator.
Container for authentication tag.
Definition: qca_core.h:1347
AuthTag(const QByteArray &a)
Construct an authentication tag from a provided byte array.
AuthTag(const SecureArray &a)
Construct an authentication tag from a provided byte array.
AuthTag()
Construct an empty authentication tag.
AuthTag(int size)
Construct an empty authentication tag of the specified size.
Base class to use for primitive provider contexts.
Definition: qca_core.h:1010
BasicContext(Provider *parent, const QString &type)
Standard constructor.
BasicContext(const BasicContext &from)
Copy constructor.
General superclass for buffered computation algorithms.
Definition: qca_core.h:1052
virtual void clear()=0
Reset the internal state.
MemoryRegion process(const MemoryRegion &a)
Perform an "all in one" update, returning the result.
virtual void update(const MemoryRegion &a)=0
Update the internal state with a byte array.
Bundle of Certificates and CRLs.
Definition: qca_cert.h:1929
Interface class for password / passphrase / PIN and token handlers.
Definition: qca_core.h:1579
EventHandler(QObject *parent=nullptr)
Constructor.
void submitPassword(int id, const SecureArray &password)
function to call to return the user provided password, passphrase or PIN.
void eventReady(int id, const QCA::Event &context)
signal emitted when an Event requires attention.
void reject(int id)
function to call to indicate that the user declined to provide a password, passphrase,...
void tokenOkay(int id)
function to call to indicate that the token has been inserted by the user.
void start()
mandatory function to call after connecting the signal to a slot in your application specific passwor...
An asynchronous event.
Definition: qca_core.h:1391
Source
Source of the event
Definition: qca_core.h:1417
@ KeyStore
KeyStore generated the event.
Definition: qca_core.h:1418
Event & operator=(const Event &from)
Assignment operator.
Event(const Event &from)
Copy constructor.
QString fileName() const
Name or other identifier for the file or byte array associated with this event.
PasswordStyle passwordStyle() const
the style of password required.
Type type() const
the Type of this event
void setPasswordKeyStore(PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
Set the values for this Event.
void setToken(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
Set the values for this Event.
KeyStoreEntry keyStoreEntry() const
The KeyStoreEntry associated with this event.
KeyStoreInfo keyStoreInfo() const
The info of the KeyStore associated with this event.
bool isNull() const
test if this event has been setup correctly
Source source() const
the Source of this event
Type
Type of event
Definition: qca_core.h:1399
@ Password
Asking for a password, PIN or passphrase.
Definition: qca_core.h:1400
PasswordStyle
password variation
Definition: qca_core.h:1431
@ StylePassphrase
User should be prompted for a "Passphrase".
Definition: qca_core.h:1433
@ StylePassword
User should be prompted for a "Password".
Definition: qca_core.h:1432
void * ptr() const
opaque data
void setPasswordData(PasswordStyle pstyle, const QString &fileName, void *ptr)
Set the values for this Event.
General superclass for filtering transformation algorithms.
Definition: qca_core.h:1108
MemoryRegion process(const MemoryRegion &a)
Perform an "all in one" update, returning the result.
virtual bool ok() const =0
Test if an update() or final() call succeeded.
virtual MemoryRegion update(const MemoryRegion &a)=0
Process more data, returning the corresponding filtered version of the data.
virtual void clear()=0
Reset the internal state.
Container for initialisation vectors and nonces.
Definition: qca_core.h:1310
InitializationVector(int size)
Construct an initialization vector of the specified size.
InitializationVector(const QByteArray &a)
Construct an initialization vector from a provided byte array.
InitializationVector(const SecureArray &a)
Construct an initialization vector from a provided byte array.
InitializationVector()
Construct an empty (zero length) initialization vector.
Convenience method for initialising and cleaning up QCA.
Definition: qca_core.h:660
Initializer(MemoryMode m=Practical, int prealloc=64)
Standard constructor.
Simple container for acceptable key lengths.
Definition: qca_core.h:701
KeyLength(int min, int max, int multiple)
Construct a KeyLength object.
Definition: qca_core.h:711
int minimum() const
Obtain the minimum length for the key, in bytes.
Definition: qca_core.h:721
int multiple() const
Return the number of bytes that the key must be a multiple of.
Definition: qca_core.h:740
int maximum() const
Obtain the maximum length for the key, in bytes.
Definition: qca_core.h:729
Single entry in a KeyStore.
Definition: qca_keystore.h:141
Key store information, outside of a KeyStore object.
Definition: qca_keystore.h:624
A simple logging system.
Definition: qca_support.h:963
Array of bytes that may be optionally secured.
Definition: qca_tools.h:91
User password / passphrase / PIN handler.
Definition: qca_core.h:1661
void ask(Event::PasswordStyle pstyle, const QString &fileName, void *ptr)
queue a password / passphrase request associated with a file
void responseReady()
Emitted when the asker process has been completed.
void waitForResponse()
Block until the password / passphrase request is completed.
PasswordAsker(QObject *parent=nullptr)
Construct a new asker.
void cancel()
Cancel the pending password / passphrase request.
bool accepted() const
Determine whether the password / passphrase was accepted or not.
void ask(Event::PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
queue a password / passphrase request associated with a key store
SecureArray password() const
The password / passphrase / PIN provided by the user in response to the asker request.
Internal context class used for the plugin.
Algorithm provider.
Definition: qca_core.h:765
virtual int qcaVersion() const =0
Target QCA version for the provider.
virtual Context * createContext(const QString &type)=0
bool sameProvider(const Context *c) const
Test if two Contexts have the same Provider.
virtual void init()
Initialisation routine.
virtual Context * clone() const =0
Create a duplicate of this Context.
virtual QStringList features() const =0
Context(Provider *parent, const QString &type)
Standard constructor.
virtual QString credit() const
Optional credit text for the provider.
QString type() const
The type of context, as passed to the constructor.
Context(const Context &from)
Copy constructor.
virtual QVariantMap defaultConfig() const
virtual void deinit()
Deinitialisation routine.
virtual void configChanged(const QVariantMap &config)
Method to set the configuration options.
virtual QString name() const =0
Provider * provider() const
The Provider associated with this Context.
virtual int version() const
Version number of the plugin.
Secure array of bytes.
Definition: qca_tools.h:317
Container for keys for symmetric encryption algorithms.
Definition: qca_core.h:1264
SymmetricKey(const SecureArray &a)
Construct a key from a provided byte array.
SymmetricKey(int size)
Construct an key of specified size, with random contents.
SymmetricKey(const QByteArray &a)
Construct a key from a provided byte array.
SymmetricKey()
Construct an empty (zero length) key.
bool isWeakDESKey()
Test for weak DES keys.
User token handler.
Definition: qca_core.h:1754
void waitForResponse()
Block until the token request is completed.
void cancel()
Cancel the pending password / passphrase request.
void responseReady()
Emitted when the asker process has been completed.
bool accepted() const
Test if the token request was accepted or not.
TokenAsker(QObject *parent=nullptr)
Construct a new asker.
void ask(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
queue a token request associated with a key store
QCA - the Qt Cryptographic Architecture.
Definition: qca_basic.h:41
QCA_EXPORT Provider * defaultProvider()
Return the default provider.
QCA_EXPORT int providerPriority(const QString &name)
Return the priority of a specified provider.
QCA_EXPORT void setGlobalRandomProvider(const QString &provider)
Change the global random number provider.
QCA_EXPORT void setProviderPriority(const QString &name, int priority)
Change the priority of a specified provider.
QCA_EXPORT void init()
Initialise QCA.
QCA_EXPORT void scanForPlugins()
Scan for new plugins.
QCA_EXPORT void unloadAllPlugins()
Unload the current plugins.
QCA_EXPORT bool haveSecureMemory()
Test if secure storage memory is available.
QCA_EXPORT QString appName()
Get the application name that will be used by SASL server mode.
QCA_EXPORT bool haveSecureRandom()
Test if secure random is available.
QCA_EXPORT QString arrayToHex(const QByteArray &array)
Convert a byte array to printable hexadecimal representation.
QCA_EXPORT bool insertProvider(Provider *p, int priority=0)
Add a provider to the current list of providers.
QList< Provider * > ProviderList
Convenience representation for the plugin providers.
Definition: qca_core.h:100
QCA_EXPORT bool haveSystemStore()
Test if QCA can access the root CA certificates.
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
Test if a capability (algorithm) is available.
MemoryMode
Mode settings for memory allocation.
Definition: qca_core.h:128
@ Locking
mlock and drop root
Definition: qca_core.h:130
@ Practical
mlock and drop root if available, else mmap
Definition: qca_core.h:129
@ LockingKeepPrivileges
mlock, retaining root privileges
Definition: qca_core.h:131
QCA_EXPORT QByteArray hexToArray(const QString &hexString)
Convert a QString containing a hexadecimal representation of a byte array into a QByteArray.
Direction
Direction settings for symmetric algorithms.
Definition: qca_core.h:141
@ Encode
Operate in the "forward" direction; for example, encrypting.
Definition: qca_core.h:142
@ Decode
Operate in the "reverse" direction; for example, decrypting.
Definition: qca_core.h:143
QCA_EXPORT QStringList supportedFeatures()
Generate a list of all the supported features in plugins, and in built in capabilities.
QCA_EXPORT QString pluginDiagnosticText()
Retrieve plugin diagnostic text.
QCA_EXPORT QVariant getProperty(const QString &name)
Retrieve a global property.
QCA_EXPORT QVariantMap getProviderConfig(const QString &name)
Retrieve provider configuration.
QCA_EXPORT Provider * findProvider(const QString &name)
Return the named provider, or 0 if not found.
QCA_EXPORT void deinit()
Clean up routine.
QCA_EXPORT void clearPluginDiagnosticText()
Clear plugin diagnostic text.
QCA_EXPORT void appendPluginDiagnosticText(const QString &text)
Add plugin diagnostic text.
QCA_EXPORT ProviderList providers()
Return a list of the current providers.
QCA_EXPORT void setProperty(const QString &name, const QVariant &value)
Set a global property.
QCA_EXPORT QStringList defaultFeatures()
Generate a list of the built in features.
QCA_EXPORT bool unloadProvider(const QString &name)
Unload specified provider.
QCA_EXPORT void saveProviderConfig(const QString &name)
Save provider configuration to persistent storage.
QCA_EXPORT QStringList pluginPaths()
Retrieve plugin paths.
QCA_EXPORT QByteArray base64ToArray(const QString &base64String)
Convert a QString containing a base64 representation of a byte array into a QByteArray.
QCA_EXPORT void setProviderConfig(const QString &name, const QVariantMap &config)
Set provider configuration.
QCA_EXPORT QString globalRandomProvider()
Return the name of the global random number provider.
QCA_EXPORT QString arrayToBase64(const QByteArray &array)
Convert a byte array to printable base64 representation.
QCA_EXPORT Logger * logger()
Return a reference to the QCA Logger, which is used for diagnostics and error recording.
QCA_EXPORT void setAppName(const QString &name)
Set the application name that will be used by SASL server mode.
QCA_EXPORT CertificateCollection systemStore()
Get system-wide root Certificate Authority (CA) certificates.
QCA_EXPORT int qcaVersion()
The current version of QCA.
QCA_EXPORT int qcaMinorVersion()
The current version of QCA.
QCA_EXPORT const char * qcaVersionStr()
The current version of QCA.
QCA_EXPORT int qcaPatchVersion()
The current version of QCA.
QCA_EXPORT int qcaMajorVersion()
The current version of QCA.
Header file for "support" classes used in QCA.
Header file with QCA version.