QCA Namespace Reference

QCA - the Qt Cryptographic Architecture. More...


Classes

class  AbstractLogDevice
 An abstract log device. More...
class  Algorithm
 General superclass for an algorithm. More...
class  Base64
 Base64 encoding / decoding More...
class  BasicContext
 Base class to use for primitive provider contexts. More...
class  BigInteger
 Arbitrary precision integer. More...
class  BufferedComputation
 General superclass for buffered computation algorithms. More...
class  CAContext
 X.509 certificate authority provider. More...
class  CertBase
 X.509 certificate and certificate request provider base. More...
class  CertCollectionContext
 X.509 certificate collection provider. More...
class  CertContext
 X.509 certificate provider. More...
class  CertContextProps
 X.509 certificate or certificate request properties. More...
class  Certificate
 Public Key (X.509) certificate. More...
class  CertificateAuthority
 A Certificate Authority is used to generate Certificates and Certificate Revocation Lists (CRLs). More...
class  CertificateChain
 A chain of related Certificates. More...
class  CertificateCollection
 Bundle of Certificates and CRLs. More...
class  CertificateInfoOrdered
 Ordered certificate properties type. More...
class  CertificateInfoPair
 One entry in a certificate information list. More...
class  CertificateInfoType
 Certificate information type. More...
class  CertificateOptions
 Certificate options More...
class  CertificateRequest
 Certificate Request More...
class  Cipher
 General class for cipher (encryption / decryption) algorithms. More...
class  CipherContext
 Cipher provider. More...
class  CMS
 Cryptographic Message Syntax messaging system. More...
class  Console
 QCA Console system More...
class  ConsolePrompt
 Console prompt handler. More...
class  ConsoleReference
 Manager for a Console. More...
class  ConstraintType
 Certificate constraint. More...
class  CRL
 Certificate Revocation List More...
class  CRLContext
 X.509 certificate revocation list provider. More...
class  CRLContextProps
 X.509 certificate revocation list properties. More...
class  CRLEntry
 Part of a CRL representing a single certificate. More...
class  CSRContext
 X.509 certificate request provider. More...
class  DHContext
 Diffie-Hellman provider. More...
class  DHPrivateKey
 Diffie-Hellman Private Key. More...
class  DHPublicKey
 Diffie-Hellman Public Key. More...
class  DirWatch
 Support class to monitor a directory for activity. More...
class  DLGroup
 A discrete logarithm group. More...
class  DLGroupContext
 Discrete logarithm provider. More...
class  DSAContext
 DSA provider. More...
class  DSAPrivateKey
 Digital Signature Algorithm Private Key. More...
class  DSAPublicKey
 Digital Signature Algorithm Public Key. More...
class  Event
 An asynchronous event. More...
class  EventHandler
 Interface class for password / passphrase / PIN and token handlers. More...
class  FileWatch
 Support class to monitor a file for activity. More...
class  Filter
 General superclass for filtering transformation algorithms. More...
class  Hash
 General class for hashing algorithms. More...
class  HashContext
 Hash provider. More...
class  Hex
 Hexadecimal encoding / decoding. More...
class  InfoContext
 Extended provider information. More...
class  InitializationVector
 Container for initialisation vectors and nonces. More...
class  Initializer
 Convenience method for initialising and cleaning up QCA. More...
class  KDFContext
 Key derivation function provider. More...
class  KeyBundle
 Certificate chain and private key pair. More...
class  KeyDerivationFunction
 General superclass for key derivation algorithms. More...
class  KeyGenerator
 Class for generating asymmetric key pairs. More...
class  KeyLength
 Simple container for acceptable key lengths. More...
class  KeyLoader
 Asynchronous private key loader. More...
class  KeyStore
 General purpose key storage object. More...
class  KeyStoreEntry
 Single entry in a KeyStore. More...
class  KeyStoreEntryContext
 KeyStoreEntry provider. More...
class  KeyStoreEntryWatcher
 Class to monitor the availability of a KeyStoreEntry. More...
class  KeyStoreInfo
 Key store information, outside of a KeyStore object. More...
class  KeyStoreListContext
 KeyStore provider. More...
class  KeyStoreManager
 Access keystores, and monitor keystores for changes. More...
class  Logger
 A simple logging system. More...
class  MACContext
 Message authentication code provider. More...
class  MemoryRegion
 Array of bytes that may be optionally secured. More...
class  MessageAuthenticationCode
 General class for message authentication code (MAC) algorithms. More...
class  MessageContext
 SecureMessage provider. More...
class  OpenPGP
 Pretty Good Privacy messaging system. More...
class  PasswordAsker
 User password / passphrase / PIN handler. More...
class  PBKDF1
 Password based key derivation function version 1. More...
class  PBKDF2
 Password based key derivation function version 2. More...
class  PGPKey
 Pretty Good Privacy key. More...
class  PGPKeyContext
 OpenPGP key provider. More...
class  PGPKeyContextProps
 OpenPGP key properties. More...
class  PKCS12Context
 PKCS#12 provider. More...
class  PKey
 General superclass for public (PublicKey) and private (PrivateKey) keys used with asymmetric encryption techniques. More...
class  PKeyBase
 Public key implementation provider base. More...
class  PKeyContext
 Public key container provider. More...
class  PrivateKey
 Generic private key. More...
class  Provider
 Algorithm provider. More...
class  PublicKey
 Generic public key. More...
class  QPipe
 A FIFO buffer (named pipe) abstraction. More...
class  QPipeDevice
 Unbuffered direct pipe. More...
class  QPipeEnd
 A buffered higher-level pipe end. More...
class  Random
 Source of random numbers. More...
class  RandomContext
 Random provider. More...
class  RSAContext
 RSA provider. More...
class  RSAPrivateKey
 RSA Private Key. More...
class  RSAPublicKey
 RSA Public Key. More...
class  SASL
 Simple Authentication and Security Layer protocol implementation. More...
class  SASLContext
 SASL provider. More...
class  SecureArray
 Secure array of bytes. More...
class  SecureLayer
 Abstract interface to a security layer. More...
class  SecureMessage
 Class representing a secure message. More...
class  SecureMessageKey
 Key for SecureMessage system. More...
class  SecureMessageSignature
 SecureMessage signature. More...
class  SecureMessageSystem
 Abstract superclass for secure messaging systems. More...
class  SMSContext
 SecureMessageSystem provider. More...
class  SymmetricKey
 Container for keys for symmetric encryption algorithms. More...
class  Synchronizer
 Enable synchronization between two threads. More...
class  SyncThread
 Convenience class to run a thread and interact with it synchronously. More...
class  TextFilter
 Superclass for text based filtering algorithms. More...
class  TLS
 Transport Layer Security / Secure Socket Layer. More...
class  TLSContext
 TLS provider. More...
class  TLSSession
 Session token, used for TLS resuming. More...
class  TLSSessionContext
 TLS "session" provider. More...
class  TokenAsker
 User token handler. More...

Typedefs

typedef QMultiMap
< CertificateInfoType, QString
CertificateInfo
typedef QList< ConstraintTypeConstraints
typedef QList< Provider * > ProviderList
typedef QList< SecureMessageKeySecureMessageKeyList
typedef QList
< SecureMessageSignature
SecureMessageSignatureList

Enumerations

enum  CertificateInfoTypeKnown {
  CommonName, Email, EmailLegacy, Organization,
  OrganizationalUnit, Locality, IncorporationLocality, State,
  IncorporationState, Country, IncorporationCountry, URI,
  DNS, IPAddress, XMPP
}
enum  CertificateRequestFormat { PKCS10, SPKAC }
enum  ConstraintTypeKnown {
  DigitalSignature, NonRepudiation, KeyEncipherment, DataEncipherment,
  KeyAgreement, KeyCertificateSign, CRLSign, EncipherOnly,
  DecipherOnly, ServerAuth, ClientAuth, CodeSigning,
  EmailProtection, IPSecEndSystem, IPSecTunnel, IPSecUser,
  TimeStamping, OCSPSigning
}
enum  ConvertResult { ConvertGood, ErrorDecode, ErrorPassphrase, ErrorFile }
enum  Direction { Encode, Decode }
enum  DLGroupSet {
  DSA_512, DSA_768, DSA_1024, IETF_768,
  IETF_1024, IETF_1536, IETF_2048, IETF_3072,
  IETF_4096, IETF_6144, IETF_8192
}
enum  EncryptionAlgorithm { EME_PKCS1v15, EME_PKCS1_OAEP }
enum  MemoryMode { Practical, Locking, LockingKeepPrivileges }
enum  PBEAlgorithm {
  PBEDefault, PBES2_DES_SHA1, PBES2_TripleDES_SHA1, PBES2_AES128_SHA1,
  PBES2_AES192_SHA1, PBES2_AES256_SHA1
}
enum  SecurityLevel {
  SL_None, SL_Integrity, SL_Export, SL_Baseline,
  SL_High, SL_Highest
}
enum  SignatureAlgorithm {
  SignatureUnknown, EMSA1_SHA1, EMSA3_SHA1, EMSA3_MD5,
  EMSA3_MD2, EMSA3_RIPEMD160, EMSA3_Raw
}
enum  SignatureFormat { DefaultFormat, IEEE_1363, DERSequence }
enum  UsageMode {
  UsageAny = 0x00, UsageTLSServer = 0x01, UsageTLSClient = 0x02, UsageCodeSigning = 0x04,
  UsageEmailProtection = 0x08, UsageTimeStamping = 0x10, UsageCRLSigning = 0x20
}
enum  ValidateFlags { ValidateAll = 0x00, ValidateRevoked = 0x01, ValidateExpired = 0x02, ValidatePolicy = 0x04 }
enum  Validity {
  ValidityGood, ErrorRejected, ErrorUntrusted, ErrorSignatureFailed,
  ErrorInvalidCA, ErrorInvalidPurpose, ErrorSelfSigned, ErrorRevoked,
  ErrorPathLengthExceeded, ErrorExpired, ErrorExpiredCA, ErrorValidityUnknown = 64
}

Functions

QCA_EXPORT void appendPluginDiagnosticText (const QString &text)
QCA_EXPORT QString appName ()
QCA_EXPORT QString arrayToHex (const QByteArray &array)
QCA_EXPORT void clearPluginDiagnosticText ()
QCA_EXPORT QStringList defaultFeatures ()
QCA_EXPORT ProviderdefaultProvider ()
QCA_EXPORT void deinit ()
QCA_EXPORT QByteArray emsa3Encode (const QString &hashName, const QByteArray &digest, int size=-1)
QCA_EXPORT ProviderfindProvider (const QString &name)
QCA_EXPORT QVariant getProperty (const QString &name)
QCA_EXPORT QVariantMap getProviderConfig (const QString &name)
QCA_EXPORT QString globalRandomProvider ()
QCA_EXPORT bool haveSecureMemory ()
QCA_EXPORT bool haveSecureRandom ()
QCA_EXPORT bool haveSystemStore ()
QCA_EXPORT QByteArray hexToArray (const QString &hexString)
QCA_EXPORT void init (MemoryMode m, int prealloc)
QCA_EXPORT void init ()
QCA_EXPORT bool insertProvider (Provider *p, int priority=0)
QCA_EXPORT bool isSupported (const QStringList &features, const QString &provider=QString())
QCA_EXPORT bool isSupported (const char *features, const QString &provider=QString())
QCA_EXPORT Loggerlogger ()
QCA_EXPORT QStringList makeFriendlyNames (const QList< Certificate > &list)
QCA_EXPORT const SecureArray operator+ (const SecureArray &a, const SecureArray &b)
QCA_EXPORT CertificateInfoOrdered orderedDNOnly (const CertificateInfoOrdered &in)
QCA_EXPORT QString orderedToDNString (const CertificateInfoOrdered &in)
QCA_EXPORT QString pluginDiagnosticText ()
QCA_EXPORT int providerPriority (const QString &name)
QCA_EXPORT ProviderList providers ()
QCA_EXPORT void saveProviderConfig (const QString &name)
QCA_EXPORT void scanForPlugins ()
QCA_EXPORT void setAppName (const QString &name)
QCA_EXPORT void setGlobalRandomProvider (const QString &provider)
QCA_EXPORT void setProperty (const QString &name, const QVariant &value)
QCA_EXPORT void setProviderConfig (const QString &name, const QVariantMap &config)
QCA_EXPORT void setProviderPriority (const QString &name, int priority)
QCA_EXPORT QStringList supportedFeatures ()
QCA_EXPORT CertificateCollection systemStore ()
QCA_EXPORT void unloadAllPlugins ()


Detailed Description

QCA - the Qt Cryptographic Architecture.

Typedef Documentation

Certificate properties type.

With this container, the information is not necessarily stored in the same sequence as the certificate format itself. Use this container if the order the information is/was stored does not matter for you (this is the case with most applications).

Additionally, the EmailLegacy type should not be used with this container. Use Email instead.

Certificate constraints type

Convenience representation for the plugin providers.

You can get a list of providers using the providers() function

See also:
ProviderListIterator

providers()

A list of message keys.

A list of signatures.


Enumeration Type Documentation

Certificate Request Format.

Enumerator:
PKCS10  standard PKCS#10 format
SPKAC  Signed Public Key and Challenge (Netscape) format.

Known types of information stored in certificates.

This enumerator offers a convenient way to work with common types.

Enumerator:
CommonName  The common name (eg person), id = "2.5.4.3".
Email  Email address, id = "GeneralName.rfc822Name".
EmailLegacy  PKCS#9 Email field, id = "1.2.840.113549.1.9.1".
Organization  An organisation (eg company), id = "2.5.4.10".
OrganizationalUnit  An part of an organisation (eg a division or branch), id = "2.5.4.11".
Locality  The locality (eg city, a shire, or part of a state), id = "2.5.4.7".
IncorporationLocality  The locality of incorporation (EV certificates), id = "1.3.6.1.4.1.311.60.2.1.1".
State  The state within the country, id = "2.5.4.8".
IncorporationState  The state of incorporation (EV certificates), id = "1.3.6.1.4.1.311.60.2.1.2".
Country  The country, id = "2.5.4.6".
IncorporationCountry  The country of incorporation (EV certificates), id = "1.3.6.1.4.1.311.60.2.1.3".
URI  Uniform Resource Identifier, id = "GeneralName.uniformResourceIdentifier".
DNS  DNS name, id = "GeneralName.dNSName".
IPAddress  IP address, id = "GeneralName.iPAddress".
XMPP  XMPP address (see http://www.ietf.org/rfc/rfc3920.txt), id = "1.3.6.1.5.5.7.8.5".

Known types of certificate constraints.

This enumerator offers a convenient way to work with common types.

Enumerator:
DigitalSignature  Certificate can be used to create digital signatures, id = "KeyUsage.digitalSignature"
NonRepudiation  Certificate can be used for non-repudiation, id = "KeyUsage.nonRepudiation"
KeyEncipherment  Certificate can be used for encrypting / decrypting keys, id = "KeyUsage.keyEncipherment"
DataEncipherment  Certificate can be used for encrypting / decrypting data, id = "KeyUsage.dataEncipherment"
KeyAgreement  Certificate can be used for key agreement, id = "KeyUsage.keyAgreement"
KeyCertificateSign  Certificate can be used for key certificate signing, id = "KeyUsage.keyCertSign"
CRLSign  Certificate can be used to sign Certificate Revocation Lists, id = "KeyUsage.crlSign"
EncipherOnly  Certificate can only be used for encryption, id = "KeyUsage.encipherOnly"
DecipherOnly  Certificate can only be used for decryption, id = "KeyUsage.decipherOnly"
ServerAuth  Certificate can be used for server authentication (e.g. web server), id = "1.3.6.1.5.5.7.3.1". This is an extended usage constraint.
ClientAuth  Certificate can be used for client authentication (e.g. web browser), id = "1.3.6.1.5.5.7.3.2". This is an extended usage constraint.
CodeSigning  Certificate can be used to sign code, id = "1.3.6.1.5.5.7.3.3". This is an extended usage constraint.
EmailProtection  Certificate can be used to sign / encrypt email, id = "1.3.6.1.5.5.7.3.4". This is an extended usage constraint.
IPSecEndSystem  Certificate can be used to authenticate a endpoint in IPSEC, id = "1.3.6.1.5.5.7.3.5". This is an extended usage constraint.
IPSecTunnel  Certificate can be used to authenticate a tunnel in IPSEC, id = "1.3.6.1.5.5.7.3.6". This is an extended usage constraint.
IPSecUser  Certificate can be used to authenticate a user in IPSEC, id = "1.3.6.1.5.5.7.3.7". This is an extended usage constraint.
TimeStamping  Certificate can be used to create a "time stamp" signature, id = "1.3.6.1.5.5.7.3.8". This is an extended usage constraint.
OCSPSigning  Certificate can be used to sign an Online Certificate Status Protocol (OCSP) assertion, id = "1.3.6.1.5.5.7.3.9". This is an extended usage constraint.

Specify the intended usage of a certificate.

Enumerator:
UsageAny  Any application, or unspecified.
UsageTLSServer  server side of a TLS or SSL connection
UsageTLSClient  client side of a TLS or SSL connection
UsageCodeSigning  code signing certificate
UsageEmailProtection  email (S/MIME) certificate
UsageTimeStamping  time stamping certificate
UsageCRLSigning  certificate revocation list signing certificate

The validity (or otherwise) of a certificate.

Enumerator:
ValidityGood  The certificate is valid.
ErrorRejected  The root CA rejected the certificate purpose.
ErrorUntrusted  The certificate is not trusted.
ErrorSignatureFailed  The signature does not match.
ErrorInvalidCA  The Certificate Authority is invalid.
ErrorInvalidPurpose  The purpose does not match the intended usage.
ErrorSelfSigned  The certificate is self-signed, and is not found in the list of trusted certificates.
ErrorRevoked  The certificate has been revoked.
ErrorPathLengthExceeded  The path length from the root CA to this certificate is too long.
ErrorExpired  The certificate has expired, or is not yet valid (e.g. current time is earlier than notBefore time).
ErrorExpiredCA  The Certificate Authority has expired.
ErrorValidityUnknown  Validity is unknown.

The conditions to validate for a certificate.

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.

See also:
Initializer
Enumerator:
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.

Enumerator:
Encode  Operate in the "forward" direction; for example, encrypting.
Decode  Operate in the "reverse" direction; for example, decrypting.

Encryption algorithms.

Enumerator:
EME_PKCS1v15  Block type 2 (PKCS#1, Version 1.5).
EME_PKCS1_OAEP  Optimal asymmetric encryption padding (PKCS#1, Version 2.0).

Signature algorithm variants.

Enumerator:
SignatureUnknown  Unknown signing algorithm.
EMSA1_SHA1  SHA1, with EMSA1 (IEEE1363-2000) encoding (this is the usual DSA algorithm - FIPS186).
EMSA3_SHA1  SHA1, with EMSA3 (ie PKCS#1 Version 1.5) encoding.
EMSA3_MD5  MD5, with EMSA3 (ie PKCS#1 Version 1.5) encoding (this is the usual RSA algorithm).
EMSA3_MD2  MD2, with EMSA3 (ie PKCS#1 Version 1.5) encoding.
EMSA3_RIPEMD160  RIPEMD160, with EMSA3 (ie PKCS#1 Version 1.5) encoding.
EMSA3_Raw  EMSA3 without computing a message digest or a DigestInfo encoding (identical to PKCS#11's CKM_RSA_PKCS mechanism).

Signature formats (DSA only).

Enumerator:
DefaultFormat  For DSA, this is the same as IEEE_1363.
IEEE_1363  40-byte format from IEEE 1363 (Botan/.NET)
DERSequence  Signature wrapped in DER formatting (OpenSSL/Java).

Password-based encryption.

Enumerator:
PBEDefault  Use modern default (same as PBES2_TripleDES_SHA1).
PBES2_DES_SHA1  PKCS#5 v2.0 DES/CBC,SHA1.
PBES2_TripleDES_SHA1  PKCS#5 v2.0 TripleDES/CBC,SHA1.
PBES2_AES128_SHA1  PKCS#5 v2.0 AES-128/CBC,SHA1.
PBES2_AES192_SHA1  PKCS#5 v2.0 AES-192/CBC,SHA1.
PBES2_AES256_SHA1  PKCS#5 v2.0 AES-256/CBC,SHA1.

Return value from a format conversion.

Note that if you are checking for any result other than ConvertGood, then you may be introducing a provider specific dependency.

Enumerator:
ConvertGood  Conversion succeeded, results should be valid.
ErrorDecode  General failure in the decode stage.
ErrorPassphrase  Failure because of incorrect passphrase.
ErrorFile  Failure because of incorrect file.

Well known discrete logarithm group sets.

These sets are derived from three main sources: Java Cryptographic Extensions, RFC2412 and RFC3526.

Enumerator:
DSA_512  512 bit group, for compatibility with JCE
DSA_768  768 bit group, for compatibility with JCE
DSA_1024  1024 bit group, for compatibility with JCE
IETF_768  Group 1 from RFC 2412, Section E.1.
IETF_1024  Group 2 from RFC 2412, Section E.2.
IETF_1536  1536-bit MODP Group ("group 5") from RFC3526 Section 2.
IETF_2048  2048-bit MODP Group ("group 14") from RFC3526 Section 3.
IETF_3072  3072-bit MODP Group ("group 15") from RFC3526 Section 4.
IETF_4096  4096-bit MODP Group ("group 16") from RFC3526 Section 5.
IETF_6144  6144-bit MODP Group ("group 17") from RFC3526 Section 6.
IETF_8192  8192-bit MODP Group ("group 18") from RFC3526 Section 7.

Specify the lower-bound for acceptable TLS/SASL security layers.

For TLS, the interpretation of these levels is:

  • Any cipher suite that provides non-authenticated communications (usually anonymous Diffie-Hellman) is SL_Integrity.
  • Any cipher suite that is limited to 40 bits (export-version crippled forms of RC2, RC4 or DES) is SL_Export. Standard DES (56 bits) and some forms of RC4 (64 bits) are also SL_Export.
  • Any normal cipher (AES, Camellia, RC4 or similar) with 128 bits, or Elliptic Curve Ciphers with 283 bits, is SL_Baseline
  • AES or Camellia at least 192 bits, triple-DES and similar ciphers are SL_High. ECC with 409 or more bits is also SL_High.
  • Highest does not have an equivalent strength. It indicates that the provider should use the strongest ciphers available (but not less than SL_High).
Enumerator:
SL_None  indicates that no security is ok
SL_Integrity  must at least get integrity protection
SL_Export  must be export level bits or more
SL_Baseline  must be 128 bit or more
SL_High  must be more than 128 bit
SL_Highest  SL_High or max possible, whichever is greater.


Function Documentation

QCA_EXPORT QString QCA::orderedToDNString ( const CertificateInfoOrdered &  in  ) 

Convert to RFC 1779 string format.

Parameters:
in the certificate info to convert

Referenced by QCA::CertificateInfoOrdered::toString().

QCA_EXPORT CertificateInfoOrdered QCA::orderedDNOnly ( const CertificateInfoOrdered &  in  ) 

Return a new CertificateInfoOrdered that only contains the Distinguished Name (DN) types found in the input object.

Parameters:
in the certificate info to extract from

Referenced by QCA::CertificateInfoOrdered::dnOnly().

QCA_EXPORT QStringList QCA::makeFriendlyNames ( const QList< Certificate > &  list  ) 

Create a list of unique friendly names among a list of certificates.

Parameters:
list the list of certificates for which a friendly name is required.

QCA_EXPORT void QCA::init (  ) 

Initialise QCA.

This call is not normally required, because it is cleaner to use an Initializer.

QCA_EXPORT void QCA::init ( MemoryMode  m,
int  prealloc 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
m the MemoryMode to use
prealloc the amount of memory in kilobytes to allocate for secure storage