Changeset View
Changeset View
Standalone View
Standalone View
include/QtCrypto/qca_core.h
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 79 | /** | |||
---|---|---|---|---|---|
82 | This is equivalent to ::QCA_PATCH_VERSION, except it provides | 82 | This is equivalent to ::QCA_PATCH_VERSION, except it provides | ||
83 | a runtime check of the version of %QCA that is being used. | 83 | a runtime check of the version of %QCA that is being used. | ||
84 | */ | 84 | */ | ||
85 | QCA_EXPORT int qcaPatchVersion(); | 85 | QCA_EXPORT int qcaPatchVersion(); | ||
86 | 86 | | |||
87 | /** | 87 | /** | ||
88 | QCA - the Qt Cryptographic Architecture | 88 | QCA - the Qt Cryptographic Architecture | ||
89 | */ | 89 | */ | ||
90 | namespace QCA { | 90 | namespace QCA | ||
91 | { | ||||
91 | 92 | | |||
92 | class Provider; | 93 | class Provider; | ||
93 | class Random; | 94 | class Random; | ||
94 | class CertificateCollection; | 95 | class CertificateCollection; | ||
95 | class Global; | 96 | class Global; | ||
96 | class KeyStore; | 97 | class KeyStore; | ||
97 | class KeyStoreEntry; | 98 | class KeyStoreEntry; | ||
98 | class KeyStoreInfo; | 99 | class KeyStoreInfo; | ||
99 | class KeyStoreManager; | 100 | class KeyStoreManager; | ||
100 | class Logger; | 101 | class Logger; | ||
101 | 102 | | |||
102 | /** | 103 | /** | ||
103 | Convenience representation for the plugin providers | 104 | Convenience representation for the plugin providers | ||
104 | 105 | | |||
105 | You can get a list of providers using the providers() | 106 | You can get a list of providers using the providers() | ||
106 | function | 107 | function | ||
107 | 108 | | |||
108 | \sa ProviderListIterator | 109 | \sa ProviderListIterator | ||
109 | \sa providers() | 110 | \sa providers() | ||
110 | */ | 111 | */ | ||
111 | typedef QList<Provider*> ProviderList; | 112 | typedef QList<Provider *> ProviderList; | ||
112 | 113 | | |||
113 | /** | 114 | /** | ||
114 | Mode settings for memory allocation | 115 | Mode settings for memory allocation | ||
115 | 116 | | |||
116 | QCA can use secure memory, however most operating systems | 117 | QCA can use secure memory, however most operating systems | ||
117 | restrict the amount of memory that can be pinned by user | 118 | restrict the amount of memory that can be pinned by user | ||
118 | applications, to prevent a denial-of-service attack. | 119 | applications, to prevent a denial-of-service attack. | ||
119 | 120 | | |||
120 | QCA supports two approaches to getting memory - the mlock | 121 | QCA supports two approaches to getting memory - the mlock | ||
121 | method, which generally requires root (administrator) level | 122 | method, which generally requires root (administrator) level | ||
122 | privileges, and the mmap method which is not as secure, but | 123 | privileges, and the mmap method which is not as secure, but | ||
123 | which should be able to be used by any process. | 124 | which should be able to be used by any process. | ||
124 | 125 | | |||
125 | \sa Initializer | 126 | \sa Initializer | ||
126 | */ | 127 | */ | ||
127 | enum MemoryMode | 128 | enum MemoryMode { | ||
128 | { | | |||
129 | Practical, ///< mlock and drop root if available, else mmap | 129 | Practical, ///< mlock and drop root if available, else mmap | ||
130 | Locking, ///< mlock and drop root | 130 | Locking, ///< mlock and drop root | ||
131 | LockingKeepPrivileges ///< mlock, retaining root privileges | 131 | LockingKeepPrivileges ///< mlock, retaining root privileges | ||
132 | }; | 132 | }; | ||
133 | 133 | | |||
134 | /** | 134 | /** | ||
135 | Direction settings for symmetric algorithms | 135 | Direction settings for symmetric algorithms | ||
136 | 136 | | |||
137 | For some algorithms, it makes sense to have a "direction", such | 137 | For some algorithms, it makes sense to have a "direction", such | ||
138 | as Cipher algorithms which can be used to encrypt or decrypt. | 138 | as Cipher algorithms which can be used to encrypt or decrypt. | ||
139 | */ | 139 | */ | ||
140 | enum Direction | 140 | enum Direction { | ||
141 | { | | |||
142 | Encode, ///< Operate in the "forward" direction; for example, encrypting | 141 | Encode, ///< Operate in the "forward" direction; for example, encrypting | ||
143 | Decode ///< Operate in the "reverse" direction; for example, decrypting | 142 | Decode ///< Operate in the "reverse" direction; for example, decrypting | ||
144 | }; | 143 | }; | ||
145 | 144 | | |||
146 | /** | 145 | /** | ||
147 | Initialise %QCA. | 146 | Initialise %QCA. | ||
148 | This call is not normally required, because it is cleaner | 147 | This call is not normally required, because it is cleaner | ||
149 | to use an Initializer. | 148 | to use an Initializer. | ||
▲ Show 20 Lines • Show All 551 Lines • ▼ Show 20 Line(s) | 699 | /** | |||
701 | Construct a %KeyLength object | 700 | Construct a %KeyLength object | ||
702 | 701 | | |||
703 | \param min the minimum length of the key, in bytes | 702 | \param min the minimum length of the key, in bytes | ||
704 | \param max the maximum length of the key, in bytes | 703 | \param max the maximum length of the key, in bytes | ||
705 | \param multiple the number of bytes that the key must be a | 704 | \param multiple the number of bytes that the key must be a | ||
706 | multiple of. | 705 | multiple of. | ||
707 | */ | 706 | */ | ||
708 | KeyLength(int min, int max, int multiple) | 707 | KeyLength(int min, int max, int multiple) | ||
709 | : _min( min ), _max(max), _multiple( multiple ) | 708 | : _min(min), _max(max), _multiple(multiple) | ||
710 | { } | 709 | { } | ||
711 | 710 | | |||
712 | /** | 711 | /** | ||
713 | Obtain the minimum length for the key, in bytes | 712 | Obtain the minimum length for the key, in bytes | ||
714 | */ | 713 | */ | ||
715 | int minimum() const { return _min; } | 714 | int minimum() const | ||
715 | { | ||||
716 | return _min; | ||||
717 | } | ||||
716 | 718 | | |||
717 | /** | 719 | /** | ||
718 | Obtain the maximum length for the key, in bytes | 720 | Obtain the maximum length for the key, in bytes | ||
719 | */ | 721 | */ | ||
720 | int maximum() const { return _max; } | 722 | int maximum() const | ||
723 | { | ||||
724 | return _max; | ||||
725 | } | ||||
721 | 726 | | |||
722 | /** | 727 | /** | ||
723 | Return the number of bytes that the key must be a multiple of | 728 | Return the number of bytes that the key must be a multiple of | ||
724 | 729 | | |||
725 | If this is one, then anything between minimum and maximum (inclusive) | 730 | If this is one, then anything between minimum and maximum (inclusive) | ||
726 | is acceptable. | 731 | is acceptable. | ||
727 | */ | 732 | */ | ||
728 | int multiple() const { return _multiple; } | 733 | int multiple() const | ||
734 | { | ||||
735 | return _multiple; | ||||
736 | } | ||||
729 | 737 | | |||
730 | private: | 738 | private: | ||
731 | const int _min, _max, _multiple; | 739 | const int _min, _max, _multiple; | ||
732 | }; | 740 | }; | ||
733 | 741 | | |||
734 | /** | 742 | /** | ||
735 | \class Provider qca_core.h QtCrypto | 743 | \class Provider qca_core.h QtCrypto | ||
736 | 744 | | |||
▲ Show 20 Lines • Show All 229 Lines • ▼ Show 20 Line(s) | 973 | /** | |||
966 | Copy constructor | 974 | Copy constructor | ||
967 | 975 | | |||
968 | \param from the Context to copy from | 976 | \param from the Context to copy from | ||
969 | */ | 977 | */ | ||
970 | Context(const Context &from); | 978 | Context(const Context &from); | ||
971 | 979 | | |||
972 | private: | 980 | private: | ||
973 | // disable assignment | 981 | // disable assignment | ||
974 | Context & operator=(const Context &from); | 982 | Context &operator=(const Context &from); | ||
975 | 983 | | |||
976 | Provider *_provider; | 984 | Provider *_provider; | ||
977 | QString _type; | 985 | QString _type; | ||
978 | }; | 986 | }; | ||
979 | 987 | | |||
980 | /** | 988 | /** | ||
981 | \class BasicContext qca_core.h QtCrypto | 989 | \class BasicContext qca_core.h QtCrypto | ||
982 | 990 | | |||
Show All 28 Lines | 1018 | /** | |||
1011 | Copy constructor | 1019 | Copy constructor | ||
1012 | 1020 | | |||
1013 | \param from the Context to copy from | 1021 | \param from the Context to copy from | ||
1014 | */ | 1022 | */ | ||
1015 | BasicContext(const BasicContext &from); | 1023 | BasicContext(const BasicContext &from); | ||
1016 | 1024 | | |||
1017 | private: | 1025 | private: | ||
1018 | // disable assignment | 1026 | // disable assignment | ||
1019 | BasicContext & operator=(const BasicContext &from); | 1027 | BasicContext &operator=(const BasicContext &from); | ||
1020 | }; | 1028 | }; | ||
1021 | 1029 | | |||
1022 | /** | 1030 | /** | ||
1023 | \class BufferedComputation qca_core.h QtCrypto | 1031 | \class BufferedComputation qca_core.h QtCrypto | ||
1024 | 1032 | | |||
1025 | General superclass for buffered computation algorithms | 1033 | General superclass for buffered computation algorithms | ||
1026 | 1034 | | |||
1027 | A buffered computation is characterised by having the | 1035 | A buffered computation is characterised by having the | ||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Line(s) | 1158 | public: | |||
1157 | 1165 | | |||
1158 | virtual ~Algorithm(); | 1166 | virtual ~Algorithm(); | ||
1159 | 1167 | | |||
1160 | /** | 1168 | /** | ||
1161 | Assignment operator | 1169 | Assignment operator | ||
1162 | 1170 | | |||
1163 | \param from the Algorithm to copy state from | 1171 | \param from the Algorithm to copy state from | ||
1164 | */ | 1172 | */ | ||
1165 | Algorithm & operator=(const Algorithm &from); | 1173 | Algorithm &operator=(const Algorithm &from); | ||
1166 | 1174 | | |||
1167 | /** | 1175 | /** | ||
1168 | The name of the algorithm type. | 1176 | The name of the algorithm type. | ||
1169 | */ | 1177 | */ | ||
1170 | QString type() const; | 1178 | QString type() const; | ||
1171 | 1179 | | |||
1172 | /** | 1180 | /** | ||
1173 | The name of the provider | 1181 | The name of the provider | ||
▲ Show 20 Lines • Show All 201 Lines • ▼ Show 20 Line(s) | |||||
1375 | class QCA_EXPORT Event | 1383 | class QCA_EXPORT Event | ||
1376 | { | 1384 | { | ||
1377 | public: | 1385 | public: | ||
1378 | /** | 1386 | /** | ||
1379 | %Type of event | 1387 | %Type of event | ||
1380 | 1388 | | |||
1381 | \sa type() | 1389 | \sa type() | ||
1382 | */ | 1390 | */ | ||
1383 | enum Type | 1391 | enum Type { | ||
1384 | { | | |||
1385 | Password, ///< Asking for a password, PIN or passphrase. | 1392 | Password, ///< Asking for a password, PIN or passphrase. | ||
1386 | Token ///< Asking for a token | 1393 | Token ///< Asking for a token | ||
1387 | }; | 1394 | }; | ||
1388 | 1395 | | |||
1389 | /** | 1396 | /** | ||
1390 | %Source of the event | 1397 | %Source of the event | ||
1391 | 1398 | | |||
1392 | Events are associated with access to a KeyStore, or access to | 1399 | Events are associated with access to a KeyStore, or access to | ||
1393 | a file (or bytearray/stream or equivalent). This tells you the | 1400 | a file (or bytearray/stream or equivalent). This tells you the | ||
1394 | type of source that caused the Event. | 1401 | type of source that caused the Event. | ||
1395 | 1402 | | |||
1396 | \sa source() | 1403 | \sa source() | ||
1397 | \sa fileName() for the name, if source is Event::Data | 1404 | \sa fileName() for the name, if source is Event::Data | ||
1398 | \sa keyStoreInfo() and keyStoreEntry() for the keystore and entry, | 1405 | \sa keyStoreInfo() and keyStoreEntry() for the keystore and entry, | ||
1399 | if the source is Event::KeyStore | 1406 | if the source is Event::KeyStore | ||
1400 | */ | 1407 | */ | ||
1401 | enum Source | 1408 | enum Source { | ||
1402 | { | | |||
1403 | KeyStore, ///< KeyStore generated the event | 1409 | KeyStore, ///< KeyStore generated the event | ||
1404 | Data ///< File or bytearray generated the event | 1410 | Data ///< File or bytearray generated the event | ||
1405 | }; | 1411 | }; | ||
1406 | 1412 | | |||
1407 | /** | 1413 | /** | ||
1408 | password variation | 1414 | password variation | ||
1409 | 1415 | | |||
1410 | If the Type of Event is Password, PasswordStyle tells you whether | 1416 | If the Type of Event is Password, PasswordStyle tells you whether | ||
1411 | it is a PIN, passphrase or password. | 1417 | it is a PIN, passphrase or password. | ||
1412 | 1418 | | |||
1413 | \sa passwordStyle() | 1419 | \sa passwordStyle() | ||
1414 | */ | 1420 | */ | ||
1415 | enum PasswordStyle | 1421 | enum PasswordStyle { | ||
1416 | { | | |||
1417 | StylePassword, ///< User should be prompted for a "Password" | 1422 | StylePassword, ///< User should be prompted for a "Password" | ||
1418 | StylePassphrase, ///< User should be prompted for a "Passphrase" | 1423 | StylePassphrase, ///< User should be prompted for a "Passphrase" | ||
1419 | StylePIN ///< User should be prompted for a "PIN" | 1424 | StylePIN ///< User should be prompted for a "PIN" | ||
1420 | }; | 1425 | }; | ||
1421 | 1426 | | |||
1422 | /** | 1427 | /** | ||
1423 | Constructor | 1428 | Constructor | ||
1424 | */ | 1429 | */ | ||
Show All 11 Lines | |||||
1436 | */ | 1441 | */ | ||
1437 | ~Event(); | 1442 | ~Event(); | ||
1438 | 1443 | | |||
1439 | /** | 1444 | /** | ||
1440 | Assignment operator | 1445 | Assignment operator | ||
1441 | 1446 | | |||
1442 | \param from the Event to copy from | 1447 | \param from the Event to copy from | ||
1443 | */ | 1448 | */ | ||
1444 | Event & operator=(const Event &from); | 1449 | Event &operator=(const Event &from); | ||
1445 | 1450 | | |||
1446 | /** | 1451 | /** | ||
1447 | test if this event has been setup correctly | 1452 | test if this event has been setup correctly | ||
1448 | */ | 1453 | */ | ||
1449 | bool isNull() const; | 1454 | bool isNull() const; | ||
1450 | 1455 | | |||
1451 | /** | 1456 | /** | ||
1452 | the Type of this event | 1457 | the Type of this event | ||
▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines |