sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1998-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 |
* X509 general name class
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
@file
|
sl@0
|
22 |
@publishedAll
|
sl@0
|
23 |
@released
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
#ifndef __X509GN_H__
|
sl@0
|
27 |
#define __X509GN_H__
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <e32std.h>
|
sl@0
|
30 |
#include <badesca.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
/** A general name type.
|
sl@0
|
33 |
*
|
sl@0
|
34 |
* @publishedAll
|
sl@0
|
35 |
* @released
|
sl@0
|
36 |
*/
|
sl@0
|
37 |
typedef TUint TGNType;
|
sl@0
|
38 |
|
sl@0
|
39 |
/**
|
sl@0
|
40 |
* @publishedAll
|
sl@0
|
41 |
* @released
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
enum
|
sl@0
|
44 |
{
|
sl@0
|
45 |
EX509RFC822Name = 1,
|
sl@0
|
46 |
EX509DNSName = 2,
|
sl@0
|
47 |
EX509DirectoryName = 4,
|
sl@0
|
48 |
EX509URI = 6,
|
sl@0
|
49 |
EX509IPAddress = 7
|
sl@0
|
50 |
};
|
sl@0
|
51 |
//specific name forms we support...
|
sl@0
|
52 |
//we should probably put these in a file of their own,
|
sl@0
|
53 |
//but they can stay here for now
|
sl@0
|
54 |
|
sl@0
|
55 |
//superclass
|
sl@0
|
56 |
|
sl@0
|
57 |
class CX509DomainName : public CBase
|
sl@0
|
58 |
/** An X.509 domain name.
|
sl@0
|
59 |
*
|
sl@0
|
60 |
* Base class for email address and DNS names.
|
sl@0
|
61 |
*
|
sl@0
|
62 |
* @publishedAll
|
sl@0
|
63 |
* @released
|
sl@0
|
64 |
* @since v6.0 */
|
sl@0
|
65 |
{
|
sl@0
|
66 |
public:
|
sl@0
|
67 |
/** Destructor.
|
sl@0
|
68 |
*
|
sl@0
|
69 |
* Frees all resources owned by the object, prior to its destruction. */
|
sl@0
|
70 |
IMPORT_C ~CX509DomainName();
|
sl@0
|
71 |
|
sl@0
|
72 |
/** Tests whether every sub domain in the specified domain name is the same as
|
sl@0
|
73 |
* the corresponding sub domain in this object, starting at the end.
|
sl@0
|
74 |
*
|
sl@0
|
75 |
* For example, 'john.doe@symbian.com' is within the subtree 'symbian.com' but
|
sl@0
|
76 |
* is not within the subtree 'john' or 'symbian'.
|
sl@0
|
77 |
*
|
sl@0
|
78 |
* @param aName The domain name.
|
sl@0
|
79 |
* @return ETrue, if every sub domain in the specified domain name is the same
|
sl@0
|
80 |
as the corresponding sub domain in this object; EFalse, otherwise. */
|
sl@0
|
81 |
IMPORT_C TBool IsWithinSubtree(const CX509DomainName& aName) const;
|
sl@0
|
82 |
|
sl@0
|
83 |
/** Gets the full domain name.
|
sl@0
|
84 |
*
|
sl@0
|
85 |
* @return A pointer descriptor representing the full domain name. */
|
sl@0
|
86 |
IMPORT_C TPtrC Name() const;
|
sl@0
|
87 |
protected:
|
sl@0
|
88 |
/** Adds a domain by its subdomains to an array of pointer descriptors.
|
sl@0
|
89 |
*
|
sl@0
|
90 |
* @param aPos The position within the domain name.
|
sl@0
|
91 |
* @return ETrue if the domain has been added; EFalse, otherwise.
|
sl@0
|
92 |
* @internalAll
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
TBool AddDomainL(TInt& aPos);
|
sl@0
|
95 |
|
sl@0
|
96 |
/** Adds a subdomain to an array of pointer descriptors.
|
sl@0
|
97 |
*
|
sl@0
|
98 |
* @param aPos The position within the domain name.
|
sl@0
|
99 |
* @return ETrue if the subdomain has been added; EFalse, otherwise.
|
sl@0
|
100 |
* @internalAll
|
sl@0
|
101 |
*/
|
sl@0
|
102 |
TBool AddSubdomainL(TInt& aPos);
|
sl@0
|
103 |
|
sl@0
|
104 |
/** Adds a subdomain separator after each subdomain entry in an array of pointer
|
sl@0
|
105 |
* descriptors that represent the subdomains of the domain name.
|
sl@0
|
106 |
*
|
sl@0
|
107 |
* @param aPos The position within the domain name.
|
sl@0
|
108 |
* @return ETrue if the subdomain separator has been added; EFalse, otherwise.
|
sl@0
|
109 |
* @internalAll
|
sl@0
|
110 |
*/
|
sl@0
|
111 |
TBool AddSubdomainSeparatorL(TInt& aPos);
|
sl@0
|
112 |
|
sl@0
|
113 |
/** Validates a string.
|
sl@0
|
114 |
*
|
sl@0
|
115 |
* @param aStr The string to be verified.
|
sl@0
|
116 |
* @return ETrue if the string is valid; EFalse, otherwise.*/
|
sl@0
|
117 |
virtual TBool IsValidString(const TDesC& aStr) const;
|
sl@0
|
118 |
|
sl@0
|
119 |
/** Validates a character.
|
sl@0
|
120 |
*
|
sl@0
|
121 |
* @param aChar The character to be validated.
|
sl@0
|
122 |
* @return ETrue if the character is valid; EFalse, otherwise. */
|
sl@0
|
123 |
virtual TBool IsValidChar(const TChar& aChar) const;
|
sl@0
|
124 |
|
sl@0
|
125 |
/** Tests whether a character is a letter or a numeral.
|
sl@0
|
126 |
*
|
sl@0
|
127 |
* @param aChar The character to be tested.
|
sl@0
|
128 |
* @return ETrue if the character is a letter or a numeral; EFalse, otherwise.
|
sl@0
|
129 |
* @internalAll
|
sl@0
|
130 |
*/
|
sl@0
|
131 |
TBool IsAlphaOrNum(const TChar& aChar) const;
|
sl@0
|
132 |
|
sl@0
|
133 |
/** Tests whether the character is a letter.
|
sl@0
|
134 |
*
|
sl@0
|
135 |
* @param aChar The character to be tested.
|
sl@0
|
136 |
* @return ETrue if the character is a letter; EFalse, otherwise.
|
sl@0
|
137 |
* @internalAll
|
sl@0
|
138 |
*/
|
sl@0
|
139 |
TBool IsAlpha(const TChar& aChar) const;
|
sl@0
|
140 |
|
sl@0
|
141 |
/** Default constructor.
|
sl@0
|
142 |
* @internalAll
|
sl@0
|
143 |
*/
|
sl@0
|
144 |
CX509DomainName();
|
sl@0
|
145 |
protected:
|
sl@0
|
146 |
/** An array of pointer descriptors representing the subdomains of the DSN name. */
|
sl@0
|
147 |
RArray<TPtrC> iRep;
|
sl@0
|
148 |
/** A heap descriptor representing the full domain name. */
|
sl@0
|
149 |
HBufC* iName;
|
sl@0
|
150 |
};
|
sl@0
|
151 |
|
sl@0
|
152 |
//rfc822 email address has the form localpart@domain
|
sl@0
|
153 |
|
sl@0
|
154 |
class CX509RFC822NameSubtree : public CX509DomainName
|
sl@0
|
155 |
/** A full or partial RFC 822 email address.
|
sl@0
|
156 |
*
|
sl@0
|
157 |
* The address may not contain the local host name as this is optional.
|
sl@0
|
158 |
*
|
sl@0
|
159 |
* The object is initialised with 8-bit encoded binary data, which is parsed
|
sl@0
|
160 |
* into a series of sub domains and an optional local host.
|
sl@0
|
161 |
*
|
sl@0
|
162 |
* @publishedAll
|
sl@0
|
163 |
* @released */
|
sl@0
|
164 |
{
|
sl@0
|
165 |
public:
|
sl@0
|
166 |
/** Creates an RFC 822 email address object from the specified buffer containing
|
sl@0
|
167 |
* the binary coded representation.
|
sl@0
|
168 |
*
|
sl@0
|
169 |
* The data is parsed into a series of sub domains and an optional local host.
|
sl@0
|
170 |
*
|
sl@0
|
171 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
172 |
* @return The new RFC 822 email address object. */
|
sl@0
|
173 |
IMPORT_C static CX509RFC822NameSubtree* NewL(const TDesC8& aBinaryData);
|
sl@0
|
174 |
|
sl@0
|
175 |
/** Creates an RFC 822 email address object from the specified buffer containing
|
sl@0
|
176 |
* the binary coded representation, and puts a pointer to it onto the cleanup stack.
|
sl@0
|
177 |
* The data is parsed into a series of sub domains and an optional local host.
|
sl@0
|
178 |
*
|
sl@0
|
179 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
180 |
* @return The new RFC 822 email address object. */
|
sl@0
|
181 |
IMPORT_C static CX509RFC822NameSubtree* NewLC(const TDesC8& aBinaryData);
|
sl@0
|
182 |
|
sl@0
|
183 |
/** Gets a reference to the array of pointer descriptors representing the subdomains
|
sl@0
|
184 |
* of the RFC 822 email address.
|
sl@0
|
185 |
*
|
sl@0
|
186 |
* @return The array of pointer descriptors. */
|
sl@0
|
187 |
IMPORT_C const RArray<TPtrC>& Rep() const;
|
sl@0
|
188 |
|
sl@0
|
189 |
protected:
|
sl@0
|
190 |
/** Second-phase constructor.
|
sl@0
|
191 |
*
|
sl@0
|
192 |
* @param aBinaryData The encoded binary representation. */
|
sl@0
|
193 |
virtual void ConstructL(const TDesC8& aBinaryData);
|
sl@0
|
194 |
|
sl@0
|
195 |
/** Adds a local host.
|
sl@0
|
196 |
*
|
sl@0
|
197 |
* @param aPos The position from which to start decoding.
|
sl@0
|
198 |
* @return ETrue, if the host has been found and added; EFalse, otherwise.
|
sl@0
|
199 |
* @internalAll
|
sl@0
|
200 |
*/
|
sl@0
|
201 |
TBool AddLocalHostL(TInt& aPos);
|
sl@0
|
202 |
|
sl@0
|
203 |
/** Tests whether the character is valid.
|
sl@0
|
204 |
*
|
sl@0
|
205 |
* @param aChar The character to be tested.
|
sl@0
|
206 |
* @return ETrue, if the character is valid; EFalse, otherwise.
|
sl@0
|
207 |
* @internalAll
|
sl@0
|
208 |
*/
|
sl@0
|
209 |
TBool IsValidChar(const TChar& aChar) const;
|
sl@0
|
210 |
};
|
sl@0
|
211 |
|
sl@0
|
212 |
class CX509RFC822Name : public CX509RFC822NameSubtree
|
sl@0
|
213 |
/** A full RFC 822 email address.
|
sl@0
|
214 |
*
|
sl@0
|
215 |
* Exactly as subtree, but requires local host and full domain name.
|
sl@0
|
216 |
*
|
sl@0
|
217 |
* @publishedAll
|
sl@0
|
218 |
* @released */
|
sl@0
|
219 |
{
|
sl@0
|
220 |
public:
|
sl@0
|
221 |
/** Creates a full RFC 822 email address object from the specified buffer containing
|
sl@0
|
222 |
* the binary coded representation.
|
sl@0
|
223 |
*
|
sl@0
|
224 |
* The data is parsed into a series of sub domains.
|
sl@0
|
225 |
*
|
sl@0
|
226 |
* The data must represent a full RFC 822 email address, otherwise this function leaves.
|
sl@0
|
227 |
*
|
sl@0
|
228 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
229 |
* @return The new full RFC 822 email address object. */
|
sl@0
|
230 |
IMPORT_C static CX509RFC822Name* NewL(const TDesC8& aBinaryData);
|
sl@0
|
231 |
|
sl@0
|
232 |
/** Creates a full RFC 822 email address object from the specified buffer containing
|
sl@0
|
233 |
* the binary coded representation, and puts a pointer to it onto the cleanup stack.
|
sl@0
|
234 |
*
|
sl@0
|
235 |
* The data is parsed into a series of sub domains.
|
sl@0
|
236 |
*
|
sl@0
|
237 |
* The data must represent a full RFC 822 email address, otherwise this function leaves.
|
sl@0
|
238 |
*
|
sl@0
|
239 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
240 |
* @return The new full RFC 822 email address object. */
|
sl@0
|
241 |
IMPORT_C static CX509RFC822Name* NewLC(const TDesC8& aBinaryData);
|
sl@0
|
242 |
private:
|
sl@0
|
243 |
virtual void ConstructL(const TDesC8& aBinaryData);
|
sl@0
|
244 |
};
|
sl@0
|
245 |
|
sl@0
|
246 |
class CX509DNSNameSubtree : public CX509DomainName
|
sl@0
|
247 |
/** A Domain Name System (DNS) name subtree.
|
sl@0
|
248 |
*
|
sl@0
|
249 |
* Initialised with 8-bit encoded binary data, which is parsed into a series
|
sl@0
|
250 |
* of sub domains.
|
sl@0
|
251 |
*
|
sl@0
|
252 |
* Because it is a subtree it may start with a period. For example, '.symbian.com',
|
sl@0
|
253 |
* indicating that 'symbian.com' does not lie within the subtree.
|
sl@0
|
254 |
*
|
sl@0
|
255 |
* @publishedAll
|
sl@0
|
256 |
* @released */
|
sl@0
|
257 |
{
|
sl@0
|
258 |
public:
|
sl@0
|
259 |
/** Creates a DNS name object from the specified buffer containing the binary coded
|
sl@0
|
260 |
* representation.
|
sl@0
|
261 |
*
|
sl@0
|
262 |
* The data is parsed into a series of sub domains.
|
sl@0
|
263 |
*
|
sl@0
|
264 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
265 |
* @return The new DNS name object. */
|
sl@0
|
266 |
IMPORT_C static CX509DNSNameSubtree* NewL(const TDesC8& aBinaryData);
|
sl@0
|
267 |
|
sl@0
|
268 |
/** Creates a DNS name object from the specified buffer containing the binary coded
|
sl@0
|
269 |
* representation, and puts a pointer to it onto the cleanup stack.
|
sl@0
|
270 |
*
|
sl@0
|
271 |
* The data is parsed into a series of sub domains.
|
sl@0
|
272 |
*
|
sl@0
|
273 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
274 |
* @return The new DNS name object. */
|
sl@0
|
275 |
IMPORT_C static CX509DNSNameSubtree* NewLC(const TDesC8& aBinaryData);
|
sl@0
|
276 |
|
sl@0
|
277 |
// IMPORT_C static CX509DNSNameSubtree* NewL(const CX509DNSNameSubtree& aName);
|
sl@0
|
278 |
// IMPORT_C static CX509DNSNameSubtree* NewLC(const CX509DNSNameSubtree& aName);
|
sl@0
|
279 |
|
sl@0
|
280 |
/** Gets a reference to the array of pointer descriptors representing the subdomains
|
sl@0
|
281 |
* of the DSN name.
|
sl@0
|
282 |
*
|
sl@0
|
283 |
* @return The array of pointer descriptors. */
|
sl@0
|
284 |
IMPORT_C const RArray<TPtrC>& Rep() const;
|
sl@0
|
285 |
|
sl@0
|
286 |
private:
|
sl@0
|
287 |
void ConstructL(const CX509DNSNameSubtree& aName);
|
sl@0
|
288 |
void ConstructL(const TDesC8& aBinaryData);
|
sl@0
|
289 |
TBool IsValidString(const TDesC& aStr) const;
|
sl@0
|
290 |
};
|
sl@0
|
291 |
|
sl@0
|
292 |
class CX509DNSName : public CX509DNSNameSubtree
|
sl@0
|
293 |
/** A Domain Name System (DNS) name.
|
sl@0
|
294 |
*
|
sl@0
|
295 |
* The name must begin with a valid sub domain and not a period.
|
sl@0
|
296 |
*
|
sl@0
|
297 |
* @publishedAll
|
sl@0
|
298 |
* @released */
|
sl@0
|
299 |
{
|
sl@0
|
300 |
public:
|
sl@0
|
301 |
/** Creates a DNS name object from the specified buffer containing the binary coded
|
sl@0
|
302 |
* representation.
|
sl@0
|
303 |
*
|
sl@0
|
304 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
305 |
* @return The new DNS name object. */
|
sl@0
|
306 |
IMPORT_C static CX509DNSName* NewL(const TDesC8& aBinaryData);
|
sl@0
|
307 |
|
sl@0
|
308 |
/** Creates a DNS name object from the specified buffer containing the binary coded
|
sl@0
|
309 |
* representation, and puts a pointer to it onto the cleanup stack.
|
sl@0
|
310 |
*
|
sl@0
|
311 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
312 |
* @return The new DSN name object. */
|
sl@0
|
313 |
IMPORT_C static CX509DNSName* NewLC(const TDesC8& aBinaryData);
|
sl@0
|
314 |
|
sl@0
|
315 |
/** Creates a new DSN name object from an existing object.
|
sl@0
|
316 |
*
|
sl@0
|
317 |
* This is equivalent to a copy constructor.
|
sl@0
|
318 |
*
|
sl@0
|
319 |
* @param aName The DSN name object to be copied.
|
sl@0
|
320 |
* @return The DSN name object. */
|
sl@0
|
321 |
IMPORT_C static CX509DNSName* NewL(const CX509DNSName& aName);
|
sl@0
|
322 |
|
sl@0
|
323 |
/** Creates a new DSN name object from an existing object, and puts a pointer to
|
sl@0
|
324 |
* it onto the clean up stack.
|
sl@0
|
325 |
*
|
sl@0
|
326 |
* This is equivalent to a copy constructor.
|
sl@0
|
327 |
*
|
sl@0
|
328 |
* @param aName The DNS name object to be copied.
|
sl@0
|
329 |
* @return The new DSN name object. */
|
sl@0
|
330 |
IMPORT_C static CX509DNSName* NewLC(const CX509DNSName& aName);
|
sl@0
|
331 |
|
sl@0
|
332 |
/** Constructs a new DSN name object from a name string.
|
sl@0
|
333 |
*
|
sl@0
|
334 |
* @param aNameString The name string.
|
sl@0
|
335 |
* @return The new DSN name object. */
|
sl@0
|
336 |
IMPORT_C static CX509DNSName* NewL(const TDesC& aNameString);
|
sl@0
|
337 |
|
sl@0
|
338 |
/** Creates a DSN name object from a name string, and puts a pointer to it onto
|
sl@0
|
339 |
* the cleanup stack.
|
sl@0
|
340 |
*
|
sl@0
|
341 |
* @param aNameString The name string.
|
sl@0
|
342 |
* @return The new DSN name object. */
|
sl@0
|
343 |
IMPORT_C static CX509DNSName* NewLC(const TDesC& aNameString);
|
sl@0
|
344 |
private:
|
sl@0
|
345 |
void ConstructL(const TDesC8& aBinaryData);
|
sl@0
|
346 |
void ConstructL(const TDesC& aNameString);
|
sl@0
|
347 |
void ConstructL(const CX509DNSName& aName);
|
sl@0
|
348 |
void ParseNameL();
|
sl@0
|
349 |
};
|
sl@0
|
350 |
|
sl@0
|
351 |
class CX509IPBasedURI : public CBase
|
sl@0
|
352 |
/** A URI.
|
sl@0
|
353 |
*
|
sl@0
|
354 |
* The class extracts a DNS name, i.e. the host part of the URI.
|
sl@0
|
355 |
*
|
sl@0
|
356 |
* Note that it must be of 'ip-based' form (see RFC 1738 section 3.1) and contain
|
sl@0
|
357 |
* a domain name (not an IP address).
|
sl@0
|
358 |
*
|
sl@0
|
359 |
* @publishedAll
|
sl@0
|
360 |
* @released */
|
sl@0
|
361 |
{
|
sl@0
|
362 |
public:
|
sl@0
|
363 |
/** Creates an IP based URI name object from the specified buffer containing the
|
sl@0
|
364 |
* binary coded representation.
|
sl@0
|
365 |
*
|
sl@0
|
366 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
367 |
* @return The new URI name object. */
|
sl@0
|
368 |
IMPORT_C static CX509IPBasedURI* NewL(const TDesC8& aBinaryData);
|
sl@0
|
369 |
|
sl@0
|
370 |
/** Creates a URI name object from the specified buffer containing the binary coded
|
sl@0
|
371 |
* representation, and puts a pointer to it onto the clean up stack.
|
sl@0
|
372 |
*
|
sl@0
|
373 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
374 |
* @return The new URI name object. */
|
sl@0
|
375 |
IMPORT_C static CX509IPBasedURI* NewLC(const TDesC8& aBinaryData);
|
sl@0
|
376 |
|
sl@0
|
377 |
/** Destructor.
|
sl@0
|
378 |
*
|
sl@0
|
379 |
* Frees all resources owned by the object, prior to its destruction. */
|
sl@0
|
380 |
IMPORT_C ~CX509IPBasedURI();
|
sl@0
|
381 |
|
sl@0
|
382 |
/** Gets the host part.
|
sl@0
|
383 |
*
|
sl@0
|
384 |
* @return The host part. */
|
sl@0
|
385 |
IMPORT_C const CX509DNSName& Host() const;
|
sl@0
|
386 |
|
sl@0
|
387 |
/** Gets the whole name.
|
sl@0
|
388 |
*
|
sl@0
|
389 |
* @return A pointer descriptor representing the whole name. */
|
sl@0
|
390 |
IMPORT_C TPtrC Name() const;
|
sl@0
|
391 |
|
sl@0
|
392 |
/** Default constructor.
|
sl@0
|
393 |
* @internalAll
|
sl@0
|
394 |
*/
|
sl@0
|
395 |
CX509IPBasedURI();
|
sl@0
|
396 |
private:
|
sl@0
|
397 |
void ConstructL(const TDesC8& aBinaryData);
|
sl@0
|
398 |
TPtrC ExtractHostNameL() const;
|
sl@0
|
399 |
CX509DNSName* iHost;
|
sl@0
|
400 |
HBufC* iName;
|
sl@0
|
401 |
};
|
sl@0
|
402 |
|
sl@0
|
403 |
class CX509IPSubnetMask : public CBase
|
sl@0
|
404 |
/** An IP subnet mask.
|
sl@0
|
405 |
*
|
sl@0
|
406 |
* Input data is parsed into an 8-bit base address and an 8-bit mask.
|
sl@0
|
407 |
*
|
sl@0
|
408 |
* @publishedAll
|
sl@0
|
409 |
* @released */
|
sl@0
|
410 |
{
|
sl@0
|
411 |
friend class CX509IPAddress;
|
sl@0
|
412 |
public:
|
sl@0
|
413 |
/** Creates an IP subnet mask object from the specified buffer containing the binary
|
sl@0
|
414 |
* coded representation.
|
sl@0
|
415 |
*
|
sl@0
|
416 |
* The data is parsed into an 8-bit base address and an 8-bit mask.
|
sl@0
|
417 |
*
|
sl@0
|
418 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
419 |
* @return The new IP subnet mask object. */
|
sl@0
|
420 |
IMPORT_C static CX509IPSubnetMask* NewL(const TDesC8& aBinaryData);
|
sl@0
|
421 |
|
sl@0
|
422 |
/** Creates an IP subnet mask object from the specified buffer containing the binary
|
sl@0
|
423 |
* coded representation, and puts a pointer to it onto the cleanup stack.
|
sl@0
|
424 |
*
|
sl@0
|
425 |
* The data is parsed into an 8-bit base address and an 8-bit mask.
|
sl@0
|
426 |
*
|
sl@0
|
427 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
428 |
* @return The new IP subnet mask object. */
|
sl@0
|
429 |
IMPORT_C static CX509IPSubnetMask* NewLC(const TDesC8& aBinaryData);
|
sl@0
|
430 |
|
sl@0
|
431 |
/** Destructor.
|
sl@0
|
432 |
*
|
sl@0
|
433 |
* Frees all resources owned by the object, prior to its destruction. */
|
sl@0
|
434 |
IMPORT_C ~CX509IPSubnetMask();
|
sl@0
|
435 |
|
sl@0
|
436 |
/** Gets the base IP address.
|
sl@0
|
437 |
*
|
sl@0
|
438 |
* @return A pointer descriptor representing the base IP address. */
|
sl@0
|
439 |
IMPORT_C TPtrC8 BaseAddress() const;
|
sl@0
|
440 |
|
sl@0
|
441 |
/** Gets the subnet mask.
|
sl@0
|
442 |
*
|
sl@0
|
443 |
* @return A pointer descriptor representing the subnet mask. */
|
sl@0
|
444 |
IMPORT_C TPtrC8 Mask() const;
|
sl@0
|
445 |
|
sl@0
|
446 |
/** Constructor.
|
sl@0
|
447 |
* @internalAll
|
sl@0
|
448 |
*/
|
sl@0
|
449 |
CX509IPSubnetMask();
|
sl@0
|
450 |
private:
|
sl@0
|
451 |
void ConstructL(const TDesC8& aBinaryData);
|
sl@0
|
452 |
HBufC8* iName;
|
sl@0
|
453 |
};
|
sl@0
|
454 |
|
sl@0
|
455 |
class CX509IPAddress : public CBase
|
sl@0
|
456 |
/** A single IP address.
|
sl@0
|
457 |
*
|
sl@0
|
458 |
* @publishedAll
|
sl@0
|
459 |
* @released */
|
sl@0
|
460 |
{
|
sl@0
|
461 |
public:
|
sl@0
|
462 |
/** Creates a single IP address object from the specified buffer containing the
|
sl@0
|
463 |
* binary coded representation.
|
sl@0
|
464 |
*
|
sl@0
|
465 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
466 |
* @return The new single IP addres. */
|
sl@0
|
467 |
IMPORT_C static CX509IPAddress* NewL(const TDesC8& aBinaryData);
|
sl@0
|
468 |
|
sl@0
|
469 |
/** Creates a single IP address object from the specified buffer containing the
|
sl@0
|
470 |
* binary coded representation, and puts a pointer to it onto the cleanup stack.
|
sl@0
|
471 |
*
|
sl@0
|
472 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
473 |
* @return The new single IP addres object. */
|
sl@0
|
474 |
IMPORT_C static CX509IPAddress* NewLC(const TDesC8& aBinaryData);
|
sl@0
|
475 |
|
sl@0
|
476 |
/** Tests whether the IP address lies within the specified subnet address.
|
sl@0
|
477 |
*
|
sl@0
|
478 |
* @param aName The subnet mask name.
|
sl@0
|
479 |
* @return ETrue, if the IP address lies within the specified subnet address;
|
sl@0
|
480 |
* EFalse, otherwise. */
|
sl@0
|
481 |
IMPORT_C TBool IsWithinSubtree(const CX509IPSubnetMask& aName) const;
|
sl@0
|
482 |
|
sl@0
|
483 |
/** Destructor.
|
sl@0
|
484 |
*
|
sl@0
|
485 |
* Frees all resources owned by the object, prior to its destruction. */
|
sl@0
|
486 |
IMPORT_C ~CX509IPAddress();
|
sl@0
|
487 |
|
sl@0
|
488 |
/** Gets the IP address.
|
sl@0
|
489 |
*
|
sl@0
|
490 |
* @return A pointer descriptor representing the single IP address. */
|
sl@0
|
491 |
IMPORT_C TPtrC8 Address() const;
|
sl@0
|
492 |
|
sl@0
|
493 |
/** Constructor.
|
sl@0
|
494 |
* @internalAll
|
sl@0
|
495 |
*/
|
sl@0
|
496 |
CX509IPAddress();
|
sl@0
|
497 |
private:
|
sl@0
|
498 |
void ConstructL(const TDesC8& aBinaryData);
|
sl@0
|
499 |
HBufC8* iName;//4 octets for v4, 16 for v6
|
sl@0
|
500 |
};
|
sl@0
|
501 |
|
sl@0
|
502 |
//general name...
|
sl@0
|
503 |
|
sl@0
|
504 |
class CX509GeneralName : public CBase
|
sl@0
|
505 |
/** Defines a general name.
|
sl@0
|
506 |
*
|
sl@0
|
507 |
* The class contains a tag and a name whose form depends on the value of that tag.
|
sl@0
|
508 |
*
|
sl@0
|
509 |
* When a General Name is included as part of a Name Constraints Extension, the
|
sl@0
|
510 |
* values need not be complete names but may be simply subtrees.
|
sl@0
|
511 |
*
|
sl@0
|
512 |
* For example, 'symbian.com' instead of john.doe@symbian.com'. Both names are
|
sl@0
|
513 |
* valid subtrees but only the second is a valid RFC822 name.
|
sl@0
|
514 |
*
|
sl@0
|
515 |
* @publishedAll
|
sl@0
|
516 |
* @released */
|
sl@0
|
517 |
{
|
sl@0
|
518 |
public:
|
sl@0
|
519 |
/** Creates a new general name object from the specified buffer containing the
|
sl@0
|
520 |
* binary coded representation.
|
sl@0
|
521 |
*
|
sl@0
|
522 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
523 |
* @return The new general name object. */
|
sl@0
|
524 |
IMPORT_C static CX509GeneralName* NewL(const TDesC8& aBinaryData);
|
sl@0
|
525 |
|
sl@0
|
526 |
/** Creates a new general name object from the specified buffer containing the
|
sl@0
|
527 |
* binary coded representation, and puts a pointer to it onto the cleanup stack.
|
sl@0
|
528 |
*
|
sl@0
|
529 |
* Initialises the object from its encoded binary form into an internal representation.
|
sl@0
|
530 |
*
|
sl@0
|
531 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
532 |
* @return The new general name object. */
|
sl@0
|
533 |
IMPORT_C static CX509GeneralName* NewLC(const TDesC8& aBinaryData);
|
sl@0
|
534 |
|
sl@0
|
535 |
/** Creates a new general name object from the specified buffer containing the
|
sl@0
|
536 |
* binary coded representation,starting at the specified offset.
|
sl@0
|
537 |
*
|
sl@0
|
538 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
539 |
* @param aPos The offset position from which to start decoding.
|
sl@0
|
540 |
* @return The new general name object. */
|
sl@0
|
541 |
IMPORT_C static CX509GeneralName* NewL(const TDesC8& aBinaryData, TInt& aPos);
|
sl@0
|
542 |
|
sl@0
|
543 |
/** Creates a new general name object from the specified buffer containing the
|
sl@0
|
544 |
* binary coded representation, starting at the specified offset, and puts a
|
sl@0
|
545 |
* pointer to it onto the cleanup stack.
|
sl@0
|
546 |
*
|
sl@0
|
547 |
* Initialises the object from its encoded binary form into an internal representation.
|
sl@0
|
548 |
*
|
sl@0
|
549 |
* @param aBinaryData The encoded binary representation.
|
sl@0
|
550 |
* @param aPos The offset position from which to start decoding.
|
sl@0
|
551 |
* @return The new general name object. */
|
sl@0
|
552 |
IMPORT_C static CX509GeneralName* NewLC(const TDesC8& aBinaryData, TInt& aPos);
|
sl@0
|
553 |
|
sl@0
|
554 |
/** Creates a new general name object from an existing object.
|
sl@0
|
555 |
*
|
sl@0
|
556 |
* This is equivalent to a copy constructor.
|
sl@0
|
557 |
*
|
sl@0
|
558 |
* @param aName The general name object to be copied.
|
sl@0
|
559 |
* @return The new general name object. */
|
sl@0
|
560 |
IMPORT_C static CX509GeneralName* NewL(const CX509GeneralName& aName);
|
sl@0
|
561 |
|
sl@0
|
562 |
/** Creates a new general name object from an existing object, and puts a pointer
|
sl@0
|
563 |
* to it onto the cleanup stack.
|
sl@0
|
564 |
*
|
sl@0
|
565 |
* This is equivalent to a copy constructor.
|
sl@0
|
566 |
*
|
sl@0
|
567 |
* @param aName The general name object to be copied.
|
sl@0
|
568 |
* @return The new general name object. */
|
sl@0
|
569 |
IMPORT_C static CX509GeneralName* NewLC(const CX509GeneralName& aName);
|
sl@0
|
570 |
|
sl@0
|
571 |
/** Gets the type tag.
|
sl@0
|
572 |
*
|
sl@0
|
573 |
* @return The type tag. */
|
sl@0
|
574 |
IMPORT_C TGNType Tag() const;
|
sl@0
|
575 |
|
sl@0
|
576 |
/** Gets the name.
|
sl@0
|
577 |
*
|
sl@0
|
578 |
* @return A pointer descriptor representing the name. */
|
sl@0
|
579 |
IMPORT_C TPtrC8 Data() const;
|
sl@0
|
580 |
|
sl@0
|
581 |
/** Destructor.
|
sl@0
|
582 |
*
|
sl@0
|
583 |
* Frees all resources owned by the object, prior to its destruction. */
|
sl@0
|
584 |
IMPORT_C ~CX509GeneralName();
|
sl@0
|
585 |
|
sl@0
|
586 |
/** Dummy Function which always returns EFalse.
|
sl@0
|
587 |
* @param aName The general name object to be copied.
|
sl@0
|
588 |
* @return EFalse.
|
sl@0
|
589 |
*/
|
sl@0
|
590 |
IMPORT_C TBool ExactMatch(const CX509GeneralName& aName) const;
|
sl@0
|
591 |
private:
|
sl@0
|
592 |
CX509GeneralName();
|
sl@0
|
593 |
CX509GeneralName(TGNType aType);
|
sl@0
|
594 |
void ConstructL();
|
sl@0
|
595 |
void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
|
sl@0
|
596 |
void ConstructL(const TDesC8& aData);
|
sl@0
|
597 |
TGNType iTag;
|
sl@0
|
598 |
HBufC8* iData;
|
sl@0
|
599 |
};
|
sl@0
|
600 |
|
sl@0
|
601 |
#endif
|