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 CMSCONTENTINFO_H
26 #define CMSCONTENTINFO_H
30 class CASN1EncSequence;
33 The RFC2630 EncapsulatedContentInfo entity.
34 This class provides details about the Content Type in the Content Info,
35 provides access to the Content Data when the Content Type is Data and
36 provides access to the entire ContentInfo sequence.
38 class CEncapsulatedContentInfo : public CBase
45 * Creates an EncapsulatedContentInfo as defined in RFC2630.
46 * @param aRawData the encoded encapsulated data.
47 * @return The fully constructed object
49 static CEncapsulatedContentInfo* NewL(const TDesC8& aRawData);
54 * Creates an EncapsulatedContentInfo as defined in RFC2630, and leaves the instance on the cleanup stack.
55 * @param aRawData The encoded encapsulated data.
56 * @return The fully constructed object.
58 static CEncapsulatedContentInfo* NewLC(const TDesC8& aRawData);
63 * Creates an EncapsulatedContentInfo as defined in RFC2630.
64 * @param aContentInfoType The type of the encapsulated content.
65 * @param aIsEContentDataPresent Indicates whether the encapsulated data is present.
66 * @param aContentData The encapsulated data.
67 * @return The fully constructed object.
69 static CEncapsulatedContentInfo* NewL(TCmsContentInfoType aContentInfoType, TBool aIsEContentDataPresent, const TDesC8& aContentData);
74 * Creates an EncapsulatedContentInfo as defined in RFC2630, and leaves the instance on the cleanup stack.
75 * @param aContentInfoType The type of the encapsulated content.
76 * @param aIsEContentDataPresent Indicates whether the encapsulated data is present.
77 * @param aContentData The encapsulated data.
78 * @return The fully constructed object
80 static CEncapsulatedContentInfo* NewLC(TCmsContentInfoType aContentInfoType, TBool aIsEContentDataPresent, const TDesC8& aContentData);
85 * Creates the DER sequence of the ContentInfo and leaves the DER sequence on the cleanup stack.
86 * @return The ASN.1 sequence of the ContentInfo.
88 CASN1EncSequence* EncodeASN1DERLC() const;
91 Provides information about the ContentType in the ContentInfo sequence.
92 It returns the last number in the ObjectIdentifier.
93 @return The ContentType. This is:
103 - 6 for EncryptedData
105 IMPORT_C TCmsContentInfoType ContentType() const;
108 Returns whether the ContentInfo is present or not.
109 ContentData present in EncapsulatedContentInfo is OPTIONAL.
110 @return A boolean value that indicates whether or not the ContentInfo is present.
112 IMPORT_C TBool IsContentDataPresent() const;
115 Provides access to the Content Data present in CMS. ContentData present
116 in EncapsulatedContentInfo is OPTIONAL. The client has to check for
117 data length 0 or if the data content is present in case there is no ContentData.
118 @return The ContentData.
120 IMPORT_C const TPtrC8 ContentData() const;
124 Constuctor and second phase constructor.
126 CEncapsulatedContentInfo();
127 CEncapsulatedContentInfo(TCmsContentInfoType aContentInfoType, TBool aIsEContentDataPresent, const TDesC8& aContentData);
128 void ConstructL(const TDesC8& aRawData);
132 The Type of the ContentInfo
134 TCmsContentInfoType iContentType;
137 Represents whether the Content is present or not.
139 TBool iIsContentDataPresent;
149 The RFC2630 ContentInfo entity.
150 This class provides details about the content type in the ContentInfo,
151 provides access to the content data when the content type is Data and
152 provides access to the entire ContentInfo sequence.
153 At present, only data content type and signed data type are supported.
155 class CCmsContentInfo : public CBase
159 Creates a ContentInfo as defined in RFC2630.
160 @param aRawData The encoded encapsulated data.
161 @return The fully constructed object.
163 IMPORT_C static CCmsContentInfo* NewL(const TDesC8& aRawData);
165 Creates a ContentInfo as defined in RFC2630,
166 and leaves the instance on the cleanup stack.
167 @param aRawData The encoded encapsulated data.
168 @return The fully constructed object.
170 IMPORT_C static CCmsContentInfo* NewLC(const TDesC8& aRawData);
173 Creates a ContentInfo as defined in RFC2630.
174 @param aContentInfoType The type of the encapsulated content.
175 @param aContentData The encapsulated data.
176 @return The fully constructed object.
178 IMPORT_C static CCmsContentInfo* NewL(TCmsContentInfoType aContentInfoType, const TDesC8& aContentData);
181 Creates a ContentInfo as defined in RFC2630 and leaves the object on the cleanup stack.
182 @param aContentInfoType The type of the encapsulated content.
183 @param aContentData The encapsulated data.
184 @return The fully constructed object.
186 IMPORT_C static CCmsContentInfo* NewLC(TCmsContentInfoType aContentInfoType, const TDesC8& aContentData);
189 Creates the DER sequence of the ContentInfo and leaves the DER sequence on the cleanup stack.
190 @return The ASN.1 sequence of the ContentInfo.
192 IMPORT_C CASN1EncSequence* EncodeASN1DERLC() const;
197 IMPORT_C ~CCmsContentInfo();
200 Provides the information about the ContentType in the ContentInfo sequence.
201 It returns the last number in the Object Identifier.
202 @return The ContentType. This is:
208 - 3 for EnvelopedData
212 - 6 for EncryptedData
214 IMPORT_C TCmsContentInfoType ContentType() const;
217 Provides access to the content data.
218 @return The content data.
220 IMPORT_C const TPtrC8 ContentData() const;
230 constructor to build the CMS content info from the given parameters
231 @param aContentInfoType the type of data contained in the CMS content info
232 @param aContentData the descriptor which contains the encoded CMS oject
234 CCmsContentInfo(TCmsContentInfoType aContentInfoType, const TDesC8& aContentData);
237 constructor to build the CMS content info from the raw data.
238 @param aContentInfoType the type of data contained in the CMS content info
239 @param aContentData the descriptor which contains the encoded CMS oject
241 void ConstructL(const TDesC8& aRawData);
245 The Type of the ContentInfo
247 TCmsContentInfoType iContentType;
255 #endif // CMSCONTENTINFO_H