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 __PKCS7_CONTENT_INFO_V2_H__
|
sl@0
|
26 |
#define __PKCS7_CONTENT_INFO_V2_H__
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <asn1dec.h>
|
sl@0
|
29 |
|
sl@0
|
30 |
/** pkcs7-1 data */
|
sl@0
|
31 |
_LIT(KPkcs7DataOID, "1.2.840.113549.1.7.1");
|
sl@0
|
32 |
|
sl@0
|
33 |
/** pkcs7-2 SignedData */
|
sl@0
|
34 |
_LIT(KPkcs7SignedDataOID, "1.2.840.113549.1.7.2");
|
sl@0
|
35 |
|
sl@0
|
36 |
/** pkcs7-3 EnvelopedData */
|
sl@0
|
37 |
_LIT(KPkcs7EnvelopedDataOID, "1.2.840.113549.1.7.3");
|
sl@0
|
38 |
|
sl@0
|
39 |
/** pkcs7-4 SignedAndEnvelopedData */
|
sl@0
|
40 |
_LIT(KPkcs7SignedAndEnvelopedDataOID, "1.2.840.113549.1.7.4");
|
sl@0
|
41 |
|
sl@0
|
42 |
/** pkcs7-5 DigestedData */
|
sl@0
|
43 |
_LIT(KPkcs7DigestedDataOID, "1.2.840.113549.1.7.5");
|
sl@0
|
44 |
|
sl@0
|
45 |
/** pkcs7-6 EncryptedData */
|
sl@0
|
46 |
_LIT(KPkcs7EncryptedDataOID, "1.2.840.113549.1.7.6");
|
sl@0
|
47 |
|
sl@0
|
48 |
/** The numeric value of last element in the PKCS7 Data OID */
|
sl@0
|
49 |
const TInt KPkcs7Data = 1;
|
sl@0
|
50 |
|
sl@0
|
51 |
/** The numeric value of last element in the PKCS7 Signed OID */
|
sl@0
|
52 |
const TInt KPkcs7SignedData = 2;
|
sl@0
|
53 |
|
sl@0
|
54 |
/**
|
sl@0
|
55 |
The RFC2315 ContentInfo entity
|
sl@0
|
56 |
This class provides details about the Content Type in the Content Info,
|
sl@0
|
57 |
Provides access to the Content Data when the Content Type is Data and
|
sl@0
|
58 |
provides access to the Entire ContentInfo Sequence.
|
sl@0
|
59 |
*/
|
sl@0
|
60 |
class CPKCS7ContentInfo : public CBase
|
sl@0
|
61 |
{
|
sl@0
|
62 |
public:
|
sl@0
|
63 |
/**
|
sl@0
|
64 |
Identifies the type of Content Type present in the PKCS7 ContentInfo Structure.
|
sl@0
|
65 |
*/
|
sl@0
|
66 |
enum TContentInfoType
|
sl@0
|
67 |
{
|
sl@0
|
68 |
/** The numeric value of last element in the PKCS7 ContentType Data OID */
|
sl@0
|
69 |
EContentTypeData = 1,
|
sl@0
|
70 |
/** The numeric value of last element in the PKCS7 ContentType SignedData OID */
|
sl@0
|
71 |
EContentTypeSignedData,
|
sl@0
|
72 |
/** The numeric value of last element in the PKCS7 ContentType EnvelopedData OID */
|
sl@0
|
73 |
EContentTypeEnvelopedData,
|
sl@0
|
74 |
/** The numeric value of last element in the PKCS7 ContentType SignedAndEnvelopedData OID */
|
sl@0
|
75 |
EContentTypeSignedAndEnvelopedData,
|
sl@0
|
76 |
/** The numeric value of last element in the PKCS7 ContentType DigestedData OID */
|
sl@0
|
77 |
EContentTypeDigestedData,
|
sl@0
|
78 |
/** The numeric value of last element in the PKCS7 ContentType EncryptedData OID */
|
sl@0
|
79 |
EContentTypeEncryptedData
|
sl@0
|
80 |
};
|
sl@0
|
81 |
/**
|
sl@0
|
82 |
Creates a new PKCS#7 ContentInfo object.
|
sl@0
|
83 |
@param aRawData contains a PKCS#7 ContentInfo Structure
|
sl@0
|
84 |
@return A pointer to the newly allocated object.
|
sl@0
|
85 |
@leave KErrNotSupported if the OID value is otherthan enum TContentInfoType.
|
sl@0
|
86 |
@leave KErrArgument if the data is not PKCS7 contentInfo structure.
|
sl@0
|
87 |
@see TContentInfoType
|
sl@0
|
88 |
*/
|
sl@0
|
89 |
IMPORT_C static CPKCS7ContentInfo* NewL(const TDesC8& aRawData);
|
sl@0
|
90 |
|
sl@0
|
91 |
/**
|
sl@0
|
92 |
Destructor.
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
virtual ~CPKCS7ContentInfo();
|
sl@0
|
95 |
|
sl@0
|
96 |
public:
|
sl@0
|
97 |
/**
|
sl@0
|
98 |
Provides the information about the ContentType in the
|
sl@0
|
99 |
ContentInfo Sequence.
|
sl@0
|
100 |
It returns the last number in the ObjectIdentifier
|
sl@0
|
101 |
@return The ContentType. This is
|
sl@0
|
102 |
1 for Data
|
sl@0
|
103 |
2 for SignedData
|
sl@0
|
104 |
3 for EnvelopedData
|
sl@0
|
105 |
4 for SignedAndEnvelopedData
|
sl@0
|
106 |
5 for DigestedData
|
sl@0
|
107 |
6 for EncryptedData
|
sl@0
|
108 |
*/
|
sl@0
|
109 |
IMPORT_C TContentInfoType ContentType() const;
|
sl@0
|
110 |
|
sl@0
|
111 |
/**
|
sl@0
|
112 |
Provides access to the Content Data present in PKCS#7 ContentInfo
|
sl@0
|
113 |
ContentData present in PKCS#7 ContentInfo is OPTIONAL
|
sl@0
|
114 |
The client has to check for data length 0 in case there is no ContentData.
|
sl@0
|
115 |
@return The ContentData
|
sl@0
|
116 |
*/
|
sl@0
|
117 |
IMPORT_C const TPtrC8 ContentData() const;
|
sl@0
|
118 |
|
sl@0
|
119 |
private:
|
sl@0
|
120 |
/**
|
sl@0
|
121 |
Constructor.
|
sl@0
|
122 |
*/
|
sl@0
|
123 |
CPKCS7ContentInfo(void);
|
sl@0
|
124 |
|
sl@0
|
125 |
/**
|
sl@0
|
126 |
Copy Constructor.
|
sl@0
|
127 |
@param aContentinfo A CPKCS7ContentInfo object.
|
sl@0
|
128 |
*/
|
sl@0
|
129 |
CPKCS7ContentInfo(const CPKCS7ContentInfo& aContentInfo);
|
sl@0
|
130 |
|
sl@0
|
131 |
/**
|
sl@0
|
132 |
Assignment operator.
|
sl@0
|
133 |
@param aContentinfo A CPKCS7ContentInfo object.
|
sl@0
|
134 |
@return A reference to CPKCS7ContentInfo class.
|
sl@0
|
135 |
*/
|
sl@0
|
136 |
CPKCS7ContentInfo& operator=(const CPKCS7ContentInfo& aContentInfo);
|
sl@0
|
137 |
|
sl@0
|
138 |
/**
|
sl@0
|
139 |
Decodes the PKCS#7 ContentInfo object.
|
sl@0
|
140 |
@param aRawData contains a PKCS#7 ContentInfo Structure.
|
sl@0
|
141 |
@leave KErrNotSupported if the OID val is otherthan 1 - 6
|
sl@0
|
142 |
i,e the last part of the OID.
|
sl@0
|
143 |
@leave KErrArgument if the data is not PKCS7 contentInfo structure.
|
sl@0
|
144 |
@ see TASN1DecObjectIdentifier,
|
sl@0
|
145 |
*/
|
sl@0
|
146 |
void ConstructL(const TDesC8& aRawData);
|
sl@0
|
147 |
|
sl@0
|
148 |
private:
|
sl@0
|
149 |
/**
|
sl@0
|
150 |
Indicates the type of content. Here it is the last Character
|
sl@0
|
151 |
in the OID which identifies the Content Type.
|
sl@0
|
152 |
*/
|
sl@0
|
153 |
TContentInfoType iContentType;
|
sl@0
|
154 |
|
sl@0
|
155 |
/** The ContentData present in PKCS7 ContentInfo*/
|
sl@0
|
156 |
TPtrC8 iContentData;
|
sl@0
|
157 |
};
|
sl@0
|
158 |
|
sl@0
|
159 |
#endif // __PKCS7_CONTENT_INFO_V2_H__
|
sl@0
|
160 |
|
sl@0
|
161 |
|