os/security/cryptoservices/certificateandkeymgmt/inc/cmssignedobject.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 /**
    20  @file
    21  @publishedPartner
    22  @released
    23 */
    24 
    25 #ifndef CMSSIGNEDOBJECT_H
    26 #define CMSSIGNEDOBJECT_H
    27 
    28 #include <cmsdefs.h>
    29 #include <signed.h>
    30 #include <cmscertchoice.h>
    31 
    32 class CCmsSignerInfo;
    33 class CDSAPrivateKey;
    34 class CRSAPrivateKey;
    35 class CCmsSignerIdentifier;
    36 class CCmsContentInfo;
    37 class CEncapsulatedContentInfo;
    38 class CX509Certificate;
    39 class CX509AlgorithmIdentifier;
    40 class CCmsCertificateChoice;
    41 class CASN1EncSequence;
    42 class CASN1EncBase;
    43 
    44 const TInt KCmsMaxSignedDataElements = 6;
    45 /**
    46  A representation of a RFC2630 (signed data) entity.
    47  */
    48 class CCmsSignedObject : public CSignedObject
    49 	{
    50 public:
    51 
    52 	/**
    53 	Index of CMS object fields.
    54 	*/
    55 	enum
    56 		{
    57 		/**
    58 		Index of version field
    59 		*/
    60 		EVersionNumber = 0,
    61 		
    62 		/**
    63 		Index of digest algorithm set field
    64 		*/		
    65 		EDigestAlgorithms = 1,
    66 
    67 		/**
    68 		Index of encapsulated content info field
    69 		*/				
    70 		EEncapsulatedContentInfo = 2,
    71 		
    72 		/**
    73 		Index of certificate set field
    74 		*/						
    75 		ECertificates = 3,
    76 		
    77 		/**
    78 		Index of revocation list field
    79 		*/						
    80 		ERevocationLists = 4,
    81 		
    82 		/**
    83 		Index of signer info set field
    84 		*/						
    85 		ESignedInfo = 5
    86 		};
    87 
    88 	/**
    89 	Creates a CMS signed data object as defined in RFC2630. The CMS signed data created by 
    90 		this API contains no signer info. SignL() method can be called to add more signer info.
    91 	@param aType The type of the encapsulated content.
    92 	@param aIsDetached A boolean indicating whether the encapsulated data is detached.
    93 	@param aContentData The encapsulated data. 
    94 		If aIsDetached is EFalse, aContentData must not be KNullDesC8. Otherwise this API leave 
    95 		with KErrArgument.
    96 		If aIsDetached is ETrue, aContentData can be KNullDesC8. But user must provide hash 
    97 		value when later calling SignL(). Otherwise SignL() leaves with KErrArguement.	
    98 	@return The fully constructed object.
    99 	*/
   100 	IMPORT_C static CCmsSignedObject* NewL(TCmsContentInfoType aType,
   101 											TBool aIsDetached,
   102 											const TDesC8& aContentData);
   103 
   104 	/**
   105 	Creates a CMS signed data object as defined in RFC2630, and leaves the object on the cleanup stack.
   106 		this API contains no signer info. SignL() method can be called to add more signer info.
   107 	@param aType The type of the encapsulated content.
   108 	@param aIsDetached A boolean indicating whether the encapsulated data is detached.
   109 	@param aContentData The encapsulated data.
   110 		If aIsDetached is EFalse, aContentData must not be KNullDesC8. Otherwise this API leave 
   111 		with KErrArgument.
   112 		If aIsDetached is ETrue, aContentData can be KNullDesC8. But user must provide hash 
   113 		value when later calling SignL(). Otherwise SignL() leaves with KErrArguement.	
   114 	@return The fully constructed object.
   115 	*/
   116 	IMPORT_C static CCmsSignedObject* NewLC(TCmsContentInfoType aType,
   117 											TBool aIsDetached,
   118 											const TDesC8& aContentData);
   119 	
   120 	/**
   121 	Creates a CMS signed data object as defined in RFC2630. This API only creates detached signed data 
   122 		as no data content is provided. The CMS signed data created by this API contains one signer info. 
   123 		SignL() method can be called to add more signer info.
   124 	@param aType Encapsulated Content data type.
   125 	@param aHashValue The hash value of the data content to be signed.
   126 	@param aDigestAlgorithm The digest algorithm used to create the hash.
   127 	@param aKey The DSA private key used to sign.
   128 	@param aCert The signer's certificate.
   129 	@param aAddCertificate A boolean indicating whether the signer's certificate is added to the signed data object.
   130 	@return	The fully constructed object.
   131 	*/	
   132 	IMPORT_C static CCmsSignedObject* NewL(TCmsContentInfoType aType,
   133 										const TDesC8& aHashValue,
   134 										TAlgorithmId aDigestAlgorithm,
   135 										const CDSAPrivateKey& aKey,
   136 										const CX509Certificate& aCert,
   137 										TBool aAddCertificate);
   138 											
   139 	/**
   140 	Creates a CMS signed data object as defined in RFC2630 and leaves the object on the cleanup stack.
   141         This API only creates detached signed data as no data content is provided. The CMS signed data 
   142         created by this API contains one signer info. SignL() method can be called to add more signer info.
   143 	@param aType Encapsulated Content data type.
   144 	@param aHashValue The hash value of the data content to be signed.
   145 	@param aDigestAlgorithm The digest algorithm used to create the hash.
   146 	@param aKey The DSA private key used to sign.
   147 	@param aCert The signer's certificate.
   148 	@param aAddCertificate A boolean indicating whether the signer's certificate is added to the signed data object.
   149 	@return	The fully constructed object.
   150 	*/			
   151 	IMPORT_C static CCmsSignedObject* NewLC(TCmsContentInfoType aType,
   152 										const TDesC8& aHashValue,
   153 										TAlgorithmId aDigestAlgorithm,
   154 										const CDSAPrivateKey& aKey,
   155 										const CX509Certificate& aCert,
   156 										TBool aAddCertificate);
   157 
   158 	/**
   159 	Creates a CMS signed data object as defined in RFC2630. This API only creates detached signed data 
   160 		as no data content is provided. The CMS signed data created by this API contains one signer info. 
   161 		SignL() method can be called to add more signer info.
   162 	@param aType Encapsulated Content data type.
   163 	@param aHashValue The hash value of the data content to be signed.
   164 	@param aDigestAlgorithm The digest algorithm used to create the hash.
   165 	@param aKey The RSA private key used to sign.
   166 	@param aCert aCert The signer's certificate.
   167 	@param aAddCertificate A boolean indicating whether the signer's certificate is added to the signed data object.
   168 	@return	The fully constructed object.
   169 	*/	
   170 	IMPORT_C static CCmsSignedObject* NewL(TCmsContentInfoType aType,
   171 										const TDesC8& aHashValue,
   172 										TAlgorithmId aDigestAlgorithm,
   173 										const CRSAPrivateKey& aKey,
   174 										const CX509Certificate& aCert,
   175 										TBool aAddCertificate);
   176 											
   177 	/**
   178 	Creates a CMS signed data object as defined in RFC2630 and leaves the object on the cleanup stack.
   179         This API only creates detached signed data as no data content is provided. The CMS signed data 
   180         created by this API contains one signer info. SignL() method can be called to add more signer info.
   181 	@param aType Encapsulated Content data type.
   182 	@param aHashValue The hash value of the data content to be signed.
   183 	@param aDigestAlgorithm The digest algorithm used to create the hash.
   184 	@param aKey The RSA private key used to sign.
   185 	@param aCert The signer's certificate.
   186 	@param aAddCertificate A boolean indicating whether the signer's certificate is added to the signed data object.
   187 	@return	The fully constructed object.
   188 	*/			
   189 	IMPORT_C static CCmsSignedObject* NewLC(TCmsContentInfoType aType,
   190 										const TDesC8& aHashValue,
   191 										TAlgorithmId aDigestAlgorithm,
   192 										const CRSAPrivateKey& aKey,
   193 										const CX509Certificate& aCert,
   194 										TBool aAddCertificate);
   195 
   196 	/**
   197 	Creates a CMS signed data object as defined in RFC2630.
   198 	@param aContentInfo	The CMS content info that contains the encoded signed object.
   199 	@return			The fully constructed object.
   200 	*/
   201 	IMPORT_C static CCmsSignedObject* NewL(const CCmsContentInfo& aContentInfo);
   202 	
   203 	/**
   204 	Creates a CMS signed data object as defined in RFC2630 and leaves it on the cleanup stack.
   205 	@param aContentInfo	The CMS content info that contains the encoded signed object.
   206 	@return			The fully constructed object.
   207 	*/	
   208 	IMPORT_C static CCmsSignedObject* NewLC(const CCmsContentInfo& aContentInfo);
   209 
   210 
   211 	/**
   212 	Creates one signature and adds it to the Signer info list. The signing certificate
   213 	is added to the certificate list if the last boolean parameter aAddCertificate is true and 
   214 	it does not exist in the list. The digest algorithm is added to the digest algorithm list if it 
   215 	does not exist in the list. Calling this API multiple times will create multiple signatures.
   216 	@param aHashValue The hash value to be signed. If this is an empty string,
   217 					  the content data to be signed must have been passed in via 
   218 					  NewL method and hash value will be calculated by the implementation
   219 					  of this method. 
   220 	@param aDigestAlgorithm The digest algorithm used to create the hash.
   221 	@param aKey the DSA private key used to sign.
   222 	@param aCert the signer's certificate.
   223 	@param aAddCertificate A boolean indicating whether the signer's certificate is added to the signed data object.
   224 	@leave KErrArgument if no hash nor data content is provided.
   225 	*/
   226 	IMPORT_C void SignL(const TDesC8& aHashValue,
   227 						TAlgorithmId aDigestAlgorithm,
   228 						const CDSAPrivateKey& aKey,
   229 						const CX509Certificate& aCert,
   230 						TBool aAddCertificate);
   231 						
   232 
   233 	/**
   234 	Creates one signature and adds it to the Signer info list. The signing certificate
   235 	is added to the certificate list if the last boolean parameter aAddCertificate is true and 
   236 	it does not exist in the list. The digest algorithm is added to the digest algorithm list if it 
   237 	does not exist in the list. Calling this API multiple times will create multiple signatures.
   238 	@param aHashValue The hash value to be signed. If this is an empty string,
   239 					  the content data to be signed must have been passed in via 
   240 					  NewL method and hash value will be calculated by the implementation
   241 					  of this method. 
   242 	@param aDigestAlgorithm The digest algorithm used to create the hash.
   243 	@param aKey the RSA private key used to sign.
   244 	@param aCert the signer's certificate.
   245 	@param aAddCertificate A boolean indicating whether the signer's certificate is added to the signed data object.
   246 	@leave KErrArgument if no hash nor data content is provided.
   247 	*/
   248 	IMPORT_C void SignL(const TDesC8& aHashValue,
   249 						TAlgorithmId aDigestAlgorithm,
   250 						const CRSAPrivateKey& aKey,
   251 						const CX509Certificate& aCert,
   252 						TBool aAddCertificate);
   253 
   254 	/**
   255 	Destructor
   256 	*/
   257 	IMPORT_C ~CCmsSignedObject();
   258 
   259 	/*
   260 	virtual from signedobject class
   261 	*/
   262 	IMPORT_C virtual const TPtrC8* DataElementEncoding(const TUint aIndex) const;
   263 	IMPORT_C virtual void InternalizeL(RReadStream& aStream) ;
   264 	IMPORT_C virtual const TPtrC8 SignedDataL() const;
   265 		
   266 	/**
   267 	Returns whether the certificate list exists.
   268 	@return	Boolean indicating whether the certificate list exists.
   269 	*/
   270 	IMPORT_C TBool IsCertificateSetPresent() const;
   271 
   272 	/**
   273 	Returns whether the certificate revocation list exists.
   274 	@return	Boolean indicating whether the certificate Revocation list exists.
   275 	*/
   276 	IMPORT_C TBool IsCertificateRevocationListsPresent() const;
   277 
   278 	/**
   279 	Returns the version of this CMS signed object.
   280 	@return The version of this CMS signed object.
   281 	*/
   282 	IMPORT_C TInt Version() const;
   283 
   284 	/**
   285 	Returns the employed algorithm list.
   286 	@return	The employed algorithm list reference.
   287 	*/
   288 	IMPORT_C const RPointerArray<CX509AlgorithmIdentifier>& DigestAlgorithms() const;
   289 	
   290 	/**
   291 	Returns the certificates list.
   292 	@return	The certificates list reference.
   293 	*/
   294 	IMPORT_C const RPointerArray<CCmsCertificateChoice>& Certificates() const;
   295 	
   296 	/**
   297 	Returns the encapsulated content info of this signed object.
   298 	@return The encapsulated content info reference.
   299 	*/
   300 	IMPORT_C const CEncapsulatedContentInfo& ContentInfo() const;
   301 
   302 	
   303 	/**
   304 	Retrieves the list of SignerInfo objects.
   305 	@return The signer info list reference.
   306 	*/
   307 	IMPORT_C const RPointerArray<CCmsSignerInfo>& SignerInfo() const;
   308 
   309 
   310 	/**
   311 	Creates the ASN1 sequence of this CMS signed object and leaves it on the cleanup stack.
   312 	@return  ASN1 sequence of this object.
   313 	*/
   314 	IMPORT_C CASN1EncSequence* EncodeASN1DERLC() const;
   315 	
   316 	/**
   317 	Appends the X509 certificate to the certificate list.
   318 	@param aCert The X509 certificate to be appended.
   319 	*/
   320 	IMPORT_C void AddCertificateL(const CX509Certificate& aCert);
   321 
   322 
   323 	/**
   324 	Appends an encoded attribute certificate to the certificate list. 
   325 	@param aCert The encoded certificate to be appended.
   326 	@param aType The type of the encoded certificate..
   327 	*/
   328 	IMPORT_C void AddCertificateL(const TDesC8& aCert, CCmsCertificateChoice::TCertificateType aType);	
   329 	
   330 	/**
   331 	Validates the signer and creates the certificate chain for that signer. This API is used to validate attached signature.
   332 	@param aSignerInfo The signer to be validated.
   333 	@param aCertChainEncoding The certificate chain. This is created and pushed onto the cleanup stack by the function.
   334 	@leave KErrNotFound There is no matching certificate.
   335 	@return Boolean that identifies whether the signer can be validated.
   336     */
   337 	IMPORT_C TBool ValidateSignerLC(const CCmsSignerInfo& aSignerInfo, HBufC8*& aCertChainEncoding);
   338 
   339 	/**
   340 	Validates the signer and creates the certificate chain for that signer. This API is used to validate attached signature.
   341 	@param aSignerInfo The signer to be validated.
   342 	@param aCertificates The certificate list provided by the user to validate the signature.
   343 	@param aCertChainEncoding The certificate chain. This is created and pushed onto the cleanup stack by the function.
   344 	@return Boolean that identifies whether the signer can be validated.
   345 	@leave KErrNotFound There is no matching certificate.
   346 	*/
   347 	IMPORT_C TBool ValidateSignerLC(const CCmsSignerInfo& aSignerInfo, const RPointerArray<CX509Certificate>& aCertificates, HBufC8*& aCertChainEncoding);
   348 
   349 
   350 
   351 	/**
   352 	Validates the signer and creates the certificate chain for that signer. This API is used to validate detached signature.
   353 	@param aSignerInfo The signer to be validated.
   354 	@param aCertChainEncoding The certificate chain. This is created and pushed onto the cleanup stack by the function.
   355 	@param aIsHash The flag represent if the next parameter is the hash of the data content.
   356 	@param aContentDataOrHash the descriptor that contains the data content or its hash
   357 	@leave KErrNotFound There is no matching certificate.
   358 	@return Boolean that identifies whether the signer can be validated.
   359     */
   360 	IMPORT_C TBool ValidateSignerLC(const CCmsSignerInfo& aSignerInfo, HBufC8*& aCertChainEncoding, TBool aIsHash, const TDesC8& aContentDataOrHash);
   361 
   362 	/**
   363 	Validates the signer and creates the certificate chain for that signer. This API is used to validate detached signature.
   364 	@param aSignerInfo The signer to be validated.
   365 	@param aCertificates The certificate list provided by the user to validate the signature.
   366 	@param aCertChainEncoding The certificate chain. This is created and pushed onto the cleanup stack by the function.
   367 	@param aIsHash The flag represent if the next parameter is the hash of the data content.
   368 	@param aContentDataOrHash the descriptor that contains the data content or its hash	
   369 	@return Boolean that identifies whether the signer can be validated.
   370 	@leave KErrNotFound There is no matching certificate.
   371 	*/
   372 	IMPORT_C TBool ValidateSignerLC(const CCmsSignerInfo& aSignerInfo, const RPointerArray<CX509Certificate>& aCertificates, HBufC8*& aCertChainEncoding, TBool aIsHash, const TDesC8& aContentDataOrHash);
   373 
   374 	
   375 private:
   376 	/**
   377 	Constructor
   378 	*/
   379 	CCmsSignedObject();
   380 	
   381 	
   382 private:
   383 	/**
   384 	Second phase constructor for decoding a CMS signed data object
   385 	@param aContentInfo the content info which contains the CMS signed data.
   386 	*/		
   387 	void ConstructL(const CCmsContentInfo& aContentInfo);
   388 	
   389 	/**
   390 	Second phase constructor for constructing a CMS signed data object from data content.
   391 	@param aType the encapsulated content info type.
   392 	@param aIsDetached if the CMS signed data does not contains the data content being signed.
   393 	@param aContentData the content data descriptor.
   394 	*/			
   395 	void ConstructL(TCmsContentInfoType aType, TBool aIsDetached, const TDesC8& aContentData);
   396 	
   397 	/**
   398 	Second phase constructor for constructing a CMS signed data object from data content hash
   399 	@param aType the encapsulated content info type.
   400 	@param aHashValue the hash of the data content to create the signature.
   401 	@param aDigestAlgorithm the digest algorithm.
   402 	@param aKey the DSA private to create signature.
   403 	@param aCert the signer's certficate
   404 	@param aAddCertificate a flag to represent if the signer's certificate is added to certificate set.
   405 	*/				
   406 	void ConstructL(TCmsContentInfoType aType,
   407 					const TDesC8& aHashValue,
   408 					TAlgorithmId aDigestAlgorithm,
   409 					const CDSAPrivateKey& aKey,
   410 					const CX509Certificate& aCert,
   411 					TBool aAddCertificate);
   412 	/**
   413 	Second phase constructor for constructing a CMS signed data object from data content hash
   414 	@param aType the encapsulated content info type.
   415 	@param aHashValue the hash of the data content to create the signature.
   416 	@param aDigestAlgorithm the digest algorithm.
   417 	@param aKey the RSA private to create signature.
   418 	@param aCert the signer's certficate
   419 	@param aAddCertificate a flag to represent if the signer's certificate is added to certificate set.
   420 	*/								
   421 	void ConstructL(TCmsContentInfoType aType,
   422 					const TDesC8& aHashValue,
   423 					TAlgorithmId aDigestAlgorithm,
   424 					const CRSAPrivateKey& aKey,
   425 					const CX509Certificate& aCert,
   426 					TBool aAddCertificate);
   427 	/**
   428 	Append the algorithm to the algoritm list
   429 	@param aDigestAlgorithm the algorithm ID.
   430 	*/
   431 	void AddDigestAlgorithmL(TAlgorithmId aDigestAlgorithm);
   432 					
   433 	/**
   434 	Build the signer's identifier from the signer's certificate. If the signer's certificate
   435 	contains the subject identifier extension, the signer identifier is subject id extension.
   436 	otherwise, the signer identifier is isuuer name and serial number.
   437 	@param aCert the signer's certificate.
   438 	@return a CMS signer identifier instance pointer
   439 	*/
   440 	CCmsSignerIdentifier* BuildSignerIdentifierLC(const CX509Certificate& aCert);
   441 	
   442 	/**
   443 	Build the signer list, algorithm list and certificate list in the CMS signer data.
   444 	@param aDigestAlgorithm the digest algorithm identifier.
   445 	@param aIsHash A flag the represent if the next descriptor is the hash value rather that original data
   446 	@param aValue the data content or its hash.
   447 	@param aKey the DSA private used to sign.
   448 	@param aCert the signer's certificate
   449 	@param aAddCertificate the flag to represent if the certificate is added to the certificate set
   450 	*/	
   451 	void BuildSignerInfoCertListAndAlgoritmListL(TAlgorithmId aDigestAlgorithm,
   452 												TBool aIsHash,
   453 												const TDesC8& aValue,
   454 												const CDSAPrivateKey& aKey,
   455 												const CX509Certificate& aCert,
   456 												TBool aAddCertificate);
   457 
   458 	/**
   459 	Build the signer list, algorithm list and certificate list in the CMS signer data.
   460 	@param aDigestAlgorithm the digest algorithm identifier.
   461 	@param aIsHash A flag the represent if the next descriptor is the hash value rather that original data
   462 	@param aValue the data content or its hash.
   463 	@param aKey the RSA private used to sign.
   464 	@param aCert the signer's certificate
   465 	@param aAddCertificate the flag to represent if the certificate is added to the certificate set
   466 	*/		
   467 	void BuildSignerInfoCertListAndAlgoritmListL(TAlgorithmId aDigestAlgorithm,
   468 												TBool aIsHash,
   469 												const TDesC8& aValue,
   470 												const CRSAPrivateKey& aKey,
   471 												const CX509Certificate& aCert,
   472 												TBool aAddCertificate);
   473 	/**
   474 	Initialise the signed data base class members for the validation process.
   475 	@param aRawData the raw data of the CMS signed data.
   476 	*/
   477 	void InitSignedObjectL(const TDesC8& aRawData);
   478 	
   479 	
   480 	/**
   481 	Decode the CMS Signer data.
   482 	@param aRawData the raw data of the CMS signed data.
   483 	*/
   484 	void DecodeSignedDataL(const TDesC8& aRawData);	
   485 
   486 	/**
   487 	Decode the digest algorithm set.
   488 	@param the raw data of the algorithm list.
   489 	*/
   490 	void DecodeDigestAlgorithmsL(const TDesC8& aRawData);
   491 
   492 	/**
   493 	Decode the encapsulated content info
   494 	@param the raw data of the encapsulated content info.
   495 	*/
   496 	void DecodeEncapsulatedContentInfoL(const TDesC8& aRawData);
   497 	
   498 	/**
   499 	Decode the certificate set.
   500 	@param the raw data of the certificate list
   501 	*/	
   502 	void DecodeCertificatesL(const TDesC8& aRawData);
   503 	
   504 	/**
   505 	Decode the certificate revocation set. Not implemented now!
   506 	@param the raw data of the certificate revocation list.
   507 	*/		
   508 	void DecodeRevocationListsL(const TDesC8& aRawData);
   509 
   510 	/**
   511 	Decode the signer info set.
   512 	@param the raw data of the certificate revocation list.
   513 	*/			
   514 	void DecodeSignerInfoL(const TDesC8& aRawData);
   515 
   516 	/**
   517 	Encode the certificate set
   518 	@return the encoding of the certificate set
   519 	*/													
   520 	CASN1EncBase* EncodeCertificatesLC() const;
   521 	
   522 	/**
   523 	Encode the algorithm set
   524 	@return the encoding of the digest algorithm set
   525 	*/
   526 	CASN1EncBase* EncodeAlgorithmsLC() const;
   527 	
   528 	/**
   529 	Encode the signer info set
   530 	@return the encoding of the certificate set
   531 	*/
   532 	CASN1EncBase* EncodeSignerInfoLC() const;
   533 	
   534 	/**
   535 	Validate the signature by the given certificate.
   536 	@param aSignerInfo the signer info reference contains the signature
   537 	@param aEndEntityCert the certificate used to create the signature.
   538 	@return if the signature can be validated
   539 	*/
   540 	TBool ValidateSignatureL(const CCmsSignerInfo& aSignerInfo, const CX509Certificate& aEndEntityCert);
   541 	
   542 	/**
   543 	This function is called when validating a detached CMS signed object.
   544 	It sets the data content being signed so that the signed data can be validated.
   545 	@param aContentData The data content being signed.
   546 	*/
   547 	void SetContentData(const TDesC8& aContentData);
   548 
   549 	/**
   550 	This function is called when validating a detached CMS signed object.
   551 	It sets the hash being signed so that the signed data can be validated.
   552 	@param aHash The hash being signed.
   553 	*/
   554 	void SetHash(const TDesC8& aHash);
   555 	
   556 	
   557 private:
   558 	/**
   559 	Reprents if the certificate set is present
   560 	*/
   561 	TBool iIsCertificateSetPresent;
   562 	
   563 	/**
   564 	Reprents if the certificate revocationlisy is present
   565 	*/	
   566 	TBool iIsCertificateRevocationListsPresent;
   567 	
   568 	/**
   569 	Version of the Signed object
   570 	*/
   571 	TInt iVersion;
   572 	
   573 	/**
   574 	Algorithm Set
   575 	*/
   576 	RPointerArray<CX509AlgorithmIdentifier> iDigestAlgorithms;
   577 	
   578 	/**
   579 	Encapsulated Content List
   580 	*/
   581 	CEncapsulatedContentInfo* iContentInfo;
   582 	
   583 	/**
   584 	Certificate Set
   585 	*/
   586 	RPointerArray<CCmsCertificateChoice> iCertificates;
   587 	
   588 	/**
   589 	Signer Info Set
   590 	*/
   591 	RPointerArray<CCmsSignerInfo> iSignerInfo;
   592 	
   593 	/**
   594 	Array of Encoded fields
   595 	*/	
   596 	TFixedArray<TPtrC8*, KCmsMaxSignedDataElements> iDataElements;
   597 	
   598 	/**
   599 	The data content being signed
   600 	*/
   601 	TPtrC8 iContentData;
   602 	
   603 	/**
   604 	The Hash being signed
   605 	*/
   606 	TPtrC8 iHash;
   607 	};
   608 
   609 
   610 #endif //CMSSIGNEDOBJECT_H