Qt Cryptographic Architecture
|
Go to the documentation of this file.
38 #include <QStringList>
40 #include <QSharedData>
41 #include <QSharedDataPointer>
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); \
712 : _min( min ), _max(max), _multiple( multiple )
734 const int _min, _max, _multiple;
821 virtual QString
name()
const = 0;
1124 virtual bool ok()
const = 0;
1216 void change(
const QString &type,
const QString &provider);
1241 QSharedDataPointer<Private> d;
1543 QSharedDataPointer<Private> d;
1632 friend class Private;
1724 friend class Private;
1793 friend class Private;
SymmetricKey(const QByteArray &a)
Construct a key from a provided byte array.
KeyStoreEntry keyStoreEntry() const
The KeyStoreEntry associated with this event.
Source
Source of the event
Definition: qca_core.h:1405
QCA_EXPORT void unloadAllPlugins()
Unload the current plugins.
Definition: qca_support.h:955
Algorithm(const Algorithm &from)
Standard copy constructor.
Event & operator=(const Event &from)
Assignment operator.
Definition: qca_core.h:1379
virtual MemoryRegion update(const MemoryRegion &a)=0
Process more data, returning the corresponding filtered version of the data.
Direction
Direction settings for symmetric algorithms.
Definition: qca_core.h:141
QCA_EXPORT bool haveSecureMemory()
Test if secure storage memory is available.
InitializationVector(const QByteArray &a)
Construct an initialisation vector from a provided byte array.
Definition: qca_keystore.h:141
@ StylePassword
User should be prompted for a "Password".
Definition: qca_core.h:1420
Provider * provider() const
The Provider associated with this Context.
Definition: qca_keystore.h:624
@ Practical
mlock and drop root if available, else mmap
Definition: qca_core.h:129
Definition: qca_core.h:753
QCA_EXPORT CertificateCollection systemStore()
Get system-wide root Certificate Authority (CA) certificates.
QCA_EXPORT Provider * findProvider(const QString &name)
Return the named provider, or 0 if not found.
QCA_EXPORT void scanForPlugins()
Scan for new plugins.
Definition: qca_core.h:1738
MemoryMode
Mode settings for memory allocation.
Definition: qca_core.h:128
Type type() const
the Type of this event
InitializationVector(const SecureArray &a)
Construct an initialisation vector from a provided byte array.
QCA_EXPORT void init()
Initialise QCA.
Context(const Context &from)
Copy constructor.
Algorithm()
Constructor for empty algorithm.
QCA_EXPORT QStringList defaultFeatures()
Generate a list of the built in features.
bool sameProvider(const Context *c) const
Test if two Contexts have the same Provider.
Definition: qca_core.h:1564
QCA_EXPORT bool insertProvider(Provider *p, int priority=0)
Add a provider to the current list of providers.
QCA_EXPORT int providerPriority(const QString &name)
Return the priority of a specified provider.
QCA_EXPORT void setProperty(const QString &name, const QVariant &value)
Set a global property.
virtual int version() const
Version number of the plugin.
@ KeyStore
KeyStore generated the event.
Definition: qca_core.h:1406
void cancel()
Cancel the pending password / passphrase request.
QCA - the Qt Cryptographic Architecture.
Definition: qca_basic.h:41
@ Encode
Operate in the "forward" direction; for example, encrypting.
Definition: qca_core.h:142
void tokenOkay(int id)
function to call to indicate that the token has been inserted by the user.
Definition: qca_core.h:1152
@ Decode
Operate in the "reverse" direction; for example, decrypting.
Definition: qca_core.h:143
bool accepted() const
Determine whether the password / passphrase was accepted or not.
Definition: qca_core.h:1252
SecureArray password() const
The password / passphrase / PIN provided by the user in response to the asker request.
bool isNull() const
test if this event has been setup correctly
void setPasswordKeyStore(PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
Set the values for this Event.
BasicContext(const BasicContext &from)
Copy constructor.
QCA_EXPORT int qcaPatchVersion()
The current version of QCA.
@ StylePassphrase
User should be prompted for a "Passphrase".
Definition: qca_core.h:1421
AuthTag(const SecureArray &a)
Construct an authentication tag from a provided byte array.
QCA_EXPORT QString arrayToBase64(const QByteArray &array)
Convert a byte array to printable base64 representation.
Provider * provider() const
The name of the provider.
void setPasswordData(PasswordStyle pstyle, const QString &fileName, void *ptr)
Set the values for this Event.
QCA_EXPORT void appendPluginDiagnosticText(const QString &text)
Add plugin diagnostic text.
PasswordAsker(QObject *parent=nullptr)
Construct a new asker.
Definition: qca_cert.h:1891
@ LockingKeepPrivileges
mlock, retaining root privileges
Definition: qca_core.h:131
void setToken(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
Set the values for this Event.
Definition: qca_core.h:1298
QCA_EXPORT void saveProviderConfig(const QString &name)
Save provider configuration to persistent storage.
QCA_EXPORT const char * qcaVersionStr()
The current version of QCA.
QCA_EXPORT QByteArray hexToArray(const QString &hexString)
Convert a QString containing a hexadecimal representation of a byte array into a QByteArray.
QCA_EXPORT int qcaMajorVersion()
The current version of QCA.
QCA_EXPORT QString globalRandomProvider()
Return the name of the global random number provider.
void ask(Event::PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
queue a password / passphrase request associated with a key store
void ask(const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
queue a token request associated with a key store
QCA_EXPORT QStringList supportedFeatures()
Generate a list of all the supported features in plugins, and in built in capabilities.
void cancel()
Cancel the pending password / passphrase request.
Initializer(MemoryMode m=Practical, int prealloc=64)
Standard constructor.
@ Password
Asking for a password, PIN or passphrase.
Definition: qca_core.h:1388
SymmetricKey(int size)
Construct an key of specified size, with random contents.
SymmetricKey()
Construct an empty (zero length) key.
Source source() const
the Source of this event
QCA_EXPORT QStringList pluginPaths()
Retrieve plugin paths.
AuthTag(int size)
Construct an empty authentication tag of the specified size.
QCA_EXPORT QVariantMap getProviderConfig(const QString &name)
Retrieve provider configuration.
const Provider::Context * context() const
QCA_EXPORT QByteArray base64ToArray(const QString &base64String)
Convert a QString containing a base64 representation of a byte array into a QByteArray.
bool accepted() const
Test if the token request was accepted or not.
QCA_EXPORT QString appName()
Get the application name that will be used by SASL server mode.
bool isWeakDESKey()
Test for weak DES keys.
virtual void clear()=0
Reset the internal state.
int minimum() const
Obtain the minimum length for the key, in bytes.
Definition: qca_core.h:718
virtual QString credit() const
Optional credit text for the provider.
Algorithm(const QString &type, const QString &provider)
Constructor of a particular algorithm.
Context(Provider *parent, const QString &type)
Standard constructor.
void waitForResponse()
Block until the token request is completed.
QCA_EXPORT Logger * logger()
Return a reference to the QCA Logger, which is used for diagnostics and error recording.
Definition: qca_tools.h:317
virtual void deinit()
Deinitialisation routine.
AuthTag(const QByteArray &a)
Construct an authentication tag from a provided byte array.
QCA_EXPORT bool haveSystemStore()
Test if QCA can access the root CA certificates.
int multiple() const
Return the number of bytes that the key must be a multiple of.
Definition: qca_core.h:731
void reject(int id)
function to call to indicate that the user declined to provide a password, passphrase,...
virtual void configChanged(const QVariantMap &config)
Method to set the configuration options.
MemoryRegion process(const MemoryRegion &a)
Perform an "all in one" update, returning the result.
void responseReady()
Emitted when the asker process has been completed.
void submitPassword(int id, const SecureArray &password)
function to call to return the user provided password, passphrase or PIN.
Definition: qca_core.h:1646
QCA_EXPORT QVariant getProperty(const QString &name)
Retrieve a global property.
void * ptr() const
opaque data
virtual QStringList features() const =0
QString fileName() const
Name or other identifier for the file or byte array associated with this event.
InitializationVector()
Construct an empty (zero length) initisation vector.
void start()
mandatory function to call after connecting the signal to a slot in your application specific passwor...
virtual void init()
Initialisation routine.
QCA_EXPORT QString pluginDiagnosticText()
Retrieve plugin diagnostic text.
virtual Context * clone() const =0
Create a duplicate of this Context.
PasswordStyle
password variation
Definition: qca_core.h:1419
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.
void responseReady()
Emitted when the asker process has been completed.
virtual void clear()=0
Reset the internal state.
QCA_EXPORT void setProviderPriority(const QString &name, int priority)
Change the priority of a specified provider.
Provider::Context * takeContext()
TokenAsker(QObject *parent=nullptr)
Construct a new asker.
QCA_EXPORT bool unloadProvider(const QString &name)
Unload specified provider.
virtual QVariantMap defaultConfig() const
EventHandler(QObject *parent=nullptr)
Constructor.
QCA_EXPORT Provider * defaultProvider()
Return the default provider.
Definition: qca_core.h:1096
QCA_EXPORT QString arrayToHex(const QByteArray &array)
Convert a byte array to printable hexadecimal representation.
QCA_EXPORT void setProviderConfig(const QString &name, const QVariantMap &config)
Set provider configuration.
Definition: qca_core.h:660
InitializationVector(int size)
Construct an initialisation vector of the specified size.
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
Test if a capability (algorithm) is available.
Event(const Event &from)
Copy constructor.
virtual QString name() const =0
QCA_EXPORT void deinit()
Clean up routine.
KeyLength(int min, int max, int multiple)
Construct a KeyLength object.
Definition: qca_core.h:711
Definition: qca_tools.h:91
Type
Type of event
Definition: qca_core.h:1387
Algorithm & operator=(const Algorithm &from)
Assignment operator.
QCA_EXPORT int qcaVersion()
The current version of QCA.
void change(Provider::Context *c)
virtual bool ok() const =0
Test if an update() or final() call succeeded.
QCA_EXPORT bool haveSecureRandom()
Test if secure random is available.
KeyStoreInfo keyStoreInfo() const
The info of the KeyStore associated with this event.
void eventReady(int id, const QCA::Event &context)
signal emitted when an Event requires attention.
void waitForResponse()
Block until the password / passphrase request is completed.
QList< Provider * > ProviderList
Convenience representation for the plugin providers.
Definition: qca_core.h:100
AuthTag()
Construct an empty authentication tag.
QString type() const
The name of the algorithm type.
void ask(Event::PasswordStyle pstyle, const QString &fileName, void *ptr)
queue a password / passphrase request associated with a file
Definition: qca_core.h:1335
Definition: qca_core.h:998
virtual Context * createContext(const QString &type)=0
SymmetricKey(const SecureArray &a)
Construct a key from a provided byte array.
Definition: qca_core.h:701
void change(const QString &type, const QString &provider)
Definition: qca_core.h:1040
PasswordStyle passwordStyle() const
the style of password required.
QString type() const
The type of context, as passed to the constructor.
QCA_EXPORT void setGlobalRandomProvider(const QString &provider)
Change the global random number provider.
QCA_EXPORT int qcaMinorVersion()
The current version of QCA.
Provider::Context * context()
int maximum() const
Obtain the maximum length for the key, in bytes.
Definition: qca_core.h:723
@ Locking
mlock and drop root
Definition: qca_core.h:130
BasicContext(Provider *parent, const QString &type)
Standard constructor.
QCA_EXPORT void clearPluginDiagnosticText()
Clear plugin diagnostic text.
QCA_EXPORT ProviderList providers()
Return a list of the current providers.
QCA_EXPORT void setAppName(const QString &name)
Set the application name that will be used by SASL server mode.
virtual int qcaVersion() const =0
Target QCA version for the provider.