QCA

qcaprovider.h
Go to the documentation of this file.
1 /*
2  * qcaprovider.h - QCA Plugin API
3  * Copyright (C) 2003-2007 Justin Karneges <[email protected]>
4  * Copyright (C) 2004,2005 Brad Hards <[email protected]>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  *
21  */
22 
33 #ifndef QCAPROVIDER_H
34 #define QCAPROVIDER_H
35 
36 #include "qca_basic.h"
37 #include "qca_cert.h"
38 #include "qca_core.h"
39 #include "qca_keystore.h"
40 #include "qca_publickey.h"
41 #include "qca_securelayer.h"
42 #include "qca_securemessage.h"
43 
44 #include <limits>
45 
46 #ifndef DOXYGEN_NO_PROVIDER_API
47 
82 class QCA_EXPORT QCAPlugin
83 {
84 public:
88  virtual ~QCAPlugin()
89  {
90  }
91 
95  virtual QCA::Provider *createProvider() = 0;
96 };
97 
98 Q_DECLARE_INTERFACE(QCAPlugin, "com.affinix.qca.Plugin/1.0")
99 
100 namespace QCA {
101 
112 class QCA_EXPORT InfoContext : public BasicContext
113 {
114  Q_OBJECT
115 public:
122  : BasicContext(p, QStringLiteral("info"))
123  {
124  }
125 
129  virtual QStringList supportedHashTypes() const;
130 
134  virtual QStringList supportedCipherTypes() const;
135 
139  virtual QStringList supportedMACTypes() const;
140 };
141 
152 class QCA_EXPORT RandomContext : public BasicContext
153 {
154  Q_OBJECT
155 public:
162  : BasicContext(p, QStringLiteral("random"))
163  {
164  }
165 
171  virtual SecureArray nextBytes(int size) = 0;
172 };
173 
184 class QCA_EXPORT HashContext : public BasicContext
185 {
186  Q_OBJECT
187 public:
194  HashContext(Provider *p, const QString &type)
195  : BasicContext(p, type)
196  {
197  }
198 
202  virtual void clear() = 0;
203 
209  virtual void update(const MemoryRegion &a) = 0;
210 
214  virtual MemoryRegion final() = 0;
215 };
216 
227 class QCA_EXPORT CipherContext : public BasicContext
228 {
229  Q_OBJECT
230 public:
240  CipherContext(Provider *p, const QString &type)
241  : BasicContext(p, type)
242  {
243  }
244 
253  virtual void setup(Direction dir, const SymmetricKey &key, const InitializationVector &iv, const AuthTag &tag) = 0;
254 
258  virtual KeyLength keyLength() const = 0;
259 
263  virtual int blockSize() const = 0;
264 
268  virtual AuthTag tag() const = 0;
269 
276  virtual bool update(const SecureArray &in, SecureArray *out) = 0;
277 
283  virtual bool final(SecureArray *out) = 0;
284 };
285 
297 class QCA_EXPORT MACContext : public BasicContext
298 {
299  Q_OBJECT
300 public:
306  MACContext(Provider *p, const QString &type)
307  : BasicContext(p, type)
308  {
309  }
310 
316  virtual void setup(const SymmetricKey &key) = 0;
317 
321  virtual KeyLength keyLength() const = 0;
322 
328  virtual void update(const MemoryRegion &in) = 0;
329 
335  virtual void final(MemoryRegion *out) = 0;
336 
337 protected:
342  {
343  // this is used instead of a default implementation to make sure that
344  // provider authors think about it, at least a bit.
345  // See Meyers, Effective C++, Effective C++ (2nd Ed), Item 36
346  return KeyLength(0, INT_MAX, 1);
347  }
348 };
349 
361 class QCA_EXPORT KDFContext : public BasicContext
362 {
363  Q_OBJECT
364 public:
371  KDFContext(Provider *p, const QString &type)
372  : BasicContext(p, type)
373  {
374  }
375 
384  virtual SymmetricKey makeKey(const SecureArray & secret,
385  const InitializationVector &salt,
386  unsigned int keyLength,
387  unsigned int iterationCount) = 0;
388 
398  virtual SymmetricKey makeKey(const SecureArray & secret,
399  const InitializationVector &salt,
400  unsigned int keyLength,
401  int msecInterval,
402  unsigned int * iterationCount) = 0;
403 };
404 
415 class QCA_EXPORT HKDFContext : public BasicContext
416 {
417  Q_OBJECT
418 public:
425  HKDFContext(Provider *p, const QString &type)
426  : BasicContext(p, type)
427  {
428  }
429 
438  virtual SymmetricKey makeKey(const SecureArray & secret,
439  const InitializationVector &salt,
440  const InitializationVector &info,
441  unsigned int keyLength) = 0;
442 };
443 
454 class QCA_EXPORT DLGroupContext : public Provider::Context
455 {
456  Q_OBJECT
457 public:
464  : Provider::Context(p, QStringLiteral("dlgroup"))
465  {
466  }
467 
471  virtual QList<DLGroupSet> supportedGroupSets() const = 0;
472 
476  virtual bool isNull() const = 0;
477 
491  virtual void fetchGroup(DLGroupSet set, bool block) = 0;
492 
501  virtual void getResult(BigInteger *p, BigInteger *q, BigInteger *g) const = 0;
502 
503 Q_SIGNALS:
508  void finished();
509 };
510 
522 class QCA_EXPORT PKeyBase : public BasicContext
523 {
524  Q_OBJECT
525 public:
532  PKeyBase(Provider *p, const QString &type);
533 
539  virtual bool isNull() const = 0;
540 
544  virtual PKey::Type type() const = 0;
545 
549  virtual bool isPrivate() const = 0;
550 
556  virtual bool canExport() const = 0;
557 
564  virtual void convertToPublic() = 0;
565 
569  virtual int bits() const = 0;
570 
577  virtual int maximumEncryptSize(EncryptionAlgorithm alg) const;
578 
585  virtual SecureArray encrypt(const SecureArray &in, EncryptionAlgorithm alg);
586 
595  virtual bool decrypt(const SecureArray &in, SecureArray *out, EncryptionAlgorithm alg);
596 
603  virtual void startSign(SignatureAlgorithm alg, SignatureFormat format);
604 
611  virtual void startVerify(SignatureAlgorithm alg, SignatureFormat format);
612 
619  virtual void update(const MemoryRegion &in);
620 
626  virtual QByteArray endSign();
627 
635  virtual bool endVerify(const QByteArray &sig);
636 
645  virtual SymmetricKey deriveKey(const PKeyBase &theirs);
646 
647 Q_SIGNALS:
652  void finished();
653 };
654 
666 class QCA_EXPORT RSAContext : public PKeyBase
667 {
668  Q_OBJECT
669 public:
676  : PKeyBase(p, QStringLiteral("rsa"))
677  {
678  }
679 
694  virtual void createPrivate(int bits, int exp, bool block) = 0;
695 
705  virtual void createPrivate(const BigInteger &n,
706  const BigInteger &e,
707  const BigInteger &p,
708  const BigInteger &q,
709  const BigInteger &d) = 0;
710 
717  virtual void createPublic(const BigInteger &n, const BigInteger &e) = 0;
718 
722  virtual BigInteger n() const = 0;
723 
727  virtual BigInteger e() const = 0;
728 
732  virtual BigInteger p() const = 0;
733 
737  virtual BigInteger q() const = 0;
738 
742  virtual BigInteger d() const = 0;
743 };
744 
756 class QCA_EXPORT DSAContext : public PKeyBase
757 {
758  Q_OBJECT
759 public:
766  : PKeyBase(p, QStringLiteral("dsa"))
767  {
768  }
769 
783  virtual void createPrivate(const DLGroup &domain, bool block) = 0;
784 
792  virtual void createPrivate(const DLGroup &domain, const BigInteger &y, const BigInteger &x) = 0;
793 
800  virtual void createPublic(const DLGroup &domain, const BigInteger &y) = 0;
801 
805  virtual DLGroup domain() const = 0;
806 
810  virtual BigInteger y() const = 0;
811 
815  virtual BigInteger x() const = 0;
816 };
817 
829 class QCA_EXPORT DHContext : public PKeyBase
830 {
831  Q_OBJECT
832 public:
839  : PKeyBase(p, QStringLiteral("dh"))
840  {
841  }
842 
856  virtual void createPrivate(const DLGroup &domain, bool block) = 0;
857 
866  virtual void createPrivate(const DLGroup &domain, const BigInteger &y, const BigInteger &x) = 0;
867 
875  virtual void createPublic(const DLGroup &domain, const BigInteger &y) = 0;
876 
880  virtual DLGroup domain() const = 0;
881 
885  virtual BigInteger y() const = 0;
886 
890  virtual BigInteger x() const = 0;
891 };
892 
908 class QCA_EXPORT PKeyContext : public BasicContext
909 {
910  Q_OBJECT
911 public:
918  : BasicContext(p, QStringLiteral("pkey"))
919  {
920  }
921 
925  virtual QList<PKey::Type> supportedTypes() const = 0;
926 
931  virtual QList<PKey::Type> supportedIOTypes() const = 0;
932 
937  virtual QList<PBEAlgorithm> supportedPBEAlgorithms() const = 0;
938 
942  virtual PKeyBase *key() = 0;
943 
947  virtual const PKeyBase *key() const = 0;
948 
956  virtual void setKey(PKeyBase *key) = 0;
957 
969  virtual bool importKey(const PKeyBase *key) = 0;
970 
976  virtual QByteArray publicToDER() const;
977 
983  virtual QString publicToPEM() const;
984 
993  virtual ConvertResult publicFromDER(const QByteArray &a);
994 
1003  virtual ConvertResult publicFromPEM(const QString &s);
1004 
1014  virtual SecureArray privateToDER(const SecureArray &passphrase, PBEAlgorithm pbe) const;
1015 
1025  virtual QString privateToPEM(const SecureArray &passphrase, PBEAlgorithm pbe) const;
1026 
1036  virtual ConvertResult privateFromDER(const SecureArray &a, const SecureArray &passphrase);
1037 
1047  virtual ConvertResult privateFromPEM(const QString &s, const SecureArray &passphrase);
1048 };
1049 
1061 class QCA_EXPORT CertBase : public BasicContext
1062 {
1063  Q_OBJECT
1064 public:
1071  CertBase(Provider *p, const QString &type)
1072  : BasicContext(p, type)
1073  {
1074  }
1075 
1081  virtual QByteArray toDER() const = 0;
1082 
1088  virtual QString toPEM() const = 0;
1089 
1098  virtual ConvertResult fromDER(const QByteArray &a) = 0;
1099 
1108  virtual ConvertResult fromPEM(const QString &s) = 0;
1109 };
1110 
1125 class QCA_EXPORT CertContextProps
1126 {
1127 public:
1133  int version;
1134 
1141 
1148 
1153 
1160 
1165 
1170 
1177 
1184 
1191 
1198 
1203  bool isCA;
1204 
1211 
1216 
1221 
1226 
1233 
1240 
1247 
1254 };
1255 
1268 class QCA_EXPORT CRLContextProps
1269 {
1270 public:
1275 
1279  int number;
1280 
1285 
1290 
1295 
1300 
1305 
1310 };
1311 
1312 class CRLContext;
1313 
1324 class QCA_EXPORT CertContext : public CertBase
1325 {
1326  Q_OBJECT
1327 public:
1334  : CertBase(p, QStringLiteral("cert"))
1335  {
1336  }
1337 
1349  virtual bool createSelfSigned(const CertificateOptions &opts, const PKeyContext &priv) = 0;
1350 
1354  virtual const CertContextProps *props() const = 0;
1355 
1362  virtual bool compare(const CertContext *other) const = 0;
1363 
1368  virtual PKeyContext *subjectPublicKey() const = 0;
1369 
1376  virtual bool isIssuerOf(const CertContext *other) const = 0;
1377 
1389  virtual Validity validate(const QList<CertContext *> &trusted,
1390  const QList<CertContext *> &untrusted,
1391  const QList<CRLContext *> & crls,
1392  UsageMode u,
1393  ValidateFlags vf) const = 0;
1394 
1410  virtual Validity validate_chain(const QList<CertContext *> &chain,
1411  const QList<CertContext *> &trusted,
1412  const QList<CRLContext *> & crls,
1413  UsageMode u,
1414  ValidateFlags vf) const = 0;
1415 };
1416 
1428 class QCA_EXPORT CSRContext : public CertBase
1429 {
1430  Q_OBJECT
1431 public:
1438  : CertBase(p, QStringLiteral("csr"))
1439  {
1440  }
1441 
1448  virtual bool canUseFormat(CertificateRequestFormat f) const = 0;
1449 
1461  virtual bool createRequest(const CertificateOptions &opts, const PKeyContext &priv) = 0;
1462 
1466  virtual const CertContextProps *props() const = 0;
1467 
1474  virtual bool compare(const CSRContext *other) const = 0;
1475 
1480  virtual PKeyContext *subjectPublicKey() const = 0;
1481 
1488  virtual QString toSPKAC() const = 0;
1489 
1499  virtual ConvertResult fromSPKAC(const QString &s) = 0;
1500 };
1501 
1512 class QCA_EXPORT CRLContext : public CertBase
1513 {
1514  Q_OBJECT
1515 public:
1522  : CertBase(p, QStringLiteral("crl"))
1523  {
1524  }
1525 
1529  virtual const CRLContextProps *props() const = 0;
1530 
1536  virtual bool compare(const CRLContext *other) const = 0;
1537 };
1538 
1550 class QCA_EXPORT CertCollectionContext : public BasicContext
1551 {
1552  Q_OBJECT
1553 public:
1560  : BasicContext(p, QStringLiteral("certcollection"))
1561  {
1562  }
1563 
1572  virtual QByteArray toPKCS7(const QList<CertContext *> &certs, const QList<CRLContext *> &crls) const = 0;
1573 
1587  virtual ConvertResult
1588  fromPKCS7(const QByteArray &a, QList<CertContext *> *certs, QList<CRLContext *> *crls) const = 0;
1589 };
1590 
1602 class QCA_EXPORT CAContext : public BasicContext
1603 {
1604  Q_OBJECT
1605 public:
1612  : BasicContext(p, QStringLiteral("ca"))
1613  {
1614  }
1615 
1624  virtual void setup(const CertContext &cert, const PKeyContext &priv) = 0;
1625 
1630  virtual CertContext *certificate() const = 0;
1631 
1639  virtual CertContext *signRequest(const CSRContext &req, const QDateTime &notValidAfter) const = 0;
1640 
1648  virtual CertContext *createCertificate(const PKeyContext &pub, const CertificateOptions &opts) const = 0;
1649 
1658  virtual CRLContext *createCRL(const QDateTime &nextUpdate) const = 0;
1659 
1669  virtual CRLContext *
1670  updateCRL(const CRLContext &crl, const QList<CRLEntry> &entries, const QDateTime &nextUpdate) const = 0;
1671 };
1672 
1683 class QCA_EXPORT PKCS12Context : public BasicContext
1684 {
1685  Q_OBJECT
1686 public:
1693  : BasicContext(p, QStringLiteral("pkcs12"))
1694  {
1695  }
1696 
1707  virtual QByteArray toPKCS12(const QString & name,
1708  const QList<const CertContext *> &chain,
1709  const PKeyContext & priv,
1710  const SecureArray & passphrase) const = 0;
1711 
1726  virtual ConvertResult fromPKCS12(const QByteArray & in,
1727  const SecureArray & passphrase,
1728  QString * name,
1729  QList<CertContext *> *chain,
1730  PKeyContext ** priv) const = 0;
1731 };
1732 
1745 class QCA_EXPORT PGPKeyContextProps
1746 {
1747 public:
1752 
1758 
1762  bool isSecret;
1763 
1768 
1773 
1780 
1786 
1792 };
1793 
1804 class QCA_EXPORT PGPKeyContext : public BasicContext
1805 {
1806  Q_OBJECT
1807 public:
1814  : BasicContext(p, QStringLiteral("pgpkey"))
1815  {
1816  }
1817 
1821  virtual const PGPKeyContextProps *props() const = 0;
1822 
1826  virtual QByteArray toBinary() const = 0;
1827 
1831  virtual QString toAscii() const = 0;
1832 
1841  virtual ConvertResult fromBinary(const QByteArray &a) = 0;
1842 
1851  virtual ConvertResult fromAscii(const QString &s) = 0;
1852 };
1853 
1865 class QCA_EXPORT KeyStoreEntryContext : public BasicContext
1866 {
1867  Q_OBJECT
1868 public:
1875  : BasicContext(p, QStringLiteral("keystoreentry"))
1876  {
1877  }
1878 
1882  virtual KeyStoreEntry::Type type() const = 0;
1883 
1889  virtual QString id() const = 0;
1890 
1894  virtual QString name() const = 0;
1895 
1899  virtual QString storeId() const = 0;
1900 
1904  virtual QString storeName() const = 0;
1905 
1909  virtual bool isAvailable() const;
1910 
1919  virtual QString serialize() const = 0;
1920 
1925  virtual KeyBundle keyBundle() const;
1926 
1931  virtual Certificate certificate() const;
1932 
1937  virtual CRL crl() const;
1938 
1943  virtual PGPKey pgpSecretKey() const;
1944 
1950  virtual PGPKey pgpPublicKey() const;
1951 
1960  virtual bool ensureAccess();
1961 };
1962 
1973 class QCA_EXPORT KeyStoreListContext : public Provider::Context
1974 {
1975  Q_OBJECT
1976 public:
1983  : Provider::Context(p, QStringLiteral("keystorelist"))
1984  {
1985  }
1986 
1990  virtual void start();
1991 
2000  virtual void setUpdatesEnabled(bool enabled);
2001 
2011  virtual QList<int> keyStores() = 0;
2012 
2019  virtual KeyStore::Type type(int id) const = 0;
2020 
2032  virtual QString storeId(int id) const = 0;
2033 
2040  virtual QString name(int id) const = 0;
2041 
2050  virtual bool isReadOnly(int id) const;
2051 
2061  virtual QList<KeyStoreEntry::Type> entryTypes(int id) const = 0;
2062 
2071  virtual QList<KeyStoreEntryContext *> entryList(int id) = 0;
2072 
2082  virtual KeyStoreEntryContext *entry(int id, const QString &entryId);
2083 
2096  virtual KeyStoreEntryContext *entryPassive(const QString &serialized);
2097 
2107  virtual QString writeEntry(int id, const KeyBundle &kb);
2108 
2118  virtual QString writeEntry(int id, const Certificate &cert);
2119 
2129  virtual QString writeEntry(int id, const CRL &crl);
2130 
2140  virtual QString writeEntry(int id, const PGPKey &key);
2141 
2151  virtual bool removeEntry(int id, const QString &entryId);
2152 
2153 Q_SIGNALS:
2171  void busyStart();
2172 
2180  void busyEnd();
2181 
2186  void updated();
2187 
2193  void diagnosticText(const QString &str);
2194 
2201  void storeUpdated(int id);
2202 };
2203 
2214 class QCA_EXPORT TLSSessionContext : public BasicContext
2215 {
2216  Q_OBJECT
2217 public:
2224  : BasicContext(p, QStringLiteral("tlssession"))
2225  {
2226  }
2227 };
2228 
2239 class QCA_EXPORT TLSContext : public Provider::Context
2240 {
2241  Q_OBJECT
2242 public:
2253  {
2254  public:
2259 
2264 
2271 
2276 
2282 
2288  };
2289 
2293  enum Result
2294  {
2297  Continue
2298  };
2299 
2306  TLSContext(Provider *p, const QString &type)
2307  : Provider::Context(p, type)
2308  {
2309  }
2310 
2314  virtual void reset() = 0;
2315 
2323  virtual QStringList supportedCipherSuites(const TLS::Version &version) const = 0;
2324 
2328  virtual bool canCompress() const = 0;
2329 
2333  virtual bool canSetHostName() const = 0;
2334 
2338  virtual int maxSSF() const = 0;
2339 
2350  virtual void setup(bool serverMode, const QString &hostName, bool compress) = 0;
2351 
2360  virtual void setConstraints(int minSSF, int maxSSF) = 0;
2361 
2374  virtual void setConstraints(const QStringList &cipherSuiteList) = 0;
2375 
2383  virtual void setTrustedCertificates(const CertificateCollection &trusted) = 0;
2384 
2394  virtual void setIssuerList(const QList<CertificateInfoOrdered> &issuerList) = 0;
2395 
2404  virtual void setCertificate(const CertificateChain &cert, const PrivateKey &key) = 0;
2405 
2413  virtual void setSessionId(const TLSSessionContext &id) = 0;
2414 
2423  virtual void shutdown() = 0;
2424 
2432  virtual void setMTU(int size);
2433 
2446  virtual void start() = 0;
2447 
2473  virtual void update(const QByteArray &from_net, const QByteArray &from_app) = 0;
2474 
2484  virtual bool waitForResultsReady(int msecs) = 0;
2485 
2489  virtual Result result() const = 0;
2490 
2494  virtual QByteArray to_net() = 0;
2495 
2500  virtual int encoded() const = 0;
2501 
2506  virtual QByteArray to_app() = 0;
2507 
2511  virtual bool eof() const = 0;
2512 
2519  virtual bool clientHelloReceived() const = 0;
2520 
2526  virtual bool serverHelloReceived() const = 0;
2527 
2534  virtual QString hostName() const = 0;
2535 
2541  virtual bool certificateRequested() const = 0;
2542 
2548  virtual QList<CertificateInfoOrdered> issuerList() const = 0;
2549 
2555  virtual Validity peerCertificateValidity() const = 0;
2556 
2562  virtual CertificateChain peerCertificateChain() const = 0;
2563 
2569  virtual SessionInfo sessionInfo() const = 0;
2570 
2576  virtual QByteArray unprocessed() = 0;
2577 
2578 Q_SIGNALS:
2582  void resultsReady();
2583 
2588  void dtlsTimeout();
2589 };
2590 
2601 class QCA_EXPORT SASLContext : public Provider::Context
2602 {
2603  Q_OBJECT
2604 public:
2614  class HostPort
2615  {
2616  public:
2621 
2625  quint16 port;
2626  };
2627 
2631  enum Result
2632  {
2637  Continue
2638  };
2639 
2646  : Provider::Context(p, QStringLiteral("sasl"))
2647  {
2648  }
2649 
2653  virtual void reset() = 0;
2654 
2676  virtual void setup(const QString & service,
2677  const QString & host,
2678  const HostPort *local,
2679  const HostPort *remote,
2680  const QString & ext_id,
2681  int ext_ssf) = 0;
2682 
2693  virtual void setConstraints(SASL::AuthFlags f, int minSSF, int maxSSF) = 0;
2694 
2710  virtual void startClient(const QStringList &mechlist, bool allowClientSendFirst) = 0;
2711 
2727  virtual void startServer(const QString &realm, bool disableServerSendLast) = 0;
2728 
2742  virtual void serverFirstStep(const QString &mech, const QByteArray *clientInit) = 0;
2743 
2755  virtual void nextStep(const QByteArray &from_net) = 0;
2756 
2766  virtual void tryAgain() = 0;
2767 
2780  virtual void update(const QByteArray &from_net, const QByteArray &from_app) = 0;
2781 
2792  virtual bool waitForResultsReady(int msecs) = 0;
2793 
2797  virtual Result result() const = 0;
2798 
2802  virtual QStringList mechlist() const = 0;
2803 
2807  virtual QString mech() const = 0;
2808 
2812  virtual bool haveClientInit() const = 0;
2813 
2818  virtual QByteArray stepData() const = 0;
2819 
2824  virtual QByteArray to_net() = 0;
2825 
2830  virtual int encoded() const = 0;
2831 
2836  virtual QByteArray to_app() = 0;
2837 
2843  virtual int ssf() const = 0;
2844 
2851  virtual SASL::AuthCondition authCondition() const = 0;
2852 
2858  virtual SASL::Params clientParams() const = 0;
2859 
2868  virtual void
2869  setClientParams(const QString *user, const QString *authzid, const SecureArray *pass, const QString *realm) = 0;
2870 
2877  virtual QStringList realmlist() const = 0;
2878 
2884  virtual QString username() const = 0;
2885 
2891  virtual QString authzid() const = 0;
2892 
2893 Q_SIGNALS:
2898  void resultsReady();
2899 };
2900 
2912 class QCA_EXPORT MessageContext : public Provider::Context
2913 {
2914  Q_OBJECT
2915 public:
2920  {
2925  SignAndEncrypt
2926  };
2927 
2935  : Provider::Context(p, type)
2936  {
2937  }
2938 
2943  virtual bool canSignMultiple() const = 0;
2944 
2948  virtual SecureMessage::Type type() const = 0;
2949 
2953  virtual void reset() = 0;
2954 
2960  virtual void setupEncrypt(const SecureMessageKeyList &keys) = 0;
2961 
2970  virtual void
2971  setupSign(const SecureMessageKeyList &keys, SecureMessage::SignMode m, bool bundleSigner, bool smime) = 0;
2972 
2978  virtual void setupVerify(const QByteArray &detachedSig) = 0;
2979 
2993  virtual void start(SecureMessage::Format f, Operation op) = 0;
2994 
3000  virtual void update(const QByteArray &in) = 0;
3001 
3005  virtual QByteArray read() = 0;
3006 
3011  virtual int written() = 0;
3012 
3016  virtual void end() = 0;
3017 
3021  virtual bool finished() const = 0;
3022 
3032  virtual bool waitForFinished(int msecs) = 0;
3033 
3039  virtual bool success() const = 0;
3040 
3047  virtual SecureMessage::Error errorCode() const = 0;
3048 
3055  virtual QByteArray signature() const = 0;
3056 
3063  virtual QString hashName() const = 0;
3064 
3071  virtual SecureMessageSignatureList signers() const = 0;
3072 
3080  virtual QString diagnosticText() const;
3081 
3082 Q_SIGNALS:
3087  void updated();
3088 };
3089 
3101 class QCA_EXPORT SMSContext : public BasicContext
3102 {
3103  Q_OBJECT
3104 public:
3111  SMSContext(Provider *p, const QString &type)
3112  : BasicContext(p, type)
3113  {
3114  }
3115 
3126  virtual void setTrustedCertificates(const CertificateCollection &trusted);
3127 
3136  virtual void setUntrustedCertificates(const CertificateCollection &untrusted);
3137 
3146  virtual void setPrivateKeys(const QList<SecureMessageKey> &keys);
3147 
3152  virtual MessageContext *createMessage() = 0;
3153 };
3154 
3155 }
3156 #endif
3157 
3158 #endif
ConvertResult
Return value from a format conversion.
X.509 certificate request provider.
Definition: qcaprovider.h:1428
CertificateInfoOrdered issuer
The issuer information of the CRL.
Definition: qcaprovider.h:1274
bool isCompressed
True if the TLS connection is compressed, otherwise false.
Definition: qcaprovider.h:2258
X.509 certificate provider.
Definition: qcaprovider.h:1324
PKeyContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:917
PBEAlgorithm
Password-based encryption.
Version
Version of TLS or SSL.
Diffie-Hellman provider.
Definition: qcaprovider.h:829
MessageContext(Provider *p, const QString &type)
Standard constructor.
Definition: qcaprovider.h:2934
Message authentication code provider.
Definition: qcaprovider.h:297
QDateTime end
The time the certificate expires.
Definition: qcaprovider.h:1147
X.509 certificate or certificate request properties.
Definition: qcaprovider.h:1125
Parameter flags for the SASL authentication.
CSRContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:1437
Generic private key.
QString challenge
The SPKAC challenge value.
Definition: qcaprovider.h:1246
CertificateInfoOrdered subject
The subject information.
Definition: qcaprovider.h:1152
int cipherBits
The bit size of the cipher used for this connection.
Definition: qcaprovider.h:2275
CRLContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:1521
KeyStore provider.
Definition: qcaprovider.h:1973
CertificateInfoOrdered issuer
The issuer information.
Definition: qcaprovider.h:1159
int number
The CRL number, which increases at each update.
Definition: qcaprovider.h:1279
X.509 certificate revocation list provider.
Definition: qcaprovider.h:1512
OpenPGP key properties.
Definition: qcaprovider.h:1745
QDateTime thisUpdate
The time this CRL was created.
Definition: qcaprovider.h:1284
Type
The type of entry in the KeyStore.
Definition: qca_keystore.h:146
Certificate chain and private key pair.
Definition: qca_cert.h:2175
Provider plugin base class.
Definition: qcaprovider.h:82
Discrete logarithm provider.
Definition: qcaprovider.h:454
Header file for PGP key and X.509 certificate related classes.
SignatureAlgorithm sigalgo
The signature algorithm used by the issuer to sign the CRL.
Definition: qcaprovider.h:1304
Operation completed.
Definition: qcaprovider.h:2295
X.509 certificate revocation list properties.
Definition: qcaprovider.h:1268
SecureMessage provider.
Definition: qcaprovider.h:2912
ValidateFlags
The conditions to validate for a certificate.
Definition: qca_cert.h:516
DSAContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:765
Validity
The validity (or otherwise) of a certificate.
Definition: qca_cert.h:496
QStringList policies
The policies.
Definition: qcaprovider.h:1169
Header file for SecureLayer and its subclasses.
Algorithm provider.
Definition: qca_core.h:764
QByteArray issuerId
The issuer id.
Definition: qcaprovider.h:1309
bool inKeyring
True if this key is in a keyring (and thus usable), otherwise false.
Definition: qcaprovider.h:1785
RSAContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:675
QString addr
The IP address.
Definition: qcaprovider.h:2620
Hash provider.
Definition: qcaprovider.h:184
Encrypt operation.
Definition: qcaprovider.h:2921
Header file for PublicKey and PrivateKey related classes.
RandomContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:161
KeyStoreEntry provider.
Definition: qcaprovider.h:1865
Decrypt (or Decrypt and Verify) operation.
Definition: qcaprovider.h:2922
QStringList userIds
List of user id strings for the key, the first one being the primary user id.
Definition: qcaprovider.h:1757
CAContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:1611
TLS "session" provider.
Definition: qcaprovider.h:2214
PKCS12Context(Provider *p)
Standard constructor.
Definition: qcaprovider.h:1692
TLSSessionContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:2223
PKCS#12 provider.
Definition: qcaprovider.h:1683
DHContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:838
CertCollectionContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:1559
bool isCA
True if the certificate is a CA or the certificate request is requesting to be a CA, otherwise false.
Definition: qcaprovider.h:1203
Information about an active TLS connection.
Definition: qcaprovider.h:2252
QStringList crlLocations
A list of URIs for CRLs.
Definition: qcaprovider.h:1176
DSA provider.
Definition: qcaprovider.h:756
KeyLength anyKeyLength() const
Returns a KeyLength that supports any length.
Definition: qcaprovider.h:341
Type
The type of secure message.
QString keyId
The key id.
Definition: qcaprovider.h:1751
X.509 certificate collection provider.
Definition: qcaprovider.h:1550
SASL provider.
Definition: qcaprovider.h:2601
Certificate Revocation List
Definition: qca_cert.h:1739
Convenience class to hold an IP address and an associated port.
Definition: qcaprovider.h:2614
Error
Errors for secure messages.
QByteArray issuerId
The issuer id.
Definition: qcaprovider.h:1239
Container for keys for symmetric encryption algorithms.
Definition: qca_core.h:1263
Container for authentication tag.
Definition: qca_core.h:1346
QList< CRLEntry > revoked
The revoked entries.
Definition: qcaprovider.h:1294
Simple container for acceptable key lengths.
Definition: qca_core.h:700
CertContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:1333
Header file for core QCA infrastructure.
TLSSessionContext * id
Pointer to the id of this TLS session, for use with resuming.
Definition: qcaprovider.h:2287
Public key implementation provider base.
Definition: qcaprovider.h:522
Operation completed.
Definition: qcaprovider.h:2633
quint16 port
The port.
Definition: qcaprovider.h:2625
SignatureAlgorithm
Signature algorithm variants.
Definition: qca_publickey.h:73
A discrete logarithm group.
InfoContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:121
CertificateRequestFormat format
The format used for the certificate request.
Definition: qcaprovider.h:1253
Ordered certificate properties type.
Definition: qca_cert.h:547
DLGroupSet
Well known discrete logarithm group sets.
Client login can be inspected (server only)
Definition: qcaprovider.h:2636
Header file for classes that provide and manage keys.
CipherContext(Provider *p, const QString &type)
Standard constructor.
Definition: qcaprovider.h:240
Parameters are needed to complete authentication.
Definition: qcaprovider.h:2635
Container for initialisation vectors and nonces.
Definition: qca_core.h:1309
Format
Formats for secure messages.
TLSContext(Provider *p, const QString &type)
Standard constructor.
Definition: qcaprovider.h:2306
bool isTrusted
True if this key is trusted (e.g.
Definition: qcaprovider.h:1791
Direction
Direction settings for symmetric algorithms.
Definition: qca_core.h:140
QDateTime nextUpdate
The time this CRL expires, and the next CRL should be fetched.
Definition: qcaprovider.h:1289
Public key container provider.
Definition: qcaprovider.h:908
QCA - the Qt Cryptographic Architecture.
Definition: qca_basic.h:41
CertBase(Provider *p, const QString &type)
Standard constructor.
Definition: qcaprovider.h:1071
SASLContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:2645
int pathLimit
The path limit.
Definition: qcaprovider.h:1215
Base class to use for primitive provider contexts.
Definition: qca_core.h:1009
QString cipherSuite
The cipher suite being used for this connection.
Definition: qcaprovider.h:2270
KDFContext(Provider *p, const QString &type)
Standard constructor.
Definition: qcaprovider.h:371
HashContext(Provider *p, const QString &type)
Standard constructor.
Definition: qcaprovider.h:194
Header file for secure message (PGP, CMS) classes.
Type
The type of keystore.
Definition: qca_keystore.h:423
AuthFlags
Authentication requirement flag values.
Verify operation.
Definition: qcaprovider.h:2924
int cipherMaxBits
The maximum bit size possible of the cipher used for this connection.
Definition: qcaprovider.h:2281
bool isSelfSigned
True if the certificate is self-signed.
Definition: qcaprovider.h:1210
Header file for classes for cryptographic primitives (basic operations).
SignatureFormat
Signature formats (DSA only)
Definition: qca_publickey.h:92
SignatureAlgorithm sigalgo
The signature algorithm used to create the signature.
Definition: qcaprovider.h:1225
QDateTime start
The time the certificate becomes valid (often the time of create)
Definition: qcaprovider.h:1140
Type
Types of public key cryptography keys supported by QCA.
Secure array of bytes.
Definition: qca_tools.h:316
OpenPGP key provider.
Definition: qcaprovider.h:1804
MACContext(Provider *p, const QString &type)
Standard constructor.
Definition: qcaprovider.h:306
AuthCondition
Possible authentication error states.
KeyStoreListContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:1982
bool isSecret
True if this key is a secret key, otherwise false.
Definition: qcaprovider.h:1762
virtual ~QCAPlugin()
Destructs the object.
Definition: qcaprovider.h:88
CertificateRequestFormat
Certificate Request Format.
Definition: qca_cert.h:53
HKDF provider.
Definition: qcaprovider.h:415
Certificate options
Definition: qca_cert.h:609
TLS provider.
Definition: qcaprovider.h:2239
RSA provider.
Definition: qcaprovider.h:666
Key derivation function provider.
Definition: qcaprovider.h:361
EncryptionAlgorithm
Encryption algorithms.
Definition: qca_publickey.h:54
DLGroupContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:463
QByteArray sig
The signature data of the CRL.
Definition: qcaprovider.h:1299
A chain of related Certificates.
Definition: qca_cert.h:1225
Operation failed.
Definition: qcaprovider.h:2296
Operation
The type of operation being performed.
Definition: qcaprovider.h:2919
QDateTime expirationDate
The time the key expires.
Definition: qcaprovider.h:1772
QStringList issuerLocations
A list of URIs for issuer certificates.
Definition: qcaprovider.h:1183
Constraints constraints
The constraints.
Definition: qcaprovider.h:1164
QByteArray subjectId
The subject id.
Definition: qcaprovider.h:1232
Extended provider information.
Definition: qcaprovider.h:112
QStringList ocspLocations
A list of URIs for OCSP services.
Definition: qcaprovider.h:1190
QString fingerprint
The hex fingerprint of the key.
Definition: qcaprovider.h:1779
Public Key (X.509) certificate.
Definition: qca_cert.h:856
SMSContext(Provider *p, const QString &type)
Standard constructor.
Definition: qcaprovider.h:3111
SecureMessageSystem provider.
Definition: qcaprovider.h:3101
BigInteger serial
The certificate serial number.
Definition: qcaprovider.h:1197
int version
The X.509 certificate version, usually 3.
Definition: qcaprovider.h:1133
SignMode
The type of message signature.
Operation failed.
Definition: qcaprovider.h:2634
PGPKeyContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:1813
Internal context class used for the plugin.
QDateTime creationDate
The time the key was created.
Definition: qcaprovider.h:1767
KeyStoreEntryContext(Provider *p)
Standard constructor.
Definition: qcaprovider.h:1874
UsageMode
Specify the intended usage of a certificate.
Definition: qca_cert.h:482
Arbitrary precision integer.
Definition: qca_tools.h:570
X.509 certificate and certificate request provider base.
Definition: qcaprovider.h:1061
Cipher provider.
Definition: qcaprovider.h:227
TLS::Version version
The TLS protocol version being used for this connection.
Definition: qcaprovider.h:2263
Pretty Good Privacy key.
Definition: qca_cert.h:2406
Bundle of Certificates and CRLs.
Definition: qca_cert.h:1928
HKDFContext(Provider *p, const QString &type)
Standard constructor.
Definition: qcaprovider.h:425
Random provider.
Definition: qcaprovider.h:152
X.509 certificate authority provider.
Definition: qcaprovider.h:1602
Array of bytes that may be optionally secured.
Definition: qca_tools.h:90
QByteArray sig
The signature data.
Definition: qcaprovider.h:1220
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Nov 26 2020 23:02:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.