This file is indexed.

/usr/include/QtCrypto/qca_securemessage.h is in libqca2-dev 2.0.3-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
/*
 * qca_securemessage.h - Qt Cryptographic Architecture
 * Copyright (C) 2003-2007  Justin Karneges <justin@affinix.com>
 * Copyright (C) 2004,2005  Brad Hards <bradh@frogmouth.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 *
 */

/**
   \file qca_securemessage.h

   Header file for secure message (PGP, CMS) classes

   \note You should not use this header directly from an
   application. You should just use <tt> \#include \<QtCrypto>
   </tt> instead.
*/

#ifndef QCA_SECUREMESSAGE_H
#define QCA_SECUREMESSAGE_H

#include <QObject>
#include "qca_core.h"
#include "qca_publickey.h"
#include "qca_cert.h"

class QDateTime;

namespace QCA {

class SecureMessageSystem;

/**
   \class SecureMessageKey qca_securemessage.h QtCrypto

   Key for SecureMessage system

   \ingroup UserAPI
*/
class QCA_EXPORT SecureMessageKey
{
public:
	/**
	   The key type
	*/
	enum Type
	{
		None, ///< no key
		PGP,  ///< Pretty Good Privacy key
		X509  ///< X.509 CMS key
	};

	/**
	   Construct an empty key
	*/
	SecureMessageKey();

	/**
	   Standard copy constructor

	   \param from the source key
	*/
	SecureMessageKey(const SecureMessageKey &from);

	~SecureMessageKey();

	/**
	   Standard assignment operator

	   \param from the source key
	*/
	SecureMessageKey & operator=(const SecureMessageKey &from);

	/**
	   Returns true for null object
	*/
	bool isNull() const;

	/**
	   The key type
	*/
	Type type() const;

	/**
	   Public key part of a PGP key
	*/
	PGPKey pgpPublicKey() const;

	/**
	   Private key part of a PGP key
	*/
	PGPKey pgpSecretKey() const;

	/**
	   Set the public key part of a PGP key

	   \param pub the PGP public key
	*/
	void setPGPPublicKey(const PGPKey &pub);

	/**
	   Set the private key part of a PGP key

	   \param sec the PGP secretkey
	*/
	void setPGPSecretKey(const PGPKey &sec);

	/**
	   The X.509 certificate chain (public part) for this key
	*/
	CertificateChain x509CertificateChain() const;

	/**
	   The X.509 private key part of this key
	*/
	PrivateKey x509PrivateKey() const;

	/**
	   Set the public key part of this X.509 key.

	   \param c the Certificate chain containing the public keys
	*/
	void setX509CertificateChain(const CertificateChain &c);

	/**
	   Set the private key part of this X.509 key.

	   \param k the private key
	*/
	void setX509PrivateKey(const PrivateKey &k);

	/**
	   Set the public and private part of this X.509 key with KeyBundle.

	   \param kb the public and private key bundle
	*/
	void setX509KeyBundle(const KeyBundle &kb);

	/**
	   Test if this key contains a private key part
	*/
	bool havePrivate() const;

	/**
	   The name associated with this key

	   For a PGP key, this is the primary user ID

	   For an X.509 key, this is the Common Name
	*/
	QString name() const;

private:
	class Private;
	QSharedDataPointer<Private> d;
};

/**
   A list of message keys
*/
typedef QList<SecureMessageKey> SecureMessageKeyList;

/**
   \class SecureMessageSignature qca_securemessage.h QtCrypto

   SecureMessage signature

   \ingroup UserAPI
*/
class QCA_EXPORT SecureMessageSignature
{
public:
	/**
	   The result of identity verification
	*/
	enum IdentityResult
	{
		Valid,            ///< indentity is verified, matches signature
		InvalidSignature, ///< valid key provided, but signature failed
		InvalidKey,       ///< invalid key provided
		NoKey             ///< identity unknown
	};

	/**
	   Create an empty signature check object.

	   User applications don't normally need to create signature checks. You normally
	   get the object back as a result of a SecureMessage operation.
	*/
	SecureMessageSignature();

	/**
	   Create a signature check object

	   User applications don't normally need to create signature checks. You normally
	   get the object back as a result of a SecureMessage operation.

	   \param r the result of the check
	   \param v the Validity of the key validation check
	   \param key the key associated with the signature
	   \param ts the timestamp associated with the signature
	*/
	SecureMessageSignature(IdentityResult r, Validity v, const SecureMessageKey &key, const QDateTime &ts);

	/**
	   Standard copy constructor

	   \param from the source signature object
	*/
	SecureMessageSignature(const SecureMessageSignature &from);

	~SecureMessageSignature();

	/**
	   Standard assignment operator

	   \param from the source signature object
	*/
	SecureMessageSignature & operator=(const SecureMessageSignature &from);

	/**
	   get the results of the identity check on this signature
	*/
	IdentityResult identityResult() const;

	/**
	   get the results of the key validation check on this signature
	*/
	Validity keyValidity() const;

	/**
	   get the key associated with this signature
	*/
	SecureMessageKey key() const;

	/**
	   get the timestamp associated with this signature
	*/
	QDateTime timestamp() const;

private:
	class Private;
	QSharedDataPointer<Private> d;
};

/**
   A list of signatures
*/
typedef QList<SecureMessageSignature> SecureMessageSignatureList;


/**
   \class SecureMessage qca_securemessage.h QtCrypto

   Class representing a secure message

   SecureMessage presents a unified interface for working with both
   OpenPGP and CMS (S/MIME) messages.  Prepare the object by calling
   setFormat(), setRecipient(), and setSigner() as necessary, and then
   begin the operation by calling an appropriate 'start' function, such
   as startSign().

   Here is an example of how to perform a Clearsign operation using PGP:

   \code
// first make the SecureMessageKey
PGPKey myPGPKey = getSecretKeyFromSomewhere();
SecureMessageKey key;
key.setPGPSecretKey(myPGPKey);

// our data to sign
QByteArray plain = "Hello, world";

// let's do it
OpenPGP pgp;
SecureMessage msg(&pgp);
msg.setSigner(key);
msg.startSign(SecureMessage::Clearsign);
msg.update(plain);
msg.end();
msg.waitForFinished(-1);

if(msg.success())
{
	QByteArray result = msg.read();
	// result now contains the clearsign text data
}
else
{
	// error
	...
}
   \endcode

   Performing a CMS sign operation is similar.  Simply set up the
   SecureMessageKey with a Certificate instead of a PGPKey, and operate on a
   CMS object instead of an OpenPGP object.

   \sa SecureMessageKey
   \sa SecureMessageSignature
   \sa OpenPGP
   \sa CMS

   \ingroup UserAPI
*/
class QCA_EXPORT SecureMessage : public QObject, public Algorithm
{
	Q_OBJECT
public:
	/**
	   The type of secure message
	*/
	enum Type
	{
		OpenPGP, ///< a Pretty Good Privacy message
		CMS      ///< a Cryptographic Message Syntax message
	};

	/**
	   The type of message signature
	*/
	enum SignMode
	{
		Message,    ///< the message includes the signature
		Clearsign,  ///< the message is clear signed
		Detached    ///< the signature is detached
	};

	/**
	   Formats for secure messages
	*/
	enum Format
	{
		Binary, ///< DER/binary
		Ascii   ///< PEM/ascii-armored
	};

	/**
	   Errors for secure messages
	*/
	enum Error
	{
		ErrorPassphrase,       ///< passphrase was either wrong or not provided
		ErrorFormat,           ///< input format was bad
		ErrorSignerExpired,    ///< signing key is expired
		ErrorSignerInvalid,    ///< signing key is invalid in some way
		ErrorEncryptExpired,   ///< encrypting key is expired
		ErrorEncryptUntrusted, ///< encrypting key is untrusted
		ErrorEncryptInvalid,   ///< encrypting key is invalid in some way
		ErrorNeedCard,         ///< pgp card is missing
		ErrorCertKeyMismatch,  ///< certificate and private key don't match
		ErrorUnknown           ///< other error
	};

	/**
	   Create a new secure message

	   This constructor uses an existing
	   SecureMessageSystem object (for example, an OpenPGP
	   or CMS object) to generate a specific kind of
	   secure message.

	   \param system a pre-existing and configured SecureMessageSystem
	   object
	*/
	SecureMessage(SecureMessageSystem *system);
	~SecureMessage();

	/**
	   The Type of secure message
	*/
	Type type() const;

	/**
	   Test if the message type supports multiple
	   (parallel) signatures.

	   \return true if the secure message support multiple
	   parallel signatures

	   \note PGP cannot do this - it is primarily a CMS
	   feature
	*/
	bool canSignMultiple() const;

	/**
	   True if the SecureMessageSystem can clearsign
	   messages.

	   \note CMS cannot clearsign - this is normally only
	   available for PGP
	*/
	bool canClearsign() const;

	/**
	   True if the SecureMessageSystem can both sign and
	   encrypt (in the same operation).

	   \note CMS cannot do an integrated sign/encrypt -
	   this is normally only available for PGP. You can do
	   separate signing and encrypting operations on the
	   same message with CMS though.
	*/
	bool canSignAndEncrypt() const;

	/**
	   Reset the object state to that of original construction.
	   Now a new operation can be performed immediately.
	*/
	void reset();

	/**
	   Returns true if bundling of the signer certificate chain is
	   enabled
	*/
	bool bundleSignerEnabled() const;

	/**
	   Returns true if inclusion of S/MIME attributes is enabled
	*/
	bool smimeAttributesEnabled() const;

	/**
	   Return the format type set for this message
	*/
	Format format() const;

	/**
	   Return the recipient(s) set for this message with setRecipient() or
	   setRecipients()
	*/
	SecureMessageKeyList recipientKeys() const;

	/**
	   Return the signer(s) set for this message with setSigner() or
	   setSigners()
	*/
	SecureMessageKeyList signerKeys() const;

	/**
	   For CMS only, this will bundle the signer certificate chain
	   into the message.  This allows a message to be verified
	   on its own, without the need to have obtained the signer's
	   certificate in advance.  Email clients using S/MIME often
	   bundle the signer, greatly simplifying key management.

	   This behavior is enabled by default.

	   \param b whether to bundle (if true) or not (false)
	*/
	void setBundleSignerEnabled(bool b);

	/**
	   For CMS only, this will put extra attributes into the
	   message related to S/MIME, such as the preferred
	   type of algorithm to use in replies.  The attributes
	   used are decided by the provider.

	   This behavior is enabled by default.

	   \param b whether to embed extra attribues (if true) or not (false)
	*/
	void setSMIMEAttributesEnabled(bool b);

	/**
	   Set the Format used for messages

	   The default is Binary.

	   \param f whether to use Binary or Ascii
	*/
	void setFormat(Format f);

	/**
	   Set the recipient for an encrypted message

	   \param key the recipient's key

	   \sa setRecipients
	*/
	void setRecipient(const SecureMessageKey &key);

	/**
	   Set the list of recipients for an encrypted message.

	   For a list with one item, this has the same effect as setRecipient.

	   \param keys the recipients' key

	   \sa setRecipient
	*/
	void setRecipients(const SecureMessageKeyList &keys);

	/**
	   Set the signer for a signed message.

	   This is used for both creating signed messages as well as for
	   verifying CMS messages that have no signer bundled.

	   \param key the key associated with the signer

	   \sa setSigners
	*/
	void setSigner(const SecureMessageKey &key);

	/**
	   Set the list of signers for a signed message.

	   This is used for both creating signed messages as well as for
	   verifying CMS messages that have no signer bundled.

	   For a list with one item, this has the same effect as setSigner.

	   \param keys the key associated with the signer

	   \sa setSigner
	*/
	void setSigners(const SecureMessageKeyList &keys);

	/**
	   Start an encryption operation

	   You will normally use this with some code along
	   these lines:
	   \code
encryptingObj.startEncrypt();
encryptingObj.update(message);
// perhaps some more update()s
encryptingObj.end();
	   \endcode

	   Each update() may (or may not) result in some
	   encrypted data, as indicated by the readyRead()
	   signal being emitted. Alternatively, you can wait
	   until the whole message is available (using either
	   waitForFinished(), or use the finished()
	   signal. The encrypted message can then be read
	   using the read() method.
	*/
	void startEncrypt();

	/**
	   Start an decryption operation

	   You will normally use this with some code along
	   these lines:
	   \code
decryptingObj.startEncrypt();
decryptingObj.update(message);
// perhaps some more update()s
decryptingObj.end();
	   \endcode

	   Each update() may (or may not) result in some
	   decrypted data, as indicated by the readyRead()
	   signal being emitted. Alternatively, you can wait
	   until the whole message is available (using either
	   waitForFinished(), or the finished()
	   signal). The decrypted message can then be read
	   using the read() method.

	   \note If decrypted result is also signed (not for
	   CMS), then the signature will be verified during
	   this operation.
	*/
	void startDecrypt();

	/**
	   Start a signing operation

	   You will normally use this with some code along
	   these lines:
	   \code
signingObj.startSign(QCA::SecureMessage::Detached)
signingObj.update(message);
// perhaps some more update()s
signingObj.end();
	   \endcode

	   For Detached signatures, you won't get any results
	   until the whole process is done - you either
	   waitForFinished(), or use the finished() signal, to
	   figure out when you can get the signature (using
	   the signature() method, not using read()). For
	   other formats, you can use the readyRead() signal
	   to determine when there may be part of a signed
	   message to read().

	   \param m the mode that will be used to generate the
	   signature
	*/
	void startSign(SignMode m = Message);

	/**
	   Start a verification operation

	   \param detachedSig the detached signature to
	   verify. Do not pass a signature for other signature
	   types.
	*/
	void startVerify(const QByteArray &detachedSig = QByteArray());

	/**
	   Start a combined signing and encrypting
	   operation. You use this in the same way as
	   startEncrypt().

	   \note This may not be possible (e.g. CMS
	   cannot do this) - see canSignAndEncrypt() for a
	   suitable test.
	*/
	void startSignAndEncrypt();

	/**
	   Process a message (or the next part of a message)
	   in the current operation. You need to have already
	   set up the message (startEncrypt(), startDecrypt(),
	   startSign(), startSignAndEncrypt() and
	   startVerify()) before calling this method.

	   \param in the data to process
	*/
	void update(const QByteArray &in);

	/**
	   Read the available data.

	   \note For detached signatures, you don't get
	   anything back using this method. Use signature() to
	   get the detached signature().
	*/
	QByteArray read();

	/**
	   The number of bytes available to be read.
	*/
	int bytesAvailable() const;

	/**
	   Complete an operation.

	   You need to call this method after you have
	   processed the message (which you pass in as the
	   argument to update().

	   \note the results of the operation are not
	   available as soon as this method returns. You need
	   to wait for the finished() signal, or use
	   waitForFinished().
	*/
	void end();

	/**
	   Block until the operation (encryption, decryption,
	   signing or verifying) completes.

	   \param msecs the number of milliseconds to wait for
	   the operation to complete. Pass -1 to wait
	   indefinitely.

	   \note You should not use this in GUI
	   applications where the blocking behaviour looks
	   like a hung application. Instead, connect the
	   finished() signal to a slot that handles the
	   results.

	   \note This synchronous operation may require event handling, and so
	   it must not be called from the same thread as an EventHandler.
	*/
	bool waitForFinished(int msecs = 30000);

	/**
	   Indicates whether or not the operation was successful
	   or failed.  If this function returns false, then
	   the reason for failure can be obtained with errorCode().

	   \sa errorCode
	   \sa diagnosticText
	*/
	bool success() const;

	/**
	   Returns the failure code.

	   \sa success
	   \sa diagnosticText
	*/
	Error errorCode() const;

	/**
	   The signature for the message. This is only used
	   for Detached signatures. For other message types,
	   you get the message and signature together using
	   read().
	*/
	QByteArray signature() const;

	/**
	   The name of the hash used for the signature process
	*/
	QString hashName() const;

	/**
	   Test if the message was signed.

	   This is true for OpenPGP if the decrypted message
	   was also signed.

	   \return true if the message was signed.
	*/
	bool wasSigned() const;

	/**
	   Verify that the message signature is correct.

	   \return true if the signature is valid for the
	   message, otherwise return false
	*/
	bool verifySuccess() const;

	/**
	   Information on the signer for the message
	*/
	SecureMessageSignature signer() const;

	/**
	   Information on the signers for the message. 

	   This is only meaningful if the message type supports
	   multiple signatures (see canSignMultiple() for a
	   suitable test).
	*/
	SecureMessageSignatureList signers() const;

	/**
	   Returns a log of technical information about the operation,
	   which may be useful for presenting to the user in an
	   advanced error dialog.
	*/
	QString diagnosticText() const;

Q_SIGNALS:
	/**
	   This signal is emitted when there is some data to
	   read. Typically you connect this signal to a slot
	   that does a read() of the available data.

	   \note This signal does not mean that the processing
	   of a message is necessarily complete - see
	   finished().
	*/
	void readyRead();

	/**
	   This signal is emitted when data has been accepted
	   by the message processor.

	   \param bytes the number of bytes written
	*/
	void bytesWritten(int bytes);

	/**
	   This signal is emitted when the message is fully
	   processed.
	*/
	void finished();

private:
	Q_DISABLE_COPY(SecureMessage)

	class Private;
	friend class Private;
	Private *d;
};

/**
   \class SecureMessageSystem qca_securemessage.h QtCrypto

   Abstract superclass for secure messaging systems

   \sa SecureMessage
   \sa SecureMessageKey

   \ingroup UserAPI
*/
class QCA_EXPORT SecureMessageSystem : public QObject, public Algorithm
{
	Q_OBJECT
public:
	~SecureMessageSystem();

protected:
	/**
	   Protected constructor for SecureMessageSystem
	   classes. You are meant to be using a subclass (such
	   as OpenPGP or CMS) - you only need to worry about
	   this class if you are creating a whole new
	   SecureMessageSystem type.

	   \param parent the parent object for this object
	   \param type the name of the Type of
	   SecureMessageSystem to create
	   \param provider the provider to use, if a specific
	   provider is required.
	*/
	SecureMessageSystem(QObject *parent, const QString &type, const QString &provider);

private:
	Q_DISABLE_COPY(SecureMessageSystem)
};

/**
   \class OpenPGP qca_securemessage.h QtCrypto

   Pretty Good Privacy messaging system

   \sa SecureMessage
   \sa SecureMessageKey

   \ingroup UserAPI

*/
class QCA_EXPORT OpenPGP : public SecureMessageSystem
{
	Q_OBJECT
public:
	/**
	   Standard constructor

	   \param parent the parent object for this object
	   \param provider the provider to use, if a specific
	   provider is required
	*/
	explicit OpenPGP(QObject *parent = 0, const QString &provider = QString());
	~OpenPGP();

private:
	Q_DISABLE_COPY(OpenPGP)

	class Private;
	Private *d;
};

/**
   \class CMS qca_securemessage.h QtCrypto

   Cryptographic Message Syntax messaging system

   Cryptographic Message Syntax (%CMS) "is used to digitally
   sign, digest, authenticate, or encrypt arbitrary message
   content.  The %CMS describes an encapsulation syntax for
   data protection.  It supports digital signatures and
   encryption.  The syntax allows multiple encapsulations; one
   encapsulation envelope can be nested inside another.
   Likewise, one party can digitally sign some previously
   encapsulated data.  It also allows arbitrary attributes,
   such as signing time, to be signed along with the message
   content, and provides for other attributes such as
   countersignatures to be associated with a signature." (from
   <a href="http://www.ietf.org/rfc/rfc3852.txt">RFC3852</a>
   "Cryptographic Message Syntax")

   \sa SecureMessage
   \sa SecureMessageKey

   \ingroup UserAPI

*/
class QCA_EXPORT CMS : public SecureMessageSystem
{
	Q_OBJECT
public:
	/**
	   Standard constructor

	   \param parent the parent object for this object
	   \param provider the provider to use, if a specific
	   provider is required
	*/
	explicit CMS(QObject *parent = 0, const QString &provider = QString());
	~CMS();

	/**
	   Return the trusted certificates set for this object
	*/
	CertificateCollection trustedCertificates() const;

	/**
	   Return the untrusted certificates set for this object
	*/
	CertificateCollection untrustedCertificates() const;

	/**
	   Return the private keys set for this object
	*/
	SecureMessageKeyList privateKeys() const;

	/**
	   Set the trusted certificates to use for the
	   messages built using this CMS object.

	   \param trusted the collection of trusted
	   certificates to use
	*/
	void setTrustedCertificates(const CertificateCollection &trusted);

	/**
	   Set the untrusted certificates to use for the
	   messages built using this CMS object.

	   This function is useful when verifying messages that don't
	   contain the certificates (or intermediate signers) within
	   the CMS blob.  In order to verify such messages, you'll
	   have to pass the possible signer certs with this function.

	   \param untrusted the collection of untrusted
	   certificates to use
	*/
	void setUntrustedCertificates(const CertificateCollection &untrusted);

	/**
	   Set the private keys to use for the messages built
	   using this CMS object.

	   Keys are required for decrypting and signing (not
	   for encrypting or verifying).

	   \param keys the collection of keys to use
	*/
	void setPrivateKeys(const SecureMessageKeyList &keys);

private:
	Q_DISABLE_COPY(CMS)

	class Private;
	Private *d;
};

}

#endif