sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@publishedPartner
|
sl@0
|
22 |
@released
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#ifndef CMSCONTENTINFO_H
|
sl@0
|
26 |
#define CMSCONTENTINFO_H
|
sl@0
|
27 |
|
sl@0
|
28 |
#include "cmsdefs.h"
|
sl@0
|
29 |
|
sl@0
|
30 |
class CASN1EncSequence;
|
sl@0
|
31 |
|
sl@0
|
32 |
/**
|
sl@0
|
33 |
The RFC2630 EncapsulatedContentInfo entity.
|
sl@0
|
34 |
This class provides details about the Content Type in the Content Info,
|
sl@0
|
35 |
provides access to the Content Data when the Content Type is Data and
|
sl@0
|
36 |
provides access to the entire ContentInfo sequence.
|
sl@0
|
37 |
*/
|
sl@0
|
38 |
class CEncapsulatedContentInfo : public CBase
|
sl@0
|
39 |
{
|
sl@0
|
40 |
public:
|
sl@0
|
41 |
|
sl@0
|
42 |
/**
|
sl@0
|
43 |
* @internalComponent
|
sl@0
|
44 |
*
|
sl@0
|
45 |
* Creates an EncapsulatedContentInfo as defined in RFC2630.
|
sl@0
|
46 |
* @param aRawData the encoded encapsulated data.
|
sl@0
|
47 |
* @return The fully constructed object
|
sl@0
|
48 |
**/
|
sl@0
|
49 |
static CEncapsulatedContentInfo* NewL(const TDesC8& aRawData);
|
sl@0
|
50 |
|
sl@0
|
51 |
/**
|
sl@0
|
52 |
* @internalComponent
|
sl@0
|
53 |
*
|
sl@0
|
54 |
* Creates an EncapsulatedContentInfo as defined in RFC2630, and leaves the instance on the cleanup stack.
|
sl@0
|
55 |
* @param aRawData The encoded encapsulated data.
|
sl@0
|
56 |
* @return The fully constructed object.
|
sl@0
|
57 |
**/
|
sl@0
|
58 |
static CEncapsulatedContentInfo* NewLC(const TDesC8& aRawData);
|
sl@0
|
59 |
|
sl@0
|
60 |
/**
|
sl@0
|
61 |
* @internalComponent
|
sl@0
|
62 |
*
|
sl@0
|
63 |
* Creates an EncapsulatedContentInfo as defined in RFC2630.
|
sl@0
|
64 |
* @param aContentInfoType The type of the encapsulated content.
|
sl@0
|
65 |
* @param aIsEContentDataPresent Indicates whether the encapsulated data is present.
|
sl@0
|
66 |
* @param aContentData The encapsulated data.
|
sl@0
|
67 |
* @return The fully constructed object.
|
sl@0
|
68 |
**/
|
sl@0
|
69 |
static CEncapsulatedContentInfo* NewL(TCmsContentInfoType aContentInfoType, TBool aIsEContentDataPresent, const TDesC8& aContentData);
|
sl@0
|
70 |
|
sl@0
|
71 |
/**
|
sl@0
|
72 |
* @internalComponent
|
sl@0
|
73 |
*
|
sl@0
|
74 |
* Creates an EncapsulatedContentInfo as defined in RFC2630, and leaves the instance on the cleanup stack.
|
sl@0
|
75 |
* @param aContentInfoType The type of the encapsulated content.
|
sl@0
|
76 |
* @param aIsEContentDataPresent Indicates whether the encapsulated data is present.
|
sl@0
|
77 |
* @param aContentData The encapsulated data.
|
sl@0
|
78 |
* @return The fully constructed object
|
sl@0
|
79 |
**/
|
sl@0
|
80 |
static CEncapsulatedContentInfo* NewLC(TCmsContentInfoType aContentInfoType, TBool aIsEContentDataPresent, const TDesC8& aContentData);
|
sl@0
|
81 |
|
sl@0
|
82 |
/**
|
sl@0
|
83 |
* @internalComponent
|
sl@0
|
84 |
*
|
sl@0
|
85 |
* Creates the DER sequence of the ContentInfo and leaves the DER sequence on the cleanup stack.
|
sl@0
|
86 |
* @return The ASN.1 sequence of the ContentInfo.
|
sl@0
|
87 |
**/
|
sl@0
|
88 |
CASN1EncSequence* EncodeASN1DERLC() const;
|
sl@0
|
89 |
|
sl@0
|
90 |
/**
|
sl@0
|
91 |
Provides information about the ContentType in the ContentInfo sequence.
|
sl@0
|
92 |
It returns the last number in the ObjectIdentifier.
|
sl@0
|
93 |
@return The ContentType. This is:
|
sl@0
|
94 |
|
sl@0
|
95 |
- 1 for Data
|
sl@0
|
96 |
|
sl@0
|
97 |
- 2 for SignedData
|
sl@0
|
98 |
|
sl@0
|
99 |
- 3 for EnvelopedData
|
sl@0
|
100 |
|
sl@0
|
101 |
- 5 for DigestedData
|
sl@0
|
102 |
|
sl@0
|
103 |
- 6 for EncryptedData
|
sl@0
|
104 |
*/
|
sl@0
|
105 |
IMPORT_C TCmsContentInfoType ContentType() const;
|
sl@0
|
106 |
|
sl@0
|
107 |
/**
|
sl@0
|
108 |
Returns whether the ContentInfo is present or not.
|
sl@0
|
109 |
ContentData present in EncapsulatedContentInfo is OPTIONAL.
|
sl@0
|
110 |
@return A boolean value that indicates whether or not the ContentInfo is present.
|
sl@0
|
111 |
*/
|
sl@0
|
112 |
IMPORT_C TBool IsContentDataPresent() const;
|
sl@0
|
113 |
|
sl@0
|
114 |
/**
|
sl@0
|
115 |
Provides access to the Content Data present in CMS. ContentData present
|
sl@0
|
116 |
in EncapsulatedContentInfo is OPTIONAL. The client has to check for
|
sl@0
|
117 |
data length 0 or if the data content is present in case there is no ContentData.
|
sl@0
|
118 |
@return The ContentData.
|
sl@0
|
119 |
*/
|
sl@0
|
120 |
IMPORT_C const TPtrC8 ContentData() const;
|
sl@0
|
121 |
|
sl@0
|
122 |
private:
|
sl@0
|
123 |
/*
|
sl@0
|
124 |
Constuctor and second phase constructor.
|
sl@0
|
125 |
*/
|
sl@0
|
126 |
CEncapsulatedContentInfo();
|
sl@0
|
127 |
CEncapsulatedContentInfo(TCmsContentInfoType aContentInfoType, TBool aIsEContentDataPresent, const TDesC8& aContentData);
|
sl@0
|
128 |
void ConstructL(const TDesC8& aRawData);
|
sl@0
|
129 |
|
sl@0
|
130 |
private:
|
sl@0
|
131 |
/**
|
sl@0
|
132 |
The Type of the ContentInfo
|
sl@0
|
133 |
*/
|
sl@0
|
134 |
TCmsContentInfoType iContentType;
|
sl@0
|
135 |
|
sl@0
|
136 |
/**
|
sl@0
|
137 |
Represents whether the Content is present or not.
|
sl@0
|
138 |
*/
|
sl@0
|
139 |
TBool iIsContentDataPresent;
|
sl@0
|
140 |
|
sl@0
|
141 |
/**
|
sl@0
|
142 |
The Content Data.
|
sl@0
|
143 |
*/
|
sl@0
|
144 |
TPtrC8 iContentData;
|
sl@0
|
145 |
};
|
sl@0
|
146 |
|
sl@0
|
147 |
|
sl@0
|
148 |
/**
|
sl@0
|
149 |
The RFC2630 ContentInfo entity.
|
sl@0
|
150 |
This class provides details about the content type in the ContentInfo,
|
sl@0
|
151 |
provides access to the content data when the content type is Data and
|
sl@0
|
152 |
provides access to the entire ContentInfo sequence.
|
sl@0
|
153 |
At present, only data content type and signed data type are supported.
|
sl@0
|
154 |
*/
|
sl@0
|
155 |
class CCmsContentInfo : public CBase
|
sl@0
|
156 |
{
|
sl@0
|
157 |
public:
|
sl@0
|
158 |
/**
|
sl@0
|
159 |
Creates a ContentInfo as defined in RFC2630.
|
sl@0
|
160 |
@param aRawData The encoded encapsulated data.
|
sl@0
|
161 |
@return The fully constructed object.
|
sl@0
|
162 |
*/
|
sl@0
|
163 |
IMPORT_C static CCmsContentInfo* NewL(const TDesC8& aRawData);
|
sl@0
|
164 |
/**
|
sl@0
|
165 |
Creates a ContentInfo as defined in RFC2630,
|
sl@0
|
166 |
and leaves the instance on the cleanup stack.
|
sl@0
|
167 |
@param aRawData The encoded encapsulated data.
|
sl@0
|
168 |
@return The fully constructed object.
|
sl@0
|
169 |
*/
|
sl@0
|
170 |
IMPORT_C static CCmsContentInfo* NewLC(const TDesC8& aRawData);
|
sl@0
|
171 |
|
sl@0
|
172 |
/**
|
sl@0
|
173 |
Creates a ContentInfo as defined in RFC2630.
|
sl@0
|
174 |
@param aContentInfoType The type of the encapsulated content.
|
sl@0
|
175 |
@param aContentData The encapsulated data.
|
sl@0
|
176 |
@return The fully constructed object.
|
sl@0
|
177 |
*/
|
sl@0
|
178 |
IMPORT_C static CCmsContentInfo* NewL(TCmsContentInfoType aContentInfoType, const TDesC8& aContentData);
|
sl@0
|
179 |
|
sl@0
|
180 |
/**
|
sl@0
|
181 |
Creates a ContentInfo as defined in RFC2630 and leaves the object on the cleanup stack.
|
sl@0
|
182 |
@param aContentInfoType The type of the encapsulated content.
|
sl@0
|
183 |
@param aContentData The encapsulated data.
|
sl@0
|
184 |
@return The fully constructed object.
|
sl@0
|
185 |
*/
|
sl@0
|
186 |
IMPORT_C static CCmsContentInfo* NewLC(TCmsContentInfoType aContentInfoType, const TDesC8& aContentData);
|
sl@0
|
187 |
|
sl@0
|
188 |
/**
|
sl@0
|
189 |
Creates the DER sequence of the ContentInfo and leaves the DER sequence on the cleanup stack.
|
sl@0
|
190 |
@return The ASN.1 sequence of the ContentInfo.
|
sl@0
|
191 |
*/
|
sl@0
|
192 |
IMPORT_C CASN1EncSequence* EncodeASN1DERLC() const;
|
sl@0
|
193 |
|
sl@0
|
194 |
/**
|
sl@0
|
195 |
Destructor
|
sl@0
|
196 |
*/
|
sl@0
|
197 |
IMPORT_C ~CCmsContentInfo();
|
sl@0
|
198 |
|
sl@0
|
199 |
/**
|
sl@0
|
200 |
Provides the information about the ContentType in the ContentInfo sequence.
|
sl@0
|
201 |
It returns the last number in the Object Identifier.
|
sl@0
|
202 |
@return The ContentType. This is:
|
sl@0
|
203 |
|
sl@0
|
204 |
- 1 for Data
|
sl@0
|
205 |
|
sl@0
|
206 |
- 2 for SignedData
|
sl@0
|
207 |
|
sl@0
|
208 |
- 3 for EnvelopedData
|
sl@0
|
209 |
|
sl@0
|
210 |
- 5 for DigestedData
|
sl@0
|
211 |
|
sl@0
|
212 |
- 6 for EncryptedData
|
sl@0
|
213 |
*/
|
sl@0
|
214 |
IMPORT_C TCmsContentInfoType ContentType() const;
|
sl@0
|
215 |
|
sl@0
|
216 |
/**
|
sl@0
|
217 |
Provides access to the content data.
|
sl@0
|
218 |
@return The content data.
|
sl@0
|
219 |
*/
|
sl@0
|
220 |
IMPORT_C const TPtrC8 ContentData() const;
|
sl@0
|
221 |
|
sl@0
|
222 |
|
sl@0
|
223 |
private:
|
sl@0
|
224 |
/**
|
sl@0
|
225 |
default constructor
|
sl@0
|
226 |
*/
|
sl@0
|
227 |
CCmsContentInfo();
|
sl@0
|
228 |
|
sl@0
|
229 |
/**
|
sl@0
|
230 |
constructor to build the CMS content info from the given parameters
|
sl@0
|
231 |
@param aContentInfoType the type of data contained in the CMS content info
|
sl@0
|
232 |
@param aContentData the descriptor which contains the encoded CMS oject
|
sl@0
|
233 |
*/
|
sl@0
|
234 |
CCmsContentInfo(TCmsContentInfoType aContentInfoType, const TDesC8& aContentData);
|
sl@0
|
235 |
|
sl@0
|
236 |
/**
|
sl@0
|
237 |
constructor to build the CMS content info from the raw data.
|
sl@0
|
238 |
@param aContentInfoType the type of data contained in the CMS content info
|
sl@0
|
239 |
@param aContentData the descriptor which contains the encoded CMS oject
|
sl@0
|
240 |
*/
|
sl@0
|
241 |
void ConstructL(const TDesC8& aRawData);
|
sl@0
|
242 |
|
sl@0
|
243 |
private:
|
sl@0
|
244 |
/**
|
sl@0
|
245 |
The Type of the ContentInfo
|
sl@0
|
246 |
*/
|
sl@0
|
247 |
TCmsContentInfoType iContentType;
|
sl@0
|
248 |
|
sl@0
|
249 |
/**
|
sl@0
|
250 |
The Content Data
|
sl@0
|
251 |
*/
|
sl@0
|
252 |
TPtrC8 iContentData;
|
sl@0
|
253 |
};
|
sl@0
|
254 |
|
sl@0
|
255 |
#endif // CMSCONTENTINFO_H
|
sl@0
|
256 |
|