SignedData.h

Go to the documentation of this file.
00001 
00009 #ifndef __SIGNEDDATA_H__
00010 #define __SIGNEDDATA_H__
00011 
00012 #include "PKIFCMSDLL.h"
00013 #include "components.h"
00014 #include "PKIFMediators.h"
00015 #include "PKIFCMSUtils.h"
00016 #include "ContentType.h"
00017 
00018 //FD_LIST_PTR(CPKIFAttribute);
00019 //FD_LIST_PTR(CPKIFCertificate);
00020 //FD_LIST_PTR(CPKIFSignerInfo);
00021 //FD_SMART_PTR(CPKIFBuffer);
00022 //FD_SMART_PTR(CPKIFCertificatePath);
00023 //FD_SMART_PTR(CPKIFOID);
00024 //FD_SMART_PTR(CPKIFPathSettings);
00025 FD_LIST_PTR(CPKIFCRL);
00026 FD_SMART_PTR(CPKIFEncapsulatedContentInfo);
00027 FD_SMART_PTR(CPKIFPathValidationResults);
00028 FD_SMART_PTR(CPKIFFuncStorage);
00029 
00030 struct HashInfo;
00031 class IPKIFCryptoMisc;
00032 
00033 
00059 class PKIFCMS_API CPKIFSignedData : public CPKIFContentType
00060 { 
00061     friend struct CPKIFSignedDataImpl;
00062 public:
00063     //this enum matches the contents of the underlying 
00064     //objective enum and must continue to do so
00065     typedef enum {
00066         CMSv0 = 0,
00067         CMSv1 = 1,
00068         CMSv2 = 2,
00069         CMSv3 = 3,
00070         CMSv4 = 4
00071     } CMSVersion;
00072 
00073     //*****************************************************************************
00074     //  constructors and destructors
00075     //*****************************************************************************
00076     CPKIFSignedData(void);
00077     virtual ~CPKIFSignedData(void);
00078 
00079     //*****************************************************************************
00080     //  field manipulation functions
00081     //  SignedData ::= SEQUENCE 
00082     //  {
00083     //      version CMSVersion,
00084     //      digestAlgorithms DigestAlgorithmIdentifiers,
00085     //      encapContentInfo EncapsulatedContentInfo,
00086     //      certificates [0] IMPLICIT CertificateSet OPTIONAL,
00087     //      crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
00088     //      signerInfos SignerInfos 
00089     //  }
00090     //*****************************************************************************
00091     //version (required) - automatically set based on message contents
00092     //                      (see private CalculateAndSetVersion function)
00093     CMSVersion GetVersion() const;
00094 
00095     //digest algorithms are determined automatically based on SignerInfos (required)
00096 
00097     //encapsulated content info (required)
00098     void SetEncapsulatedContent(CPKIFEncapsulatedContentInfoPtr& ecip);
00099     CPKIFEncapsulatedContentInfoPtr GetEncapsulatedContent() const;
00100 
00101     void UpdateMessage(unsigned char* buf, int bufLen); //used to set-up detached messages
00102 
00103     //certificates (optional)
00104     void AddCertificate(CPKIFCertificatePtr& cert);     //add a single certificate to cert bag
00105     void GetCertificates(CPKIFCertificateList& certs);  //get list of associated certs
00106     
00107     //crls (optional)
00108     void AddCRL(CPKIFCRLPtr& crl);                      //add a single CRL to CRL bag
00109     void GetCRLs(CPKIFCRLList& crls);                   //get list of associated CRLs
00110     
00111     //SignerInfos (required) -> Note, AddSignerInfo cannot be called after calling UpdateMessage
00112     void AddSignerInfo(CPKIFSignerInfoPtr& si);         //add a single SignerInfo
00113     void GetSignerInfos(CPKIFSignerInfoList& sis);          //get collection of SignerInfos
00114 
00115     //*****************************************************************************
00116     //  encode and decode functions
00117     //*****************************************************************************
00118     CPKIFBufferPtr Encode();                //encodes the message (including signature generation as necessary)
00119     void Decode(CPKIFBufferPtr& buf);   //decodes the message (does not perform verification)
00120 
00121     //*****************************************************************************
00122     //  message verification (and related) functions
00123     //*****************************************************************************
00124     bool Verify(int signerIndex, CMSVerificationStatus& status, CMSPathValidationStatus minStatus = PVS_REV_STATUS_VERIFIED);
00125     bool Verify(int signerIndex, CMSVerificationStatus& status, CPKIFCertificatePtr& signersCert, CMSPathValidationStatus minStatus = PVS_REV_STATUS_VERIFIED);
00126     void SetKeyUsageChecker(CPKIFFuncStoragePtr& kuChecker);
00127     void SetPathSettings(CPKIFPathSettingsPtr& settings);
00128     CPKIFCertificatePathPtr GetPath() const;
00129     CPKIFPathValidationResultsPtr GetValidationResults() const;
00130     void GetSignersCert(int signerIndex, CPKIFCertificatePtr& cert);
00131     size_t GetNumberOfSigners() const;
00132 
00133     CPKIFSignerInfoPtr GetSignersInfo(int signerIndex);
00134 
00135     //use ClearContent to re-use an object
00136     void ClearContent(bool removeMediatorAssociations = true);
00137 
00138     //made this private to support countersignature verification (it really shouldn't be) 10/22/2003
00139     CPKIFBufferPtr GetSignersCert(CPKIFBufferPtr tmpSignerInfoBuf);
00140 
00141     void AddMediator(IPKIFMediatorPtr& m);
00142     IPKIFMediatorPtr GetMediator();
00143 
00144 private:
00146     CPKIFSignedData(const CPKIFSignedData& copy);
00148     CPKIFSignedData& operator=(const CPKIFSignedData& rhs); //added 4/6/2004
00149 
00150     enum {thisComponent=TOOLKIT_MESSAGE_SIGNED_DATA};
00151 
00152     struct CPKIFSignedDataImpl *m_impl;
00153 
00154 };
00155 DECLARE_SMART_POINTERS(CPKIFSignedData);
00156 
00157 #endif

Generated on Mon Nov 15 11:15:56 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6