First public contribution.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
25 #ifndef __PKCS7_CONTENT_INFO_V2_H__
26 #define __PKCS7_CONTENT_INFO_V2_H__
31 _LIT(KPkcs7DataOID, "1.2.840.113549.1.7.1");
33 /** pkcs7-2 SignedData */
34 _LIT(KPkcs7SignedDataOID, "1.2.840.113549.1.7.2");
36 /** pkcs7-3 EnvelopedData */
37 _LIT(KPkcs7EnvelopedDataOID, "1.2.840.113549.1.7.3");
39 /** pkcs7-4 SignedAndEnvelopedData */
40 _LIT(KPkcs7SignedAndEnvelopedDataOID, "1.2.840.113549.1.7.4");
42 /** pkcs7-5 DigestedData */
43 _LIT(KPkcs7DigestedDataOID, "1.2.840.113549.1.7.5");
45 /** pkcs7-6 EncryptedData */
46 _LIT(KPkcs7EncryptedDataOID, "1.2.840.113549.1.7.6");
48 /** The numeric value of last element in the PKCS7 Data OID */
49 const TInt KPkcs7Data = 1;
51 /** The numeric value of last element in the PKCS7 Signed OID */
52 const TInt KPkcs7SignedData = 2;
55 The RFC2315 ContentInfo entity
56 This class provides details about the Content Type in the Content Info,
57 Provides access to the Content Data when the Content Type is Data and
58 provides access to the Entire ContentInfo Sequence.
60 class CPKCS7ContentInfo : public CBase
64 Identifies the type of Content Type present in the PKCS7 ContentInfo Structure.
68 /** The numeric value of last element in the PKCS7 ContentType Data OID */
70 /** The numeric value of last element in the PKCS7 ContentType SignedData OID */
71 EContentTypeSignedData,
72 /** The numeric value of last element in the PKCS7 ContentType EnvelopedData OID */
73 EContentTypeEnvelopedData,
74 /** The numeric value of last element in the PKCS7 ContentType SignedAndEnvelopedData OID */
75 EContentTypeSignedAndEnvelopedData,
76 /** The numeric value of last element in the PKCS7 ContentType DigestedData OID */
77 EContentTypeDigestedData,
78 /** The numeric value of last element in the PKCS7 ContentType EncryptedData OID */
79 EContentTypeEncryptedData
82 Creates a new PKCS#7 ContentInfo object.
83 @param aRawData contains a PKCS#7 ContentInfo Structure
84 @return A pointer to the newly allocated object.
85 @leave KErrNotSupported if the OID value is otherthan enum TContentInfoType.
86 @leave KErrArgument if the data is not PKCS7 contentInfo structure.
89 IMPORT_C static CPKCS7ContentInfo* NewL(const TDesC8& aRawData);
94 virtual ~CPKCS7ContentInfo();
98 Provides the information about the ContentType in the
100 It returns the last number in the ObjectIdentifier
101 @return The ContentType. This is
105 4 for SignedAndEnvelopedData
109 IMPORT_C TContentInfoType ContentType() const;
112 Provides access to the Content Data present in PKCS#7 ContentInfo
113 ContentData present in PKCS#7 ContentInfo is OPTIONAL
114 The client has to check for data length 0 in case there is no ContentData.
115 @return The ContentData
117 IMPORT_C const TPtrC8 ContentData() const;
123 CPKCS7ContentInfo(void);
127 @param aContentinfo A CPKCS7ContentInfo object.
129 CPKCS7ContentInfo(const CPKCS7ContentInfo& aContentInfo);
133 @param aContentinfo A CPKCS7ContentInfo object.
134 @return A reference to CPKCS7ContentInfo class.
136 CPKCS7ContentInfo& operator=(const CPKCS7ContentInfo& aContentInfo);
139 Decodes the PKCS#7 ContentInfo object.
140 @param aRawData contains a PKCS#7 ContentInfo Structure.
141 @leave KErrNotSupported if the OID val is otherthan 1 - 6
142 i,e the last part of the OID.
143 @leave KErrArgument if the data is not PKCS7 contentInfo structure.
144 @ see TASN1DecObjectIdentifier,
146 void ConstructL(const TDesC8& aRawData);
150 Indicates the type of content. Here it is the last Character
151 in the OID which identifies the Content Type.
153 TContentInfoType iContentType;
155 /** The ContentData present in PKCS7 ContentInfo*/
159 #endif // __PKCS7_CONTENT_INFO_V2_H__