|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Symbian specific X509.v3 certificate extensions that constrain the |
|
16 * the devices, secure ids, vendor ids and capabilities for which |
|
17 * a software install signing certificate is valid. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @file |
|
26 @internalTechnology |
|
27 */ |
|
28 |
|
29 #ifndef __X509CONSTRAINTEXT_H__ |
|
30 #define __X509CONSTRAINTEXT_H__ |
|
31 |
|
32 #include <e32base.h> |
|
33 #include <x509certext.h> |
|
34 |
|
35 class CX509IntListExt : public CX509ExtensionBase |
|
36 /** |
|
37 A Symbian specific X.509 v3 certificate extension that contains an arbitrary |
|
38 list of 32 bit integers. |
|
39 |
|
40 @internalTechnology |
|
41 @released |
|
42 */ |
|
43 { |
|
44 public: |
|
45 /** |
|
46 Creates a new CX509IntListExt object from the binary (DER) encoded |
|
47 representation of a sequence of integers. |
|
48 |
|
49 @param aBinaryData The encoded binary representation. |
|
50 @return The new CX509IntListExt object. |
|
51 */ |
|
52 IMPORT_C static CX509IntListExt* NewL(const TDesC8& aBinaryData); |
|
53 |
|
54 /** |
|
55 Creates a new CX509IntListExt object from the binary (DER) encoded |
|
56 representation of a sequence of integers, and puts a pointer to it |
|
57 onto the cleanup stack. |
|
58 |
|
59 @param aBinaryData The encoded binary representation. |
|
60 @return The new CX509IntListExt object. |
|
61 */ |
|
62 IMPORT_C static CX509IntListExt* NewLC(const TDesC8& aBinaryData); |
|
63 |
|
64 /** |
|
65 Destructor. |
|
66 Frees all resources owned by the object. |
|
67 */ |
|
68 ~CX509IntListExt(); |
|
69 |
|
70 /** |
|
71 Gets a reference to the array of decoded integers. |
|
72 Ownership is not transferred. |
|
73 @return A reference to the array of decoded integers. |
|
74 */ |
|
75 IMPORT_C const RArray<TInt>& IntArray() const; |
|
76 |
|
77 protected: |
|
78 /** Second-phase constructor. |
|
79 * |
|
80 * @param aBinaryData The encoded binary representation. |
|
81 * @param aPos The position from which to start decoding. */ |
|
82 void ConstructL(const TDesC8& aBinaryData, TInt& aPos); |
|
83 |
|
84 /** |
|
85 Decodes the binary representation of a sequence of integers. |
|
86 |
|
87 @param aBinaryData The encoded binary representation. This is the same as |
|
88 passed to ConstructL(). |
|
89 @param aPos The position from which to start decoding. Note that |
|
90 the value passed points, in effect, to the content, |
|
91 bypassing the header data. |
|
92 */ |
|
93 void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); |
|
94 |
|
95 private: |
|
96 /** The decoded array of integers. */ |
|
97 RArray<TInt> iIntArray; |
|
98 }; |
|
99 |
|
100 class CX509Utf8StringListExt : public CX509ExtensionBase |
|
101 /** |
|
102 A Symbian specific X.509 v3 certificate extension that contains an arbitrary |
|
103 list of UTF-8 strings. |
|
104 |
|
105 @internalTechnology |
|
106 @released |
|
107 */ |
|
108 { |
|
109 public: |
|
110 /** |
|
111 Creates a new CX509Utf8StringListExt object from the binary (DER) encoded |
|
112 representation of a sequence of integers. |
|
113 |
|
114 @param aBinaryData The encoded binary representation. |
|
115 @return The new CX509Utf8StringListExt object. |
|
116 */ |
|
117 IMPORT_C static CX509Utf8StringListExt* NewL(const TDesC8& aBinaryData); |
|
118 |
|
119 /** |
|
120 Creates a new CX509Utf8StringListExt object from the binary (DER) encoded |
|
121 representation of a sequence of integers, and puts a pointer to it |
|
122 onto the cleanup stack. |
|
123 |
|
124 @param aBinaryData The encoded binary representation. |
|
125 @return The new CX509Utf8StringListExt object. |
|
126 */ |
|
127 IMPORT_C static CX509Utf8StringListExt* NewLC(const TDesC8& aBinaryData); |
|
128 |
|
129 /** |
|
130 Destructor. |
|
131 Frees all resources owned by the object. |
|
132 */ |
|
133 ~CX509Utf8StringListExt(); |
|
134 |
|
135 /** |
|
136 Gets a reference to the array of decoded strings (UTF-16). |
|
137 Ownership is not transferred. |
|
138 @return A reference to the array of decoded strings in UTF-16. |
|
139 */ |
|
140 IMPORT_C const RPointerArray<HBufC>& StringArray() const; |
|
141 |
|
142 protected: |
|
143 /** Second-phase constructor. |
|
144 @param aBinaryData The encoded binary representation. |
|
145 @param aPos The position from which to start decoding. |
|
146 */ |
|
147 void ConstructL(const TDesC8& aBinaryData, TInt& aPos); |
|
148 |
|
149 /** |
|
150 Decodes the binary representation of a sequence of UTF-8 strings. The |
|
151 strings are converted and stored internal as UTF-8. |
|
152 |
|
153 @param aBinaryData The encoded binary representation. This is the same as |
|
154 passed to ConstructL(). |
|
155 @param aPos The position from which to start decoding. Note that |
|
156 the value passed points, in effect, to the content, |
|
157 bypassing the header data. |
|
158 */ |
|
159 void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); |
|
160 |
|
161 private: |
|
162 /** The decoded array of strings in UTF-16. */ |
|
163 RPointerArray<HBufC> iStringArray; |
|
164 }; |
|
165 |
|
166 /** |
|
167 A Symbian specific X.509 v3 certificate extension that contains a capability |
|
168 set encoded as a bit string. |
|
169 |
|
170 @internalTechnology |
|
171 @released |
|
172 */ |
|
173 class CX509CapabilitySetExt : public CX509ExtensionBase |
|
174 { |
|
175 public: |
|
176 /** |
|
177 Creates a new CX509CapabilitySetExt object from the binary (DER) encoded |
|
178 representation of a sequence of integers. |
|
179 |
|
180 @param aBinaryData The encoded binary representation. |
|
181 @return The new CX509CapabilitySetExt object. |
|
182 */ |
|
183 IMPORT_C static CX509CapabilitySetExt* NewL(const TDesC8& aBinaryData); |
|
184 |
|
185 /** |
|
186 Creates a new CX509CapabilitySetExt object from the binary (DER) encoded |
|
187 representation of a sequence of integers, and puts a pointer to it |
|
188 onto the cleanup stack. |
|
189 |
|
190 @param aBinaryData The encoded binary representation. |
|
191 @return The new CX509CapabilitySetExt object. |
|
192 */ |
|
193 IMPORT_C static CX509CapabilitySetExt* NewLC(const TDesC8& aBinaryData); |
|
194 |
|
195 /** |
|
196 Destructor. |
|
197 Frees all resources owned by the object. |
|
198 */ |
|
199 ~CX509CapabilitySetExt(); |
|
200 |
|
201 /** Gets a reference to the capability set. |
|
202 @return the capability set represented by the bit string. |
|
203 */ |
|
204 IMPORT_C const TCapabilitySet& CapabilitySet() const; |
|
205 |
|
206 protected: |
|
207 /** Second-phase constructor. |
|
208 |
|
209 @param aBinaryData The encoded binary representation. |
|
210 @param aPos The position from which to start decoding. |
|
211 */ |
|
212 void ConstructL(const TDesC8& aBinaryData, TInt& aPos); |
|
213 |
|
214 /** |
|
215 Constructs the a TCapabilitySet from a DER encoded bit string. |
|
216 |
|
217 @param aBinaryData The encoded binary representation. This is the same as |
|
218 passed to ConstructL(). |
|
219 @param aPos The position from which to start decoding. Note that |
|
220 the value passed points, in effect, to the content, |
|
221 bypassing the header data. |
|
222 */ |
|
223 void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); |
|
224 |
|
225 private: |
|
226 /** The decoded capability set */ |
|
227 TCapabilitySet iCapabilitySet; |
|
228 }; |
|
229 |
|
230 #endif |