Changeset View
Changeset View
Standalone View
Standalone View
include/QtCrypto/qca_securemessage.h
Show All 34 Lines | |||||
35 | 35 | | |||
36 | #include <QObject> | 36 | #include <QObject> | ||
37 | #include "qca_core.h" | 37 | #include "qca_core.h" | ||
38 | #include "qca_publickey.h" | 38 | #include "qca_publickey.h" | ||
39 | #include "qca_cert.h" | 39 | #include "qca_cert.h" | ||
40 | 40 | | |||
41 | class QDateTime; | 41 | class QDateTime; | ||
42 | 42 | | |||
43 | namespace QCA { | 43 | namespace QCA | ||
44 | { | ||||
44 | 45 | | |||
45 | class SecureMessageSystem; | 46 | class SecureMessageSystem; | ||
46 | 47 | | |||
47 | /** | 48 | /** | ||
48 | \class SecureMessageKey qca_securemessage.h QtCrypto | 49 | \class SecureMessageKey qca_securemessage.h QtCrypto | ||
49 | 50 | | |||
50 | Key for SecureMessage system | 51 | Key for SecureMessage system | ||
51 | 52 | | |||
52 | \ingroup UserAPI | 53 | \ingroup UserAPI | ||
53 | */ | 54 | */ | ||
54 | class QCA_EXPORT SecureMessageKey | 55 | class QCA_EXPORT SecureMessageKey | ||
55 | { | 56 | { | ||
56 | public: | 57 | public: | ||
57 | /** | 58 | /** | ||
58 | The key type | 59 | The key type | ||
59 | */ | 60 | */ | ||
60 | enum Type | 61 | enum Type { | ||
61 | { | | |||
62 | None, ///< no key | 62 | None, ///< no key | ||
63 | PGP, ///< Pretty Good Privacy key | 63 | PGP, ///< Pretty Good Privacy key | ||
64 | X509 ///< X.509 CMS key | 64 | X509 ///< X.509 CMS key | ||
65 | }; | 65 | }; | ||
66 | 66 | | |||
67 | /** | 67 | /** | ||
68 | Construct an empty key | 68 | Construct an empty key | ||
69 | */ | 69 | */ | ||
70 | SecureMessageKey(); | 70 | SecureMessageKey(); | ||
71 | 71 | | |||
72 | /** | 72 | /** | ||
73 | Standard copy constructor | 73 | Standard copy constructor | ||
74 | 74 | | |||
75 | \param from the source key | 75 | \param from the source key | ||
76 | */ | 76 | */ | ||
77 | SecureMessageKey(const SecureMessageKey &from); | 77 | SecureMessageKey(const SecureMessageKey &from); | ||
78 | 78 | | |||
79 | ~SecureMessageKey(); | 79 | ~SecureMessageKey(); | ||
80 | 80 | | |||
81 | /** | 81 | /** | ||
82 | Standard assignment operator | 82 | Standard assignment operator | ||
83 | 83 | | |||
84 | \param from the source key | 84 | \param from the source key | ||
85 | */ | 85 | */ | ||
86 | SecureMessageKey & operator=(const SecureMessageKey &from); | 86 | SecureMessageKey &operator=(const SecureMessageKey &from); | ||
87 | 87 | | |||
88 | /** | 88 | /** | ||
89 | Returns true for null object | 89 | Returns true for null object | ||
90 | */ | 90 | */ | ||
91 | bool isNull() const; | 91 | bool isNull() const; | ||
92 | 92 | | |||
93 | /** | 93 | /** | ||
94 | The key type | 94 | The key type | ||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 177 | /** | |||
182 | \ingroup UserAPI | 182 | \ingroup UserAPI | ||
183 | */ | 183 | */ | ||
184 | class QCA_EXPORT SecureMessageSignature | 184 | class QCA_EXPORT SecureMessageSignature | ||
185 | { | 185 | { | ||
186 | public: | 186 | public: | ||
187 | /** | 187 | /** | ||
188 | The result of identity verification | 188 | The result of identity verification | ||
189 | */ | 189 | */ | ||
190 | enum IdentityResult | 190 | enum IdentityResult { | ||
191 | { | | |||
192 | Valid, ///< indentity is verified, matches signature | 191 | Valid, ///< indentity is verified, matches signature | ||
193 | InvalidSignature, ///< valid key provided, but signature failed | 192 | InvalidSignature, ///< valid key provided, but signature failed | ||
194 | InvalidKey, ///< invalid key provided | 193 | InvalidKey, ///< invalid key provided | ||
195 | NoKey ///< identity unknown | 194 | NoKey ///< identity unknown | ||
196 | }; | 195 | }; | ||
197 | 196 | | |||
198 | /** | 197 | /** | ||
199 | Create an empty signature check object. | 198 | Create an empty signature check object. | ||
Show All 25 Lines | |||||
225 | 224 | | |||
226 | ~SecureMessageSignature(); | 225 | ~SecureMessageSignature(); | ||
227 | 226 | | |||
228 | /** | 227 | /** | ||
229 | Standard assignment operator | 228 | Standard assignment operator | ||
230 | 229 | | |||
231 | \param from the source signature object | 230 | \param from the source signature object | ||
232 | */ | 231 | */ | ||
233 | SecureMessageSignature & operator=(const SecureMessageSignature &from); | 232 | SecureMessageSignature &operator=(const SecureMessageSignature &from); | ||
234 | 233 | | |||
235 | /** | 234 | /** | ||
236 | get the results of the identity check on this signature | 235 | get the results of the identity check on this signature | ||
237 | */ | 236 | */ | ||
238 | IdentityResult identityResult() const; | 237 | IdentityResult identityResult() const; | ||
239 | 238 | | |||
240 | /** | 239 | /** | ||
241 | get the results of the key validation check on this signature | 240 | get the results of the key validation check on this signature | ||
Show All 15 Lines | 254 | private: | |||
257 | QSharedDataPointer<Private> d; | 256 | QSharedDataPointer<Private> d; | ||
258 | }; | 257 | }; | ||
259 | 258 | | |||
260 | /** | 259 | /** | ||
261 | A list of signatures | 260 | A list of signatures | ||
262 | */ | 261 | */ | ||
263 | typedef QList<SecureMessageSignature> SecureMessageSignatureList; | 262 | typedef QList<SecureMessageSignature> SecureMessageSignatureList; | ||
264 | 263 | | |||
265 | | ||||
266 | /** | 264 | /** | ||
267 | \class SecureMessage qca_securemessage.h QtCrypto | 265 | \class SecureMessage qca_securemessage.h QtCrypto | ||
268 | 266 | | |||
269 | Class representing a secure message | 267 | Class representing a secure message | ||
270 | 268 | | |||
271 | SecureMessage presents a unified interface for working with both | 269 | SecureMessage presents a unified interface for working with both | ||
272 | OpenPGP and CMS (S/MIME) messages. Prepare the object by calling | 270 | OpenPGP and CMS (S/MIME) messages. Prepare the object by calling | ||
273 | setFormat(), setRecipient(), and setSigner() as necessary, and then | 271 | setFormat(), setRecipient(), and setSigner() as necessary, and then | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
319 | */ | 317 | */ | ||
320 | class QCA_EXPORT SecureMessage : public QObject, public Algorithm | 318 | class QCA_EXPORT SecureMessage : public QObject, public Algorithm | ||
321 | { | 319 | { | ||
322 | Q_OBJECT | 320 | Q_OBJECT | ||
323 | public: | 321 | public: | ||
324 | /** | 322 | /** | ||
325 | The type of secure message | 323 | The type of secure message | ||
326 | */ | 324 | */ | ||
327 | enum Type | 325 | enum Type { | ||
328 | { | | |||
329 | OpenPGP, ///< a Pretty Good Privacy message | 326 | OpenPGP, ///< a Pretty Good Privacy message | ||
330 | CMS ///< a Cryptographic Message Syntax message | 327 | CMS ///< a Cryptographic Message Syntax message | ||
331 | }; | 328 | }; | ||
332 | 329 | | |||
333 | /** | 330 | /** | ||
334 | The type of message signature | 331 | The type of message signature | ||
335 | */ | 332 | */ | ||
336 | enum SignMode | 333 | enum SignMode { | ||
337 | { | | |||
338 | Message, ///< the message includes the signature | 334 | Message, ///< the message includes the signature | ||
339 | Clearsign, ///< the message is clear signed | 335 | Clearsign, ///< the message is clear signed | ||
340 | Detached ///< the signature is detached | 336 | Detached ///< the signature is detached | ||
341 | }; | 337 | }; | ||
342 | 338 | | |||
343 | /** | 339 | /** | ||
344 | Formats for secure messages | 340 | Formats for secure messages | ||
345 | */ | 341 | */ | ||
346 | enum Format | 342 | enum Format { | ||
347 | { | | |||
348 | Binary, ///< DER/binary | 343 | Binary, ///< DER/binary | ||
349 | Ascii ///< PEM/ascii-armored | 344 | Ascii ///< PEM/ascii-armored | ||
350 | }; | 345 | }; | ||
351 | 346 | | |||
352 | /** | 347 | /** | ||
353 | Errors for secure messages | 348 | Errors for secure messages | ||
354 | */ | 349 | */ | ||
355 | enum Error | 350 | enum Error { | ||
356 | { | | |||
357 | ErrorPassphrase, ///< passphrase was either wrong or not provided | 351 | ErrorPassphrase, ///< passphrase was either wrong or not provided | ||
358 | ErrorFormat, ///< input format was bad | 352 | ErrorFormat, ///< input format was bad | ||
359 | ErrorSignerExpired, ///< signing key is expired | 353 | ErrorSignerExpired, ///< signing key is expired | ||
360 | ErrorSignerInvalid, ///< signing key is invalid in some way | 354 | ErrorSignerInvalid, ///< signing key is invalid in some way | ||
361 | ErrorEncryptExpired, ///< encrypting key is expired | 355 | ErrorEncryptExpired, ///< encrypting key is expired | ||
362 | ErrorEncryptUntrusted, ///< encrypting key is untrusted | 356 | ErrorEncryptUntrusted, ///< encrypting key is untrusted | ||
363 | ErrorEncryptInvalid, ///< encrypting key is invalid in some way | 357 | ErrorEncryptInvalid, ///< encrypting key is invalid in some way | ||
364 | ErrorNeedCard, ///< pgp card is missing | 358 | ErrorNeedCard, ///< pgp card is missing | ||
▲ Show 20 Lines • Show All 594 Lines • Show Last 20 Lines |