sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-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 __PKCS12_SAFE_BAG_H__
|
sl@0
|
26 |
#define __PKCS12_SAFE_BAG_H__
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <asn1dec.h>
|
sl@0
|
29 |
#include <pkcs12attribute.h>
|
sl@0
|
30 |
|
sl@0
|
31 |
namespace PKCS12
|
sl@0
|
32 |
{
|
sl@0
|
33 |
class CDecPkcs12Attribute;
|
sl@0
|
34 |
|
sl@0
|
35 |
/**
|
sl@0
|
36 |
This class is the base class for all the bags and decodes the SafeBag.
|
sl@0
|
37 |
SafeBag has BagId, BagValue, and BagAttributes.
|
sl@0
|
38 |
|
sl@0
|
39 |
BagId's are in the form of an Object Identifiers
|
sl@0
|
40 |
OID ---- 1.2.840.113549.1.12.10.1.1 keybag
|
sl@0
|
41 |
OID ---- 1.2.840.113549.1.12.10.1.2 shroudedKeyBag
|
sl@0
|
42 |
OID ---- 1.2.840.113549.1.12.10.1.3 certBag
|
sl@0
|
43 |
OID ---- 1.2.840.113549.1.12.10.1.4 crlBag
|
sl@0
|
44 |
OID ---- 1.2.840.113549.1.12.10.1.5 SecretBag
|
sl@0
|
45 |
OID ---- 1.2.840.113549.1.12.10.1.6 SafeContentsBag
|
sl@0
|
46 |
**/
|
sl@0
|
47 |
class CDecPkcs12SafeBag : public CBase
|
sl@0
|
48 |
{
|
sl@0
|
49 |
public:
|
sl@0
|
50 |
enum TBagId
|
sl@0
|
51 |
/**
|
sl@0
|
52 |
Identifies the type of Bag present in the PKCS#12 safeBag structure.
|
sl@0
|
53 |
*/
|
sl@0
|
54 |
{
|
sl@0
|
55 |
/** The numeric value of last element in the PKCS#12 KeyBag OID */
|
sl@0
|
56 |
EKeyBag = 1,
|
sl@0
|
57 |
|
sl@0
|
58 |
/** The numeric value of last element in the PKCS#12 ShroudedKeyBag OID */
|
sl@0
|
59 |
EShroudedKeyBag,
|
sl@0
|
60 |
|
sl@0
|
61 |
/** The numeric value of last element in the PKCS#12 CertBag OID */
|
sl@0
|
62 |
ECertBag,
|
sl@0
|
63 |
|
sl@0
|
64 |
/** The numeric value of last element in the PKCS#12 CRLBag OID */
|
sl@0
|
65 |
ECrlBag,
|
sl@0
|
66 |
|
sl@0
|
67 |
/** The numeric value of last element in the PKCS#12 SecretBag OID */
|
sl@0
|
68 |
ESecretBag,
|
sl@0
|
69 |
|
sl@0
|
70 |
/** The numeric value of last element in the PKCS#12 SafeContentsBag OID */
|
sl@0
|
71 |
ESafeContentsBag
|
sl@0
|
72 |
};
|
sl@0
|
73 |
/**
|
sl@0
|
74 |
Creates a new PKCS#12SafeBag object.
|
sl@0
|
75 |
|
sl@0
|
76 |
@param aSafeBagData contains a PKCS#12 SafeBag Structure
|
sl@0
|
77 |
@return A pointer to the newly allocated object.
|
sl@0
|
78 |
@leave KErrArgument if the data is not Pkcs12 safeBag structure.
|
sl@0
|
79 |
*/
|
sl@0
|
80 |
IMPORT_C static CDecPkcs12SafeBag* NewL(const TDesC8& aSafeBagData);
|
sl@0
|
81 |
|
sl@0
|
82 |
/**
|
sl@0
|
83 |
The BagId present in the SafeBag.
|
sl@0
|
84 |
BagID is an ObjectIdentifier which identifies the Type of bag present
|
sl@0
|
85 |
inside the SafeBag.
|
sl@0
|
86 |
@return BagID present within the SafeBag
|
sl@0
|
87 |
*/
|
sl@0
|
88 |
IMPORT_C TBagId BagID() const ;
|
sl@0
|
89 |
|
sl@0
|
90 |
/**
|
sl@0
|
91 |
This method returns the BagValue present in the Safe Bag.
|
sl@0
|
92 |
@return BagValue present within the SafeBag
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
IMPORT_C const TDesC8& BagValue() const ;
|
sl@0
|
95 |
|
sl@0
|
96 |
/**
|
sl@0
|
97 |
This method returns an array of BagAttributes.
|
sl@0
|
98 |
BagAttributes is an Optional field. It allows users to assign nicknames
|
sl@0
|
99 |
and identifiers to keys, etc., and permits visual tools to display
|
sl@0
|
100 |
meaningful strings of some sort to the user.
|
sl@0
|
101 |
@return an array of BagAttributes present within the SafeBag.
|
sl@0
|
102 |
@see CDecPkcs12Attribute
|
sl@0
|
103 |
*/
|
sl@0
|
104 |
IMPORT_C const RPointerArray<CDecPkcs12Attribute>& BagAttributes() const ;
|
sl@0
|
105 |
|
sl@0
|
106 |
/**
|
sl@0
|
107 |
Destructor.
|
sl@0
|
108 |
*/
|
sl@0
|
109 |
IMPORT_C ~CDecPkcs12SafeBag();
|
sl@0
|
110 |
|
sl@0
|
111 |
protected:
|
sl@0
|
112 |
/**
|
sl@0
|
113 |
* @internalComponent
|
sl@0
|
114 |
*
|
sl@0
|
115 |
* This decodes the entire safeBag structure.
|
sl@0
|
116 |
* @param aRawData contains a PKCS#12 safeBag Structure.
|
sl@0
|
117 |
* @leave KErrArgument if the data is not Pkcs12 safeBag structure.
|
sl@0
|
118 |
* @see CDecPkcs12Attribute
|
sl@0
|
119 |
**/
|
sl@0
|
120 |
void ConstructL(const TDesC8& aRawData);
|
sl@0
|
121 |
|
sl@0
|
122 |
/**
|
sl@0
|
123 |
* @internalComponent
|
sl@0
|
124 |
*
|
sl@0
|
125 |
* Constructor.
|
sl@0
|
126 |
**/
|
sl@0
|
127 |
CDecPkcs12SafeBag();
|
sl@0
|
128 |
|
sl@0
|
129 |
/**
|
sl@0
|
130 |
* @internalComponent
|
sl@0
|
131 |
*
|
sl@0
|
132 |
* Copy Constructor.
|
sl@0
|
133 |
* @param aDecPkcs12safeBag A CDecPkcs12SafeBag object.
|
sl@0
|
134 |
**/
|
sl@0
|
135 |
CDecPkcs12SafeBag(const CDecPkcs12SafeBag& aDecPkcs12safeBag);
|
sl@0
|
136 |
|
sl@0
|
137 |
/**
|
sl@0
|
138 |
* @internalComponent
|
sl@0
|
139 |
*
|
sl@0
|
140 |
* Assignment operator.
|
sl@0
|
141 |
* @param aDecPkcs12safeBag A CDecPkcs12SafeBag object.
|
sl@0
|
142 |
* @return A reference to CDecPkcs12SafeBag class.
|
sl@0
|
143 |
**/
|
sl@0
|
144 |
CDecPkcs12SafeBag& operator=(const CDecPkcs12SafeBag& aDecPkcs12safeBag);
|
sl@0
|
145 |
|
sl@0
|
146 |
protected:
|
sl@0
|
147 |
/** Contains the BagId. That is ObjectIdentifier for SafeContents Bag */
|
sl@0
|
148 |
TBagId iBagId;
|
sl@0
|
149 |
|
sl@0
|
150 |
/** Contains the BagValue */
|
sl@0
|
151 |
TPtrC8 iBagValue;
|
sl@0
|
152 |
|
sl@0
|
153 |
/* contains the BagAttributes */
|
sl@0
|
154 |
RPointerArray <CDecPkcs12Attribute> iBagAttributes;
|
sl@0
|
155 |
};
|
sl@0
|
156 |
} // namespace PKCS12
|
sl@0
|
157 |
#endif // __PKCS12_SAFE_BAG_H__
|