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