epoc32/include/x509certext.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
* X509CERTEXT.H
williamr@2
    16
* X509 extensions v2
williamr@2
    17
* Common specific extensions:
williamr@2
    18
* 1)	basic constraints
williamr@2
    19
* 2)	alt name
williamr@2
    20
* 3)	key usage
williamr@2
    21
* 4)	name constraints
williamr@2
    22
* 5)	policy constraints
williamr@2
    23
* 6)	policies
williamr@2
    24
* 7)	policy mapping
williamr@2
    25
* 8)	authority key ID
williamr@2
    26
* 9)	subject key ID
williamr@2
    27
* 10)	extended key usage
williamr@2
    28
* 11)	authority information access
williamr@2
    29
* critical extension
williamr@2
    30
* 12)   inhibit-any policy 
williamr@2
    31
*
williamr@2
    32
*/
williamr@2
    33
williamr@2
    34
williamr@2
    35
williamr@2
    36
williamr@2
    37
/**
williamr@2
    38
 @file 
williamr@2
    39
 @internalAll
williamr@2
    40
 @released
williamr@2
    41
*/
williamr@2
    42
williamr@2
    43
#if !defined (__X509CERTEXT_H__)
williamr@2
    44
#define __X509CERTEXT_H__
williamr@2
    45
williamr@2
    46
#include <e32base.h>
williamr@2
    47
#include <e32std.h>
williamr@2
    48
#include <x509gn.h>
williamr@2
    49
williamr@2
    50
williamr@2
    51
class RReadStream;
williamr@2
    52
class RWriteStream;
williamr@2
    53
williamr@2
    54
/** X509 Extension OIDs
williamr@2
    55
* 
williamr@2
    56
* @publishedAll
williamr@2
    57
* @released
williamr@2
    58
* @since v9.5 */
williamr@2
    59
williamr@2
    60
//OIDS for the extensions we define here...
williamr@2
    61
_LIT(KBasicConstraints,"2.5.29.19");
williamr@2
    62
_LIT(KSubjectAltName,"2.5.29.17");
williamr@2
    63
_LIT(KIssuerAltName,"2.5.29.18");
williamr@2
    64
_LIT(KKeyUsage,"2.5.29.15");
williamr@2
    65
_LIT(KNameConstraints,"2.5.29.30");
williamr@2
    66
_LIT(KPolicyConstraints,"2.5.29.36");
williamr@2
    67
_LIT(KCertPolicies,"2.5.29.32");
williamr@2
    68
_LIT(KPolicyMapping,"2.5.29.33");
williamr@2
    69
_LIT(KAuthorityKeyId,"2.5.29.35");
williamr@2
    70
_LIT(KSubjectKeyId,"2.5.29.14");
williamr@2
    71
_LIT(KExtendedKeyUsage,"2.5.29.37");
williamr@2
    72
_LIT(KAuthorityInfoAccess, "1.3.6.1.5.5.7.1.1");
williamr@2
    73
_LIT(KInhibitAnyPolicy, "2.5.29.54");
williamr@2
    74
williamr@2
    75
// OIDs for access methods
williamr@2
    76
_LIT(KAccessMethodOCSP, "1.3.6.1.5.5.7.48.1");
williamr@2
    77
williamr@2
    78
//deprecated OIDs we might still encounter
williamr@2
    79
_LIT(KOldBasicConstraints,"2.5.29.10");
williamr@2
    80
_LIT(KOldBasicConstraints2,"2.5.29.13");
williamr@2
    81
_LIT(KOldSubjectAltName,"2.5.29.7");
williamr@2
    82
_LIT(KOldIssuerAltName,"2.5.29.8");
williamr@2
    83
_LIT(KOldNameConstraints,"2.5.29.11");
williamr@2
    84
_LIT(KOldPolicyConstraints,"2.5.29.2");
williamr@2
    85
_LIT(KOldPolicyConstraints2,"2.5.29.34");
williamr@2
    86
_LIT(KOldCertPolicies,"2.5.29.3");
williamr@2
    87
_LIT(KOldPolicyMapping,"2.5.29.5");
williamr@2
    88
_LIT(KOldAuthorityKeyId,"2.5.29.1");
williamr@2
    89
williamr@2
    90
// Define OIDs for Symbian certificate constraints.
williamr@2
    91
_LIT(KDeviceIdListConstraint,"1.2.826.0.1.1796587.1.1.1.1");
williamr@2
    92
_LIT(KSidListConstraint,"1.2.826.0.1.1796587.1.1.1.4");
williamr@2
    93
_LIT(KVidListConstraint,"1.2.826.0.1.1796587.1.1.1.5");
williamr@2
    94
_LIT(KCapabilitiesConstraint,"1.2.826.0.1.1796587.1.1.1.6");
williamr@2
    95
williamr@2
    96
//1) basic constraints...
williamr@2
    97
williamr@2
    98
class CX509ExtensionBase : public CBase
williamr@2
    99
/** A certificate extension base class. 
williamr@2
   100
* 
williamr@2
   101
* @publishedAll
williamr@2
   102
* @released
williamr@2
   103
* @since v6.0 */
williamr@2
   104
	{
williamr@2
   105
protected:
williamr@2
   106
	/** Second-phase constructor.
williamr@2
   107
	* 
williamr@2
   108
	* @param aBinaryData	The encoded binary representation.
williamr@2
   109
	* @param aPos			The position from which to start decoding. */
williamr@2
   110
	virtual void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   111
	
williamr@2
   112
	/** Implementation for second-phase construction.
williamr@2
   113
	* 
williamr@2
   114
	* This is called by ConstructL().
williamr@2
   115
	* 
williamr@2
   116
	* @param aBinaryData	The encoded binary representation. This is the same as
williamr@2
   117
	* 						passed to ConstructL().
williamr@2
   118
	* @param aPos			The position from which to start decoding. Note that the value
williamr@2
   119
	* 						passed points, in effect, to the content, by passing the header data. */
williamr@2
   120
	virtual void DoConstructL(const TDesC8& aBinaryData, TInt& aPos) = 0;
williamr@2
   121
	};
williamr@2
   122
williamr@2
   123
class CX509BasicConstraintsExt : public CX509ExtensionBase
williamr@2
   124
/** An X.509 certificate extension that defines basic constraints.
williamr@2
   125
* 
williamr@2
   126
* It indicates whether the certificate belongs to a Certificate Authority or 
williamr@2
   127
* an end Entity. 
williamr@2
   128
* 
williamr@2
   129
* @publishedAll
williamr@2
   130
* @released
williamr@2
   131
* @since v6.0 */
williamr@2
   132
	{
williamr@2
   133
public:
williamr@2
   134
	/** Creates a new CX509BasicConstraintsExt object from the specified 
williamr@2
   135
	* buffer containing the binary coded representation.
williamr@2
   136
	* 
williamr@2
   137
	* @param aBinaryData	The encoded binary representation.
williamr@2
   138
	* @return				The new CX509BasicConstraintsExt object. */
williamr@2
   139
	IMPORT_C static CX509BasicConstraintsExt* NewL(const TDesC8& aBinaryData);
williamr@2
   140
	
williamr@2
   141
	/** Creates a new CX509BasicConstraintsExt object from the specified 
williamr@2
   142
	* buffer containing the binary coded representation, and puts a pointer to it 
williamr@2
   143
	* onto the cleanup stack.
williamr@2
   144
	* 
williamr@2
   145
	* @param aBinaryData	The encoded binary representation.
williamr@2
   146
	* @return				The new CX509BasicConstraintsExt object. */
williamr@2
   147
	IMPORT_C static CX509BasicConstraintsExt* NewLC(const TDesC8& aBinaryData);
williamr@2
   148
	
williamr@2
   149
	/** Creates a new CX509BasicConstraintsExt object from the specified 
williamr@2
   150
	* buffer containing the binary coded representation, starting at the specified 
williamr@2
   151
	* offset.
williamr@2
   152
	* 
williamr@2
   153
	* @param aBinaryData	The encoded binary representation.
williamr@2
   154
	* @param aPos			The offset position from which to start decoding.
williamr@2
   155
	* @return				The new CX509BasicConstraintsExt object. */
williamr@2
   156
	IMPORT_C static CX509BasicConstraintsExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   157
	
williamr@2
   158
	/** Creates a new CX509BasicConstraintsExt object from the specified 
williamr@2
   159
	* buffer containing the binary coded representation, starting at the specified 
williamr@2
   160
	* offset, and puts a pointer to it onto the cleanup stack.
williamr@2
   161
	*
williamr@2
   162
	* @param aBinaryData	The encoded binary representation.
williamr@2
   163
	* @param aPos			The offset position from which to start decoding.
williamr@2
   164
	* @return				The new CX509BasicConstraintsExt object. */
williamr@2
   165
	IMPORT_C static CX509BasicConstraintsExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   166
	
williamr@2
   167
	/** Destructor.
williamr@2
   168
	* 
williamr@2
   169
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
   170
	virtual ~CX509BasicConstraintsExt();
williamr@2
   171
	
williamr@2
   172
	/** Tests whether the certificate belongs to a Certificate Authority.
williamr@2
   173
	* 
williamr@2
   174
	* @return	ETrue, if the certificate belongs to a Certificate Authority; 
williamr@2
   175
	* 			EFalse, otherwise. */
williamr@2
   176
	IMPORT_C TBool IsCA() const;
williamr@2
   177
	
williamr@2
   178
	/** Gets the maximum number of certificates that can follow this one in the chain.
williamr@2
   179
	* 
williamr@2
   180
	* @return	The number of certificates. */
williamr@2
   181
	IMPORT_C TInt MaxChainLength() const;//0 if not set
williamr@2
   182
private:
williamr@2
   183
	CX509BasicConstraintsExt();
williamr@2
   184
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   185
	TBool iIsCA;
williamr@2
   186
	TInt iMaxChainLen;
williamr@2
   187
	};
williamr@2
   188
williamr@2
   189
//2) alt name
williamr@2
   190
williamr@2
   191
class CX509AltNameExt : public CX509ExtensionBase
williamr@2
   192
/** An X.509 certificate extension that defines an alternate name.
williamr@2
   193
* 
williamr@2
   194
* It appears as an Issuer Alt Name extension or a Subject Alt Name extension 
williamr@2
   195
* and is used to contain extra identifying information that will not fit into 
williamr@2
   196
* a Distinguished Name.
williamr@2
   197
* 
williamr@2
   198
* It consists of an array of X.509 General Names.
williamr@2
   199
*
williamr@2
   200
* @publishedAll
williamr@2
   201
* @released
williamr@2
   202
* @since v6.0 */
williamr@2
   203
	{
williamr@2
   204
public:
williamr@2
   205
	/** Creates a new CX509AltNameExt object from the specified 
williamr@2
   206
	* buffer containing the binary coded representation.
williamr@2
   207
	*
williamr@2
   208
	* @param aBinaryData	The encoded binary representation.
williamr@2
   209
	* @return				The new CX509AltNameExt object. */
williamr@2
   210
	IMPORT_C static CX509AltNameExt* NewL(const TDesC8& aBinaryData);
williamr@2
   211
	
williamr@2
   212
	/** Creates a new CX509AltNameExt object from the specified 
williamr@2
   213
	* buffer containing the binary coded representation, and puts a pointer to it 
williamr@2
   214
	* onto the cleanup stack.
williamr@2
   215
	* 
williamr@2
   216
	* @param aBinaryData	The encoded binary representation.
williamr@2
   217
	* @return				The new CX509AltNameExt object. */
williamr@2
   218
	IMPORT_C static CX509AltNameExt* NewLC(const TDesC8& aBinaryData);
williamr@2
   219
	
williamr@2
   220
	/** Creates a new CX509AltNameExt object from the specified 
williamr@2
   221
	* buffer containing the binary coded representation, starting at the specified 
williamr@2
   222
	* offset.
williamr@2
   223
	* 
williamr@2
   224
	* @param aBinaryData	The encoded binary representation.
williamr@2
   225
	* @param aPos			The offset position from which to start decoding.
williamr@2
   226
	* @return				The new CX509AltNameExt object. */
williamr@2
   227
	IMPORT_C static CX509AltNameExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   228
	
williamr@2
   229
	/** Creates a new CX509AltNameExt object from the specified 
williamr@2
   230
	* buffer containing the binary coded representation, starting at the specified 
williamr@2
   231
	* offset, and puts a pointer to it onto the cleanup stack.
williamr@2
   232
	* 
williamr@2
   233
	* @param aBinaryData	The encoded binary representation.
williamr@2
   234
	* @param aPos			The offset position from which to start decoding.
williamr@2
   235
	* @return				The new CX509AltNameExt object. */
williamr@2
   236
	IMPORT_C static CX509AltNameExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   237
	
williamr@2
   238
	/** Destructor.
williamr@2
   239
	* 
williamr@2
   240
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
   241
	 virtual ~CX509AltNameExt();
williamr@2
   242
	
williamr@2
   243
	/** Gets a reference to the array of general names that forms the alternate name 
williamr@2
   244
	* extension.
williamr@2
   245
	* 
williamr@2
   246
	* @return	The array of general names. */
williamr@2
   247
	IMPORT_C const CArrayPtrFlat<CX509GeneralName>& AltName() const;
williamr@2
   248
	
williamr@2
   249
	/** Checks whether the corressponding elements of two equally sized arrays of X.509 general names
williamr@2
   250
	* match.
williamr@2
   251
	*
williamr@2
   252
	* @param aExt	An X.509 certificate extension object that defines an alternate name.
williamr@2
   253
	* @return		TRUE if all the elements in the arrays match.
williamr@2
   254
	*/
williamr@2
   255
	IMPORT_C TBool Match(const CX509AltNameExt& aExt) const;
williamr@2
   256
private:
williamr@2
   257
	CX509AltNameExt();
williamr@2
   258
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   259
	CArrayPtrFlat<CX509GeneralName>* iAuthorityName;
williamr@2
   260
	};
williamr@2
   261
williamr@2
   262
//3) key usage
williamr@2
   263
williamr@2
   264
class CX509BitString : public CBase
williamr@2
   265
/** An X.509 bit string. 
williamr@2
   266
*
williamr@2
   267
* @internalTechnology
williamr@2
   268
* @released
williamr@2
   269
* @since v6.0 */
williamr@2
   270
	{
williamr@2
   271
public:
williamr@2
   272
	/** Destructor.
williamr@2
   273
	* 
williamr@2
   274
	* Frees all resources owned by the object. */
williamr@2
   275
	~CX509BitString();
williamr@2
   276
	
williamr@2
   277
	/** Tests whether the specified bit is set.
williamr@2
   278
	* 
williamr@2
   279
	* @param aBit	The offset of the bit to be tested. This is a value relative to 
williamr@2
   280
	* 				zero. Any value greater than or equal to the length of the bit 
williamr@2
   281
	*				string will always cause EFalse to be returned.
williamr@2
   282
	* @return		ETrue, if the bit is set; EFalse, otherwise. */
williamr@2
   283
	TBool IsSet(TInt aBit) const;
williamr@2
   284
	
williamr@2
   285
	/** Creates the X.509 bit string.
williamr@2
   286
	* 
williamr@2
   287
	* @param aData				A heap descriptor representing the bit string data.
williamr@2
   288
	* @param aEffectiveLength	The number of bits in the string. */
williamr@2
   289
	CX509BitString(HBufC8* aData, TInt aEffectiveLength);
williamr@2
   290
private:
williamr@2
   291
	HBufC8* iData;
williamr@2
   292
	TInt iLength;
williamr@2
   293
	};
williamr@2
   294
williamr@2
   295
/** A list of values that defines what an X.509 key can be used for.
williamr@2
   296
* These values can be ANDed together if a key has several usages. 
williamr@2
   297
* 
williamr@2
   298
* @internalTechnology
williamr@2
   299
* @since v7.0 */
williamr@2
   300
enum TX509KeyUsage
williamr@2
   301
	{
williamr@2
   302
	/** A digital signature. */
williamr@2
   303
	EX509DigitalSignature,
williamr@2
   304
	/** Non repudiation. */
williamr@2
   305
	EX509NonRepudiation,
williamr@2
   306
	/** Key encipherment. */
williamr@2
   307
	EX509KeyEncipherment,
williamr@2
   308
	/** Data encipherment. */
williamr@2
   309
	EX509DataEncipherment,
williamr@2
   310
	/** Key agreement. */
williamr@2
   311
	EX509KeyAgreement,
williamr@2
   312
	/** Key certificate sign. */
williamr@2
   313
	EX509KeyCertSign,
williamr@2
   314
	/** CRL sign. */
williamr@2
   315
	EX509CRLSign,
williamr@2
   316
	/** Encipher only. */
williamr@2
   317
	EX509EncipherOnly,
williamr@2
   318
	/** Decipher only. */
williamr@2
   319
	EX509DecipherOnly
williamr@2
   320
	};
williamr@2
   321
williamr@2
   322
class CX509KeyUsageExt : public CX509ExtensionBase
williamr@2
   323
/** An X.509 certificate extension that defines the uses to which a key may be put.
williamr@2
   324
* 
williamr@2
   325
* @publishedAll
williamr@2
   326
* @released
williamr@2
   327
* @since v6.0 */
williamr@2
   328
	{
williamr@2
   329
public:
williamr@2
   330
	/** Creates a new CX509KeyUsageExt object from the specified buffer 
williamr@2
   331
	* containing the binary coded representation.
williamr@2
   332
	* 
williamr@2
   333
	* @param aBinaryData	The encoded binary representation.
williamr@2
   334
	* @return				The new CX509KeyUsageExt object. */
williamr@2
   335
	IMPORT_C static CX509KeyUsageExt* NewL(const TDesC8& aBinaryData);
williamr@2
   336
	
williamr@2
   337
	/** Creates a new CX509KeyUsageExt object from the specified buffer 
williamr@2
   338
	* containing the binary coded representation, and puts a pointer to it onto 
williamr@2
   339
	* the cleanup stack.
williamr@2
   340
	* 
williamr@2
   341
	* @param aBinaryData	The encoded binary representation.
williamr@2
   342
	* @return				The new CX509KeyUsageExt object. */
williamr@2
   343
	IMPORT_C static CX509KeyUsageExt* NewLC(const TDesC8& aBinaryData);
williamr@2
   344
	
williamr@2
   345
	/** Creates a new CX509KeyUsageExt object from the specified buffer 
williamr@2
   346
	* containing the binary coded representation, starting at the specified offset.
williamr@2
   347
	* 
williamr@2
   348
	* @param aBinaryData	The encoded binary representation.
williamr@2
   349
	* @param aPos			The offset position from which to start decoding.
williamr@2
   350
	* @return				The new CX509KeyUsageExt object. */
williamr@2
   351
	IMPORT_C static CX509KeyUsageExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   352
	
williamr@2
   353
	/** Creates a new CX509KeyUsageExt object from the specified buffer 
williamr@2
   354
	* containing the binary coded representation, starting at the specified offset, 
williamr@2
   355
	* and puts a pointer to it onto the cleanup stack.
williamr@2
   356
	* 
williamr@2
   357
	* @param aBinaryData	The encoded binary representation.
williamr@2
   358
	* @param aPos			The offset position from which to start decoding.
williamr@2
   359
	* @return				The new CX509KeyUsageExt object. */
williamr@2
   360
	IMPORT_C static CX509KeyUsageExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   361
	
williamr@2
   362
	/** Destructor.
williamr@2
   363
	* 
williamr@2
   364
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
   365
	virtual ~CX509KeyUsageExt();
williamr@2
   366
	
williamr@2
   367
	/** Tests whether a particular usage is set in the extension.
williamr@2
   368
	* 
williamr@2
   369
	* @internalTechnology
williamr@2
   370
	* @param aUsage	The usage.
williamr@2
   371
	* @return		ETrue, if the specific usage is set in the extension; EFalse, otherwise. */
williamr@2
   372
	IMPORT_C TBool IsSet(TX509KeyUsage aUsage) const;
williamr@2
   373
private:
williamr@2
   374
	CX509KeyUsageExt();
williamr@2
   375
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   376
	CX509BitString* iData;
williamr@2
   377
	};
williamr@2
   378
williamr@2
   379
//4) name constraints
williamr@2
   380
williamr@2
   381
class CX509GeneralSubtree : public CBase
williamr@2
   382
/** Provides access to the general name and the min/max lengths of the subtree. 
williamr@2
   383
* 
williamr@2
   384
* @publishedAll
williamr@2
   385
* @released
williamr@2
   386
* @since v6.0 */
williamr@2
   387
	{
williamr@2
   388
public:
williamr@2
   389
	/**
williamr@2
   390
	 * @internalComponent
williamr@2
   391
	 *  
williamr@2
   392
	 * Creates a new CX509GeneralSubtree object from the specified buffer containing 
williamr@2
   393
	 * the encoded binary representation.
williamr@2
   394
	 * 
williamr@2
   395
	 * @param aBinaryData	The encoded binary representation. 
williamr@2
   396
	 * @return 		The new CX509GeneralSubtree object. 
williamr@2
   397
	 **/
williamr@2
   398
	static CX509GeneralSubtree* NewL(const TDesC8& aBinaryData);
williamr@2
   399
	
williamr@2
   400
	/** 
williamr@2
   401
	 * @internalComponent
williamr@2
   402
	 * 
williamr@2
   403
	 * Creates a new CX509GeneralSubtree object from the specified buffer containing 
williamr@2
   404
	 * the encoded binary representation, and puts a pointer to it onto the cleanup stack.
williamr@2
   405
	 * 
williamr@2
   406
	 * @param aBinaryData	The encoded binary representation. 
williamr@2
   407
	 * @return 				The new CX509GeneralSubtree object. 
williamr@2
   408
	 **/
williamr@2
   409
	static CX509GeneralSubtree* NewLC(const TDesC8& aBinaryData);
williamr@2
   410
	
williamr@2
   411
	/** 
williamr@2
   412
	 * @internalComponent
williamr@2
   413
	 *
williamr@2
   414
	 * Creates a new CX509GeneralSubtree object from the specified buffer containing 
williamr@2
   415
	 * the encoded binary representation.
williamr@2
   416
	 * 
williamr@2
   417
	 * @param aBinaryData	The encoded binary representation.
williamr@2
   418
	 * @param aPos			The position from which to start decoding. 
williamr@2
   419
	 * @return 				The new CX509GeneralSubtree object. 
williamr@2
   420
	 **/
williamr@2
   421
	static CX509GeneralSubtree* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   422
	
williamr@2
   423
	/** 
williamr@2
   424
	 * @internalComponent
williamr@2
   425
	 *
williamr@2
   426
	 * Creates a new CX509GeneralSubtree object from the specified buffer containing 
williamr@2
   427
	 * the encoded binary representation, and puts a pointer to it onto the cleanup stack.
williamr@2
   428
	 * 
williamr@2
   429
	 * @param aBinaryData	The encoded binary representation.
williamr@2
   430
	 * @param aPos			The position from which to start decoding.
williamr@2
   431
	 * @return 				The new CX509GeneralSubtree object. 
williamr@2
   432
	 **/
williamr@2
   433
	static CX509GeneralSubtree* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   434
	
williamr@2
   435
	/** Destructor.
williamr@2
   436
	* 
williamr@2
   437
	* Frees all resources owned by the object. */
williamr@2
   438
	virtual ~CX509GeneralSubtree();
williamr@2
   439
	
williamr@2
   440
	/** Gets the general name.
williamr@2
   441
	* 
williamr@2
   442
	* @return	The general name. */
williamr@2
   443
	IMPORT_C const CX509GeneralName& Name() const;
williamr@2
   444
	
williamr@2
   445
	/** Gets the minimum distance of the CX509GeneralSubtree object.
williamr@2
   446
	* 
williamr@2
   447
	* @return	The minimum distance of the CX509GeneralSubtree object. */
williamr@2
   448
	IMPORT_C TInt MinDistance() const;
williamr@2
   449
	
williamr@2
   450
	/** Gets the maximum distance of the CX509GeneralSubtree object.
williamr@2
   451
	* 
williamr@2
   452
	* @return	The maximum distance of the CX509GeneralSubtree object. */
williamr@2
   453
	IMPORT_C TInt MaxDistance() const;
williamr@2
   454
private:
williamr@2
   455
	CX509GeneralSubtree();
williamr@2
   456
	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   457
	CX509GeneralName* iName;
williamr@2
   458
	TInt iMaxDist;
williamr@2
   459
	TInt iMinDist;
williamr@2
   460
	};
williamr@2
   461
williamr@2
   462
class CX509NameConstraintsExt : public CX509ExtensionBase
williamr@2
   463
/** An X.509 certificate extension that defines constraints on an entity's name.
williamr@2
   464
* 
williamr@2
   465
* This extension allows Certification Authorities to restrict or prevent the issuing 
williamr@2
   466
* of certificates to entities whose names lie within a defined name space. 
williamr@2
   467
*
williamr@2
   468
* @publishedAll
williamr@2
   469
* @released */
williamr@2
   470
	{
williamr@2
   471
public:
williamr@2
   472
	/** Creates a new CX509NameConstraintsExt object from the specified 
williamr@2
   473
	* buffer containing the binary coded representation.
williamr@2
   474
	* 
williamr@2
   475
	* @param aBinaryData	The encoded binary representation.
williamr@2
   476
	* @return				The new CX509NameConstraintsExt object. */
williamr@2
   477
	IMPORT_C static CX509NameConstraintsExt* NewL(const TDesC8& aBinaryData);
williamr@2
   478
	
williamr@2
   479
	/** Creates a new CX509NameConstraintsExt object from the specified 
williamr@2
   480
	* buffer containing the binary coded representation, and puts a pointer to it 
williamr@2
   481
	* onto the cleanup stack.
williamr@2
   482
	* 
williamr@2
   483
	* @param aBinaryData	The encoded binary representation.
williamr@2
   484
	* @return				The new CX509NameConstraintsExt object. */
williamr@2
   485
	IMPORT_C static CX509NameConstraintsExt* NewLC(const TDesC8& aBinaryData);
williamr@2
   486
	
williamr@2
   487
	/** Creates a new CX509NameConstraintsExt object from the specified 
williamr@2
   488
	* buffer containing the binary coded representation, starting at the specified offset.
williamr@2
   489
	* 
williamr@2
   490
	* @param aBinaryData	The encoded binary representation.
williamr@2
   491
	* @param aPos			The offset position from which to start decoding.
williamr@2
   492
	* @return				The new CX509NameConstraintsExt object. */
williamr@2
   493
	IMPORT_C static CX509NameConstraintsExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   494
	
williamr@2
   495
	/** Creates a new CX509NameConstraintsExt object from the specified 
williamr@2
   496
	* buffer containing the binary coded representation, starting at the specified 
williamr@2
   497
	* offset, and puts a pointer to it onto the cleanup stack.
williamr@2
   498
	* 
williamr@2
   499
	* @param aBinaryData	The encoded binary representation.
williamr@2
   500
	* @param aPos			The offset position from which to start decoding.
williamr@2
   501
	* @return				The new CX509NameConstraintsExt object. */
williamr@2
   502
	IMPORT_C static CX509NameConstraintsExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   503
	
williamr@2
   504
	/** Destructor.
williamr@2
   505
	* 
williamr@2
   506
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
   507
	IMPORT_C ~CX509NameConstraintsExt();
williamr@2
   508
	
williamr@2
   509
	/** Gets a reference to the array of exclusion subtree names.
williamr@2
   510
	* 
williamr@2
   511
	* No certificates after this one may contain names within the subtrees specified.
williamr@2
   512
	* 
williamr@2
   513
	* @return	The excluded subtrees. */
williamr@2
   514
	IMPORT_C const CArrayPtrFlat<CX509GeneralSubtree>& ExcludedSubtrees() const;
williamr@2
   515
	
williamr@2
   516
	/** Gets a reference to the array of permitted subtree names.
williamr@2
   517
	* 
williamr@2
   518
	* All certificates after this one must contain names within the subtrees specified.
williamr@2
   519
	* 
williamr@2
   520
	* @return	The permitted subtrees. */
williamr@2
   521
	IMPORT_C const CArrayPtrFlat<CX509GeneralSubtree>& PermittedSubtrees() const;
williamr@2
   522
private:
williamr@2
   523
	CX509NameConstraintsExt();
williamr@2
   524
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   525
	void AddSubtreesL(CArrayPtrFlat<CX509GeneralSubtree>& aSubtrees, const TDesC8& aBinaryData);
williamr@2
   526
	CArrayPtrFlat<CX509GeneralSubtree>* iExcludedSubtrees;
williamr@2
   527
	CArrayPtrFlat<CX509GeneralSubtree>* iPermittedSubtrees;
williamr@2
   528
	};
williamr@2
   529
williamr@2
   530
//5) policy constraints
williamr@2
   531
williamr@2
   532
class TX509PolicyConstraint
williamr@2
   533
/** Defines whether a policy constraint applies.
williamr@2
   534
* 
williamr@2
   535
* Objects of this type are used by the X.509 certificate extension that constrains 
williamr@2
   536
* the use of policies.
williamr@2
   537
* 
williamr@2
   538
* An object of this type encapsulates two pieces of information:
williamr@2
   539
* @li	whether a specific policy applies to subsequent certificates
williamr@2
   540
* @li	if a specific policy applies, the number of certificates that can follow the 
williamr@2
   541
* 		current one before the policy constraint applies.
williamr@2
   542
* 
williamr@2
   543
* Enables a CA to constrain the use of policies in two ways: they can enforce 
williamr@2
   544
* the appearance of explicit certificate policies in subsequent certificates, 
williamr@2
   545
* and prevent policy mapping from being performed. 
williamr@2
   546
*
williamr@2
   547
* @publishedAll
williamr@2
   548
* @released
williamr@2
   549
*/
williamr@2
   550
	{
williamr@2
   551
public:
williamr@2
   552
	/** 
williamr@2
   553
	 * @internalComponent
williamr@2
   554
	 *
williamr@2
   555
	 * Constructs a TX509PolicyConstraint definition object with the specified requirement 
williamr@2
   556
 	 * and countdown values.
williamr@2
   557
	 * 
williamr@2
   558
	 * @param aRequired	The policy requirement. Set to ETrue, if the policy constraint 
williamr@2
   559
	 * 					applies; set to EFalse, otherwise.
williamr@2
   560
	 * @param aCountdown	The countdown value. This is the number of certificates that 
williamr@2
   561
	 * 					can follow the current one before the constraint applies. 
williamr@2
   562
	 *					This only has meaning if the policy constraint applies. 
williamr@2
   563
	 **/
williamr@2
   564
	TX509PolicyConstraint(TBool aRequired, TInt aCountdown);
williamr@2
   565
	
williamr@2
   566
	/** 
williamr@2
   567
	 * @internalComponent
williamr@2
   568
	 *
williamr@2
   569
	 * Default constructor.
williamr@2
   570
	 * 
williamr@2
   571
	 * Sets policy requirement to EFalse and iRequired to EFalse and the iCountdown 
williamr@2
   572
	 * to zero. 
williamr@2
   573
	 **/
williamr@2
   574
	TX509PolicyConstraint();
williamr@2
   575
	
williamr@2
   576
	/** The policy requirement.
williamr@2
   577
	* 
williamr@2
   578
	* This has the value ETrue, if the policy constraint applies; EFalse otherwise. */
williamr@2
   579
	TBool iRequired;
williamr@2
   580
	
williamr@2
   581
	/** The count down value.
williamr@2
   582
	* 
williamr@2
   583
	* Defines the number of certificates that can follow the current one before 
williamr@2
   584
	* the policy constraint applies. This has no meaning if the policy constraint 
williamr@2
   585
	* does not apply. */
williamr@2
   586
	TInt iCountdown;
williamr@2
   587
	};
williamr@2
   588
williamr@2
   589
class CX509PolicyConstraintsExt : public CX509ExtensionBase
williamr@2
   590
/** Enables a Certification Authority to constrain the use of policies in two ways:
williamr@2
   591
* @li to enforce the appearance of explicit certificate policies in subsequent certificates
williamr@2
   592
* @li to prevent policy mapping from being performed.
williamr@2
   593
* 
williamr@2
   594
* @publishedAll
williamr@2
   595
* @released
williamr@2
   596
* @since v6.0 */
williamr@2
   597
	{
williamr@2
   598
public:
williamr@2
   599
	/** Creates a new CX509PolicyConstraintsExt object from the specified buffer 
williamr@2
   600
	* containing the encoded binary representation.
williamr@2
   601
	* 
williamr@2
   602
	* @param aBinaryData	The encoded binary representation.
williamr@2
   603
	* @return				The new CX509PolicyConstraintsExt object. */
williamr@2
   604
	IMPORT_C static CX509PolicyConstraintsExt* NewL(const TDesC8& aBinaryData);
williamr@2
   605
	
williamr@2
   606
	/** Creates a new Policy constraints extension object from the specified buffer 
williamr@2
   607
	* containing the encoded binary representation, and puts a pointer to it onto 
williamr@2
   608
	* the cleanup stack.
williamr@2
   609
	* 
williamr@2
   610
	* @param aBinaryData	The encoded binary representation.
williamr@2
   611
	* @return				The new CX509PolicyConstraintsExt object. */
williamr@2
   612
	IMPORT_C static CX509PolicyConstraintsExt* NewLC(const TDesC8& aBinaryData);
williamr@2
   613
	
williamr@2
   614
	/** Creates a new CX509PolicyConstraintsExt object from the specified buffer 
williamr@2
   615
	* containing the encoded binary representation, starting at the specified offset.
williamr@2
   616
	* 
williamr@2
   617
	* @param aBinaryData	The encoded binary representation.
williamr@2
   618
	* @param aPos			The offset position from which to start decoding.
williamr@2
   619
	* @return				The new CX509PolicyConstraintsExt object. */
williamr@2
   620
	IMPORT_C static CX509PolicyConstraintsExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   621
	
williamr@2
   622
	/** Creates a new CX509PolicyConstraintsExt object from the specified buffer 
williamr@2
   623
	* containing the encoded binary representation, and puts a pointer to it onto 
williamr@2
   624
	* the cleanup stack.
williamr@2
   625
	* 
williamr@2
   626
	* @param aBinaryData	The encoded binary representation.
williamr@2
   627
	* @param aPos			The offset position from which to start decoding.
williamr@2
   628
	* @return				The new CX509PolicyConstraintsExt object. */
williamr@2
   629
	IMPORT_C static CX509PolicyConstraintsExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   630
	
williamr@2
   631
	/** Destructor.
williamr@2
   632
	* 
williamr@2
   633
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
   634
	IMPORT_C ~CX509PolicyConstraintsExt();
williamr@2
   635
	
williamr@2
   636
	/** Gets the explicit policy constraint.
williamr@2
   637
	* 
williamr@2
   638
	* @return	The explicit policy constraint. */
williamr@2
   639
	IMPORT_C TX509PolicyConstraint ExplicitPolicyRequired() const;
williamr@2
   640
	
williamr@2
   641
	/** Gets the inhibiting policy mapping.
williamr@2
   642
	* 
williamr@2
   643
	* @return	The inhibiting policy mapping. */
williamr@2
   644
	IMPORT_C TX509PolicyConstraint InhibitPolicyMapping() const;
williamr@2
   645
private:
williamr@2
   646
	CX509PolicyConstraintsExt();
williamr@2
   647
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   648
	TX509PolicyConstraint iRequirePolicy;
williamr@2
   649
	TX509PolicyConstraint iInhibitPolicyMapping;
williamr@2
   650
	};
williamr@2
   651
williamr@2
   652
//6) policies
williamr@2
   653
williamr@2
   654
class CX509PolicyQualifierInfo : public CBase
williamr@2
   655
/** Gets X.509 policy qualifier information. 
williamr@2
   656
* 
williamr@2
   657
* @publishedAll
williamr@2
   658
* @released
williamr@2
   659
* @since v6.0 */
williamr@2
   660
	{
williamr@2
   661
public:
williamr@2
   662
	/** 
williamr@2
   663
	 * @internalComponent
williamr@2
   664
	 *
williamr@2
   665
	 * Creates a new CX509PolicyQualifierInfo object from the specified 
williamr@2
   666
	 * buffer containing the encoded binary representation.
williamr@2
   667
	 * 
williamr@2
   668
	 * @param aBinaryData	The encoded binary representation. 
williamr@2
   669
	 * @return				The new CX509PolicyQualifierInfo object. 
williamr@2
   670
	 **/
williamr@2
   671
	static CX509PolicyQualifierInfo* NewL(const TDesC8& aBinaryData);
williamr@2
   672
	
williamr@2
   673
	/**
williamr@2
   674
	 * @internalComponent
williamr@2
   675
	 *
williamr@2
   676
	 * Creates a new CX509PolicyQualifierInfo object from the specified 
williamr@2
   677
	 * buffer containing the encoded binary representation, and puts a pointer to 
williamr@2
   678
	 * it onto the cleanup stack.
williamr@2
   679
	 * 
williamr@2
   680
	 * @param aBinaryData	The encoded binary representation. 
williamr@2
   681
	 * @return				The new CX509PolicyQualifierInfo object. 
williamr@2
   682
	 **/
williamr@2
   683
	static CX509PolicyQualifierInfo* NewLC(const TDesC8& aBinaryData);
williamr@2
   684
	
williamr@2
   685
	/** 
williamr@2
   686
	 * @internalComponent
williamr@2
   687
	 *
williamr@2
   688
	 * Creates a new CX509PolicyQualifierInfo object from the specified 
williamr@2
   689
	 * buffer containing the encoded binary representation.
williamr@2
   690
	 * 
williamr@2
   691
	 * @param aBinaryData	The encoded binary representation.
williamr@2
   692
	 * @param aPos			The position from which to start decoding. 
williamr@2
   693
	 * @return				The new CX509PolicyQualifierInfo object. 
williamr@2
   694
	 **/
williamr@2
   695
	static CX509PolicyQualifierInfo* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   696
	
williamr@2
   697
	/** 
williamr@2
   698
	 * @internalComponent
williamr@2
   699
	 *
williamr@2
   700
	 * Creates a new CX509PolicyQualifierInfo object from the specified 
williamr@2
   701
	 * buffer containing the encoded binary representation, and puts a pointer to 
williamr@2
   702
	 * it onto the cleanup stack.
williamr@2
   703
	 * 
williamr@2
   704
	 * @param aBinaryData	The encoded binary representation.
williamr@2
   705
	 * @param aPos			The position from which to start decoding. 
williamr@2
   706
	 * @return				The new CX509PolicyQualifierInfo object. 
williamr@2
   707
	 **/
williamr@2
   708
	static CX509PolicyQualifierInfo* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   709
	
williamr@2
   710
	/** 
williamr@2
   711
	 * @internalComponent
williamr@2
   712
	 *
williamr@2
   713
	 * Creates a new CX509PolicyQualifierInfo object from an existing X.509 
williamr@2
   714
	 * Policy Qualifier Information object.
williamr@2
   715
	 * 
williamr@2
   716
	 * @param aQualifierInfo	The CX509PolicyQualifierInfo object to be copied. 
williamr@2
   717
	 * @return				The new CX509PolicyQualifierInfo object. 
williamr@2
   718
	 **/
williamr@2
   719
	static CX509PolicyQualifierInfo* NewL(const CX509PolicyQualifierInfo& aQualifierInfo);
williamr@2
   720
	
williamr@2
   721
	/** 
williamr@2
   722
	 * @internalComponent
williamr@2
   723
	 *
williamr@2
   724
	 * Creates a new CX509PolicyQualifierInfo object from an existing X.509 
williamr@2
   725
	 * Policy Qualifier Information object, and puts a pointer to it onto the cleanup stack.
williamr@2
   726
	 * 
williamr@2
   727
	 * @param aQualifierInfo	The CX509PolicyQualifierInfo object to be copied. 
williamr@2
   728
	 * @return				The new CX509PolicyQualifierInfo object. 
williamr@2
   729
	 **/
williamr@2
   730
	static CX509PolicyQualifierInfo* NewLC(const CX509PolicyQualifierInfo& aQualifierInfo);
williamr@2
   731
	
williamr@2
   732
	/** 
williamr@2
   733
	 * @internalComponent
williamr@2
   734
	 *
williamr@2
   735
	 * Creates a new CX509PolicyQualifierInfo object from a stream.
williamr@2
   736
	 * 
williamr@2
   737
	 * @return	The new CX509PolicyQualifierInfo object. 
williamr@2
   738
	 **/
williamr@2
   739
	static CX509PolicyQualifierInfo* NewL(RReadStream& aStream);
williamr@2
   740
	
williamr@2
   741
	/** 
williamr@2
   742
	 * @internalComponent
williamr@2
   743
	 *
williamr@2
   744
	 * Creates a new CX509PolicyQualifierInfo object from a stream, and puts a pointer to it onto 
williamr@2
   745
	 * the cleanup stack.
williamr@2
   746
	 * 
williamr@2
   747
	 * @return	The new CX509PolicyQualifierInfo object. 
williamr@2
   748
	 **/
williamr@2
   749
	static CX509PolicyQualifierInfo* NewLC(RReadStream& aStream);
williamr@2
   750
	
williamr@2
   751
	/** The destructor.
williamr@2
   752
	* 
williamr@2
   753
	* Frees all resources owned by the object. */
williamr@2
   754
	virtual ~CX509PolicyQualifierInfo();
williamr@2
   755
	
williamr@2
   756
	/** Gets the policy qualifier Id.
williamr@2
   757
	* 
williamr@2
   758
	* @return	A non-modifiable pointer descriptor representing the policy qualifier Id. */
williamr@2
   759
	IMPORT_C TPtrC Id() const;
williamr@2
   760
	
williamr@2
   761
	/** Gets the policy qualifier data.
williamr@2
   762
	* 
williamr@2
   763
	* @return	A non-modifiable pointer descriptor representing the policy qualifier data. */
williamr@2
   764
	IMPORT_C TPtrC8 Data() const;
williamr@2
   765
williamr@2
   766
	// Internalization/Externalization
williamr@2
   767
  // Externalize. Writes the data out to a stream
williamr@2
   768
	/** 
williamr@2
   769
	 * @internalComponent
williamr@2
   770
	 * 
williamr@2
   771
	 * Externalises an object of this class to a write stream.
williamr@2
   772
	 *  
williamr@2
   773
	 * The presence of this function means that the standard templated operator<<() 
williamr@2
   774
	 * can be used to externalise objects of this class.
williamr@2
   775
	 * 
williamr@2
   776
	 * @param aStream	Stream to which the object should be externalised. 
williamr@2
   777
	 **/
williamr@2
   778
	void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   779
williamr@2
   780
	// Internalize. Reads the data from a stream 
williamr@2
   781
	/** 
williamr@2
   782
	 * @internalComponent
williamr@2
   783
	 *
williamr@2
   784
	 * Internalises an object of this class from a read stream.
williamr@2
   785
	 * 
williamr@2
   786
	 * The presence of this function means that the standard templated operator>>() 
williamr@2
   787
	 * can be used to internalise objects of this class.
williamr@2
   788
	 * 
williamr@2
   789
	 * Note that this function has assignment semantics: it replaces the old value 
williamr@2
   790
	 * of the object with a new value read from the read stream.	
williamr@2
   791
	 * 
williamr@2
   792
	 * @param aStream	Stream from which the object should be internalised. 
williamr@2
   793
	 **/
williamr@2
   794
	void InternalizeL(RReadStream& aStream);
williamr@2
   795
	
williamr@2
   796
private:
williamr@2
   797
	CX509PolicyQualifierInfo();
williamr@2
   798
	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   799
	void ConstructL(const CX509PolicyQualifierInfo& aQualifier);
williamr@2
   800
	void ConstructL(RReadStream& aStream);
williamr@2
   801
	HBufC* iPolicyQualifierId;
williamr@2
   802
	HBufC8* iData; //opaque (this is another any-defined-by, so could be anything)
williamr@2
   803
	};
williamr@2
   804
williamr@2
   805
class CX509CertPolicyInfo : public CBase
williamr@2
   806
/** Defines a specific policy followed by a Certification Authority.
williamr@2
   807
* 
williamr@2
   808
* The policy under which a certificate has been issued may contain a number 
williamr@2
   809
* of these specific policies.
williamr@2
   810
* 
williamr@2
   811
* @see CX509CertPoliciesExt 
williamr@2
   812
* @publishedAll
williamr@2
   813
* @released
williamr@2
   814
* @since v6.0 */
williamr@2
   815
	{
williamr@2
   816
public:
williamr@2
   817
	/** 
williamr@2
   818
	 * @internalComponent
williamr@2
   819
	 *
williamr@2
   820
	 * Creates a new CX509CertPolicyInfo object from the specified buffer containing the 
williamr@2
   821
	 * binary coded representation.
williamr@2
   822
	 * 
williamr@2
   823
	 * @param aBinaryData	The encoded binary representation.
williamr@2
   824
	 * @return				The new CX509CertPolicyInfo object. 
williamr@2
   825
	 **/
williamr@2
   826
	static CX509CertPolicyInfo* NewL(const TDesC8& aBinaryData);
williamr@2
   827
	
williamr@2
   828
	/** 
williamr@2
   829
	 * @internalComponent
williamr@2
   830
	 *
williamr@2
   831
	 * Creates a new CX509CertPolicyInfo object from the specified buffer containing the 
williamr@2
   832
	 * binary coded representation, and puts a pointer to it onto the cleanup stack.
williamr@2
   833
	 * 
williamr@2
   834
	 * @param aBinaryData	The encoded binary representation.
williamr@2
   835
	 * @return				The new CX509CertPolicyInfo object. 
williamr@2
   836
	 **/
williamr@2
   837
	static CX509CertPolicyInfo* NewLC(const TDesC8& aBinaryData);
williamr@2
   838
	
williamr@2
   839
	/** 
williamr@2
   840
	 * @internalComponent
williamr@2
   841
	 * Creates a new CX509CertPolicyInfo object from the specified buffer containing the 
williamr@2
   842
	 * binary coded representation, starting at the specified offset.
williamr@2
   843
	 * 
williamr@2
   844
	 * @param aBinaryData	The encoded binary representation.
williamr@2
   845
	 * @param aPos			The offset position from which to start decoding.
williamr@2
   846
	 * @return				The new CX509CertPolicyInfo object. 
williamr@2
   847
	 **/
williamr@2
   848
	static CX509CertPolicyInfo* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   849
	
williamr@2
   850
	/** 
williamr@2
   851
	 * @internalComponent
williamr@2
   852
	 * 
williamr@2
   853
	 * Creates a new CX509CertPolicyInfo object from the specified buffer containing the 
williamr@2
   854
	 * binary coded representation, starting at the specified offset, and puts a 
williamr@2
   855
	 * pointer to it onto the cleanup stack.
williamr@2
   856
	 * 
williamr@2
   857
	 * @param aBinaryData	The encoded binary representation.
williamr@2
   858
	 * @param aPos			The offset position from which to start decoding.
williamr@2
   859
	 * @return				The new CX509CertPolicyInfo object. 
williamr@2
   860
	 **/
williamr@2
   861
	static CX509CertPolicyInfo* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   862
	
williamr@2
   863
	/** Creates a new CX509CertPolicyInfo object from an existing object.
williamr@2
   864
	* 
williamr@2
   865
	* This is equivalent to a copy constructor.	
williamr@2
   866
	* 
williamr@2
   867
	* @param aPolicy		The CX509CertPolicyInfo object to be copied.
williamr@2
   868
	* @return				The new CX509CertPolicyInfo object. */
williamr@2
   869
	IMPORT_C static CX509CertPolicyInfo* NewL(const CX509CertPolicyInfo& aPolicy);
williamr@2
   870
	
williamr@2
   871
	/** Creates a new CX509CertPolicyInfo object from an existing object, and puts a pointer 
williamr@2
   872
	* to it onto the cleanup stack.	
williamr@2
   873
	* 
williamr@2
   874
	* This is equivalent to a copy constructor.
williamr@2
   875
	* 
williamr@2
   876
	* @param aPolicy	The CX509CertPolicyInfo object to be copied.
williamr@2
   877
	* @return			The new CX509CertPolicyInfo object. */
williamr@2
   878
	IMPORT_C static CX509CertPolicyInfo* NewLC(const CX509CertPolicyInfo& aPolicy);
williamr@2
   879
	
williamr@2
   880
	/** Creates a new CX509CertPolicyInfo object from a stream. 
williamr@2
   881
	* 
williamr@2
   882
	* @return	The new CX509CertPolicyInfo object. */
williamr@2
   883
	IMPORT_C static CX509CertPolicyInfo* NewL(RReadStream& aStream);
williamr@2
   884
	
williamr@2
   885
	/** Creates a new CX509CertPolicyInfo object from a stream, and puts a pointer to it onto 
williamr@2
   886
	* the cleanup stack.
williamr@2
   887
	* 
williamr@2
   888
	* @return	The new CX509CertPolicyInfo object. */
williamr@2
   889
	IMPORT_C static CX509CertPolicyInfo* NewLC(RReadStream& aStream);
williamr@2
   890
	
williamr@2
   891
	/** Destructor.
williamr@2
   892
	* 
williamr@2
   893
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
   894
	virtual ~CX509CertPolicyInfo();
williamr@2
   895
	
williamr@2
   896
	/** Gets a reference to the array of policy qualifers.
williamr@2
   897
	* 
williamr@2
   898
	* @return	The array of policy qualifiers. */
williamr@2
   899
	IMPORT_C const CArrayPtrFlat<CX509PolicyQualifierInfo>& Qualifiers() const;
williamr@2
   900
	
williamr@2
   901
	/** Gets the specific policy's Object Identifier (OID).
williamr@2
   902
	* 
williamr@2
   903
	* @return	A pointer descriptor representing the specific policy's OID. */
williamr@2
   904
	IMPORT_C TPtrC Id() const;
williamr@2
   905
williamr@2
   906
williamr@2
   907
	// Internalization/Externalization
williamr@2
   908
	// Externalize. Writes the data out to a stream
williamr@2
   909
	/** Externalises an object of this class to a write stream.
williamr@2
   910
	* 
williamr@2
   911
	* The presence of this function means that the standard templated operator<<() 
williamr@2
   912
	* can be used to externalise objects of this class.
williamr@2
   913
	* 
williamr@2
   914
	* @param aStream	Stream to which the object should be externalised. */
williamr@2
   915
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   916
williamr@2
   917
	// Internalize. Reads the data from a stream 
williamr@2
   918
	/** Internalises an object of this class from a read stream.
williamr@2
   919
	* 
williamr@2
   920
	* The presence of this function means that the standard templated operator>>() 
williamr@2
   921
	* can be used to internalise objects of this class.
williamr@2
   922
	* 
williamr@2
   923
	* Note that this function has assignment semantics: it replaces the old value 
williamr@2
   924
	* of the object with a new value read from the read stream.	
williamr@2
   925
	* 
williamr@2
   926
	* @param aStream	Stream from which the object should be internalised. */
williamr@2
   927
	IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
   928
	
williamr@2
   929
williamr@2
   930
private:
williamr@2
   931
	CX509CertPolicyInfo();
williamr@2
   932
	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   933
	void ConstructL(const CX509CertPolicyInfo& aInfo);
williamr@2
   934
	void ConstructL(RReadStream& aStream);
williamr@2
   935
	HBufC* iCertPolicyId;//OID for this policy
williamr@2
   936
	CArrayPtrFlat<CX509PolicyQualifierInfo>* iQualifiers;
williamr@2
   937
	};
williamr@2
   938
williamr@2
   939
class CX509CertPoliciesExt : public CX509ExtensionBase
williamr@2
   940
/**  The policy under which this certificate has been issued.
williamr@2
   941
*
williamr@2
   942
* Contains further information on a client's signature.
williamr@2
   943
*
williamr@2
   944
* @publishedAll
williamr@2
   945
* @released
williamr@2
   946
* @since v6.0 */
williamr@2
   947
	{
williamr@2
   948
public:
williamr@2
   949
	/** Creates a new CX509CertPoliciesExt object from the specified buffer 
williamr@2
   950
	* containing the encoded binary representation.
williamr@2
   951
	* 
williamr@2
   952
	* @param aBinaryData	The encoded binary representation.
williamr@2
   953
	* @return				The CX509CertPoliciesExt object. */
williamr@2
   954
	IMPORT_C static CX509CertPoliciesExt* NewL(const TDesC8& aBinaryData);
williamr@2
   955
	
williamr@2
   956
	/** Creates a new CX509CertPoliciesExt object from the specified buffer 
williamr@2
   957
	* containing the encoded binary representation, and puts a pointer to it onto 
williamr@2
   958
	* the cleanup stack.
williamr@2
   959
	* 
williamr@2
   960
	* @param aBinaryData	The encoded binary representation.
williamr@2
   961
	* @return				The CX509CertPoliciesExt object. */
williamr@2
   962
	IMPORT_C static CX509CertPoliciesExt* NewLC(const TDesC8& aBinaryData);
williamr@2
   963
	
williamr@2
   964
	/** Creates a new CX509CertPoliciesExt object from the specified buffer 
williamr@2
   965
	* containing the encoded binary representation, starting at the specified offset.
williamr@2
   966
	* 
williamr@2
   967
	* @param aBinaryData	The encoded binary representation.
williamr@2
   968
	* @param aPos			The offset position from which to start decoding.
williamr@2
   969
	* @return				The CX509CertPoliciesExt object. */
williamr@2
   970
	IMPORT_C static CX509CertPoliciesExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   971
	
williamr@2
   972
	/** Creates a new CX509CertPoliciesExt object from the specified buffer 
williamr@2
   973
	* containing the encoded binary representation, and puts a pointer to it onto 
williamr@2
   974
	* the cleanup stack.
williamr@2
   975
	* 
williamr@2
   976
	* @param aBinaryData	The encoded binary representation.
williamr@2
   977
	* @param aPos			The offset position from which to start decoding.
williamr@2
   978
	* @return				The CX509CertPoliciesExt object. */
williamr@2
   979
	IMPORT_C static CX509CertPoliciesExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   980
	
williamr@2
   981
	/** Destructor.
williamr@2
   982
	* 
williamr@2
   983
	* Frees all resources owned by the object. */
williamr@2
   984
	virtual ~CX509CertPoliciesExt();
williamr@2
   985
	
williamr@2
   986
	/** Gets the certificate policy extension information.
williamr@2
   987
	* 
williamr@2
   988
	* @return	The certificate policy extension information. */
williamr@2
   989
	IMPORT_C const CArrayPtrFlat<CX509CertPolicyInfo>& Policies() const;
williamr@2
   990
private:
williamr@2
   991
	CX509CertPoliciesExt();
williamr@2
   992
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
   993
	CArrayPtrFlat<CX509CertPolicyInfo>* iPolicies;
williamr@2
   994
	};
williamr@2
   995
williamr@2
   996
//7) policy mapping
williamr@2
   997
williamr@2
   998
class CX509PolicyMapping : public CBase
williamr@2
   999
/** A set of policy mappings. 
williamr@2
  1000
* 
williamr@2
  1001
* @publishedAll
williamr@2
  1002
* @released
williamr@2
  1003
* @since v6.0 */
williamr@2
  1004
	{
williamr@2
  1005
public:
williamr@2
  1006
	/** 
williamr@2
  1007
	 * @internalComponent
williamr@2
  1008
	 *
williamr@2
  1009
	 * Creates a new CX509PolicyMapping object from the specified buffer containing 
williamr@2
  1010
	 * the encoded binary representation, and puts a pointer to it onto the cleanup stack.
williamr@2
  1011
	 * 
williamr@2
  1012
	 * @param aBinaryData	The encoded binary representation. 
williamr@2
  1013
	 **/
williamr@2
  1014
	static CX509PolicyMapping* NewL(const TDesC8& aBinaryData);
williamr@2
  1015
	
williamr@2
  1016
	/** 
williamr@2
  1017
	 * @internalComponent
williamr@2
  1018
	 *
williamr@2
  1019
	 * Creates a new CX509PolicyMapping object from the specified buffer containing 
williamr@2
  1020
	 * the encoded binary representation, and puts a pointer to it onto the cleanup stack.
williamr@2
  1021
	 * 
williamr@2
  1022
	 * @param aBinaryData	The encoded binary representation. 
williamr@2
  1023
	 **/
williamr@2
  1024
	static CX509PolicyMapping* NewLC(const TDesC8& aBinaryData);
williamr@2
  1025
	
williamr@2
  1026
	/** 
williamr@2
  1027
	 * @internalComponent
williamr@2
  1028
	 *
williamr@2
  1029
	 * Creates a new CX509PolicyMapping object from the specified buffer containing 
williamr@2
  1030
	 * the encoded binary representation, starting at the specified offset, and puts 
williamr@2
  1031
	 * a pointer to it onto the cleanup stack.
williamr@2
  1032
	 * 
williamr@2
  1033
	 * @param aBinaryData	The encoded binary representation.
williamr@2
  1034
	 * @param aPos			The position from which to start decoding. 
williamr@2
  1035
	 **/
williamr@2
  1036
	static CX509PolicyMapping* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1037
	
williamr@2
  1038
	/** 
williamr@2
  1039
	 * @internalComponent
williamr@2
  1040
	 * 
williamr@2
  1041
	 * Creates a new CX509PolicyMapping object from the specified buffer containing 
williamr@2
  1042
	 * the encoded binary representation, starting at the specified offset, and puts 
williamr@2
  1043
	 * a pointer to it onto the cleanup stack.
williamr@2
  1044
	 * 
williamr@2
  1045
	 * @param aBinaryData	The encoded binary representation.
williamr@2
  1046
	 * @param aPos			The position from which to start decoding. 
williamr@2
  1047
	 **/
williamr@2
  1048
	static CX509PolicyMapping* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1049
	
williamr@2
  1050
	/** Creates a new CX509PolicyMapping object copied from an existing one.
williamr@2
  1051
	* 
williamr@2
  1052
	* @param aMapping	The CX509PolicyMapping object to be copied. */
williamr@2
  1053
	IMPORT_C static CX509PolicyMapping* NewL(const CX509PolicyMapping& aMapping);
williamr@2
  1054
	
williamr@2
  1055
	/** Creates a new CX509PolicyMapping object copied from an existing one, and 
williamr@2
  1056
	* puts a pointer to the object onto the cleanup stack.
williamr@2
  1057
	* 
williamr@2
  1058
	* @param aMapping	The CX509PolicyMapping object to be copied. */
williamr@2
  1059
	IMPORT_C static CX509PolicyMapping* NewLC(const CX509PolicyMapping& aMapping);
williamr@2
  1060
	
williamr@2
  1061
	/** The destructor.
williamr@2
  1062
	* 
williamr@2
  1063
	* Frees all resources owned by the object. */
williamr@2
  1064
	virtual ~CX509PolicyMapping();
williamr@2
  1065
	
williamr@2
  1066
	/** Gets the issuer policy.
williamr@2
  1067
	* 
williamr@2
  1068
	* @return	The issuer policy. */
williamr@2
  1069
	IMPORT_C TPtrC IssuerPolicy() const;
williamr@2
  1070
	
williamr@2
  1071
	/** Gets the subject policy.
williamr@2
  1072
	* 
williamr@2
  1073
	* @return	The subject policy. */
williamr@2
  1074
	IMPORT_C TPtrC SubjectPolicy() const;
williamr@2
  1075
private:
williamr@2
  1076
	CX509PolicyMapping();
williamr@2
  1077
	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1078
	void ConstructL(const CX509PolicyMapping& aMapping);
williamr@2
  1079
	HBufC* iIssuerPolicy;
williamr@2
  1080
	HBufC* iSubjectPolicy;
williamr@2
  1081
	};
williamr@2
  1082
williamr@2
  1083
class CX509PolicyMappingExt : public CX509ExtensionBase
williamr@2
  1084
/** An X.509 certificate extension that contains a set of policy mappings.
williamr@2
  1085
*
williamr@2
  1086
* A policy mapping allows a Certification Authority to declare that two certificate 
williamr@2
  1087
* policies are equivalent.
williamr@2
  1088
*
williamr@2
  1089
* @publishedAll
williamr@2
  1090
* @released
williamr@2
  1091
* @since v6.0 */
williamr@2
  1092
	{
williamr@2
  1093
public:
williamr@2
  1094
	/** Creates a new CX509PolicyMappingExt object from the specified buffer containing 
williamr@2
  1095
	* the binary coded representation.
williamr@2
  1096
	* 
williamr@2
  1097
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1098
	* @return				The new CX509PolicyMappingExt object. */
williamr@2
  1099
	IMPORT_C static CX509PolicyMappingExt* NewL(const TDesC8& aBinaryData);
williamr@2
  1100
	
williamr@2
  1101
	/** Creates a new CX509PolicyMappingExt object from the specified buffer containing 
williamr@2
  1102
	* the binary coded representation, and puts a pointer to it onto the cleanup stack.
williamr@2
  1103
	* 
williamr@2
  1104
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1105
	* @return				The new CX509PolicyMappingExt object. */
williamr@2
  1106
	IMPORT_C static CX509PolicyMappingExt* NewLC(const TDesC8& aBinaryData);
williamr@2
  1107
	
williamr@2
  1108
	/** Creates a new CX509PolicyMappingExt object from the specified buffer containing 
williamr@2
  1109
	* the binary coded representation, starting at the specified offset.
williamr@2
  1110
	* 
williamr@2
  1111
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1112
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1113
	* @return				The new CX509PolicyMappingExt object. */
williamr@2
  1114
	IMPORT_C static CX509PolicyMappingExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1115
	
williamr@2
  1116
	/** Creates a new CX509PolicyMappingExt object from the specified buffer containing 
williamr@2
  1117
	* the binary coded representation, starting at the specified offset, and puts 
williamr@2
  1118
	* a pointer to it onto the cleanup stack.
williamr@2
  1119
	* 
williamr@2
  1120
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1121
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1122
	* @return				The new CX509PolicyMappingExt object. */
williamr@2
  1123
	IMPORT_C static CX509PolicyMappingExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1124
	
williamr@2
  1125
	/** Destructor.
williamr@2
  1126
	* 
williamr@2
  1127
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
  1128
	virtual ~CX509PolicyMappingExt();
williamr@2
  1129
	
williamr@2
  1130
	/** Gets a reference to the array of policy mappings.
williamr@2
  1131
	* 
williamr@2
  1132
	* @return	The array of policy mappings. */
williamr@2
  1133
	IMPORT_C const CArrayPtrFlat<CX509PolicyMapping>& Mappings() const;
williamr@2
  1134
private:
williamr@2
  1135
	CX509PolicyMappingExt();
williamr@2
  1136
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1137
	CArrayPtrFlat<CX509PolicyMapping>* iPolicies;
williamr@2
  1138
	};
williamr@2
  1139
williamr@2
  1140
//8) authority key ID
williamr@2
  1141
williamr@2
  1142
class CX509AuthorityKeyIdExt : public CX509ExtensionBase
williamr@2
  1143
/** An X.509 certificate extension that provides a way to find the public key corresponding 
williamr@2
  1144
* to the private key used to sign the certificate.
williamr@2
  1145
* 
williamr@2
  1146
* This is referred to as the authority key ID extension.
williamr@2
  1147
* 
williamr@2
  1148
* The key may be identified by the issuer's name and the issuing certificate's 
williamr@2
  1149
* serial number, or by a key identifier value either derived from the public 
williamr@2
  1150
* key or by some method of generating unique IDs. 
williamr@2
  1151
* 
williamr@2
  1152
* @publishedAll
williamr@2
  1153
* @released
williamr@2
  1154
* @since v6.0 */
williamr@2
  1155
	{
williamr@2
  1156
public:
williamr@2
  1157
	/** Creates a new CX509AuthorityKeyIdExt object from the specified buffer containing 
williamr@2
  1158
	* the binary coded representation.
williamr@2
  1159
	* 
williamr@2
  1160
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1161
	* @return				The new CX509AuthorityKeyIdExt object. */
williamr@2
  1162
	IMPORT_C static CX509AuthorityKeyIdExt* NewL(const TDesC8& aBinaryData);
williamr@2
  1163
	
williamr@2
  1164
	/** Creates a new CX509AuthorityKeyIdExt object from the specified buffer containing 
williamr@2
  1165
	* the binary coded representation, and puts a pointer to it onto the cleanup stack.
williamr@2
  1166
	* 
williamr@2
  1167
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1168
	* @return				The new CX509AuthorityKeyIdExt object. */
williamr@2
  1169
	IMPORT_C static CX509AuthorityKeyIdExt* NewLC(const TDesC8& aBinaryData);
williamr@2
  1170
	
williamr@2
  1171
	/** Creates a new CX509AuthorityKeyIdExt object from the specified buffer containing 
williamr@2
  1172
	* the binary coded representation, starting at the specified offset.
williamr@2
  1173
	* 
williamr@2
  1174
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1175
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1176
	* @return				The new CX509AuthorityKeyIdExt object. */
williamr@2
  1177
	IMPORT_C static CX509AuthorityKeyIdExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1178
	
williamr@2
  1179
	/** Creates a new CX509AuthorityKeyIdExt object from the specified buffer containing 
williamr@2
  1180
	* the binary coded representation, starting at the specified offset, and puts 
williamr@2
  1181
	* a pointer to it onto the cleanup stack.
williamr@2
  1182
	* 
williamr@2
  1183
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1184
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1185
	* @return				The new CX509AuthorityKeyIdExt object. */
williamr@2
  1186
	IMPORT_C static CX509AuthorityKeyIdExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1187
	
williamr@2
  1188
	/** Destructor.
williamr@2
  1189
	* 
williamr@2
  1190
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
  1191
	virtual ~CX509AuthorityKeyIdExt();
williamr@2
  1192
	
williamr@2
  1193
	/** Gets the authority name.
williamr@2
  1194
	* 
williamr@2
  1195
	* @return	The authority name. */
williamr@2
  1196
	IMPORT_C const CArrayPtrFlat<CX509GeneralName>& AuthorityName() const;
williamr@2
  1197
	
williamr@2
  1198
	/** Gets the authority certificate serial number.
williamr@2
  1199
	* 
williamr@2
  1200
	* @return	A pointer descriptor representing the authority certificate serial number. */
williamr@2
  1201
	IMPORT_C TPtrC8 AuthorityCertSerialNumber() const;
williamr@2
  1202
	
williamr@2
  1203
	/** Gets the key identifier value.
williamr@2
  1204
	* 
williamr@2
  1205
	* @return	A pointer descriptor representing the key identifier value. */
williamr@2
  1206
	IMPORT_C TPtrC8 KeyId() const;
williamr@2
  1207
private:
williamr@2
  1208
	CX509AuthorityKeyIdExt();
williamr@2
  1209
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1210
	void DecodeNameL(const TDesC8& aBinaryData);
williamr@2
  1211
	void DecodeSerialNoL(const TDesC8& aBinaryData);
williamr@2
  1212
	void DecodeKeyIdL(const TDesC8& aBinaryData);
williamr@2
  1213
	CArrayPtrFlat<CX509GeneralName>* iAuthorityName;
williamr@2
  1214
	HBufC8* iAuthorityCertSerialNumber;
williamr@2
  1215
	HBufC8* iKeyIdentifier;
williamr@2
  1216
	};
williamr@2
  1217
williamr@2
  1218
//9) subject key ID
williamr@2
  1219
williamr@2
  1220
class CX509SubjectKeyIdExt : public CX509ExtensionBase
williamr@2
  1221
/** An X.509 certificate extension that provides a way of identifying certificates
williamr@2
  1222
* that contain a specific public key.
williamr@2
  1223
* 
williamr@2
  1224
* This is referred to as the subject key ID extension.
williamr@2
  1225
* 
williamr@2
  1226
* It consists of a key identifier value either derived from the public key or
williamr@2
  1227
* by some method of generating unique IDs.
williamr@2
  1228
* 
williamr@2
  1229
* @publishedAll
williamr@2
  1230
* @released
williamr@2
  1231
* @since v6.0 */
williamr@2
  1232
	{
williamr@2
  1233
public:
williamr@2
  1234
	/** Creates a new CX509SubjectKeyIdExt object from the specified buffer containing 
williamr@2
  1235
	* the binary coded representation.
williamr@2
  1236
	* 
williamr@2
  1237
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1238
	* @return				The new CX509SubjectKeyIdExt object. */
williamr@2
  1239
	IMPORT_C static CX509SubjectKeyIdExt* NewL(const TDesC8& aBinaryData);
williamr@2
  1240
	
williamr@2
  1241
	/** Creates a new CX509SubjectKeyIdExt object from the specified buffer containing 
williamr@2
  1242
	* the binary coded representation, and puts a pointer to it onto the cleanup stack.
williamr@2
  1243
	* 
williamr@2
  1244
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1245
	* @return				The new CX509SubjectKeyIdExt object. */
williamr@2
  1246
	IMPORT_C static CX509SubjectKeyIdExt* NewLC(const TDesC8& aBinaryData);
williamr@2
  1247
	
williamr@2
  1248
	/** Creates a new CX509SubjectKeyIdExt object from the specified buffer containing 
williamr@2
  1249
	* the binary coded representation, starting at the specified offset.
williamr@2
  1250
	* 
williamr@2
  1251
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1252
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1253
	* @return				The new CX509SubjectKeyIdExt object. */
williamr@2
  1254
	IMPORT_C static CX509SubjectKeyIdExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1255
	
williamr@2
  1256
	/** Creates a new CX509SubjectKeyIdExt object from the specified buffer containing 
williamr@2
  1257
	* the binary coded representation, starting at the specified offset, and puts 
williamr@2
  1258
	* a pointer to it onto the cleanup stack.
williamr@2
  1259
	* 
williamr@2
  1260
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1261
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1262
	* @return				The new CX509SubjectKeyIdExt object. */
williamr@2
  1263
	IMPORT_C static CX509SubjectKeyIdExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1264
	
williamr@2
  1265
	/** Destructor.
williamr@2
  1266
	* 
williamr@2
  1267
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
  1268
	IMPORT_C ~CX509SubjectKeyIdExt();
williamr@2
  1269
	
williamr@2
  1270
	/** Gets the key ID.
williamr@2
  1271
	* 
williamr@2
  1272
	* @return	A pointer descriptor representing the key ID. */
williamr@2
  1273
	IMPORT_C TPtrC8 KeyId() const;
williamr@2
  1274
private:
williamr@2
  1275
	CX509SubjectKeyIdExt();
williamr@2
  1276
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1277
	HBufC8* iKeyIdentifier;
williamr@2
  1278
	};
williamr@2
  1279
williamr@2
  1280
//10) extended key usage
williamr@2
  1281
williamr@2
  1282
class CX509ExtendedKeyUsageExt : public CX509ExtensionBase
williamr@2
  1283
/** An X.509 certificate extension that defines the extra uses to which a key may be put.
williamr@2
  1284
* 
williamr@2
  1285
* This is referred to as the extended key usage extension. 
williamr@2
  1286
* 
williamr@2
  1287
* @publishedAll
williamr@2
  1288
* @released
williamr@2
  1289
* @since v6.0 */
williamr@2
  1290
	{
williamr@2
  1291
public:
williamr@2
  1292
	/** Creates a new CX509ExtendedKeyUsageExt object from the specified buffer 
williamr@2
  1293
	* containing the binary coded representation.
williamr@2
  1294
	* 
williamr@2
  1295
	* @param aBinaryData	The encoded binary data.
williamr@2
  1296
	* @return				The new CX509ExtendedKeyUsageExt object. */
williamr@2
  1297
	IMPORT_C static CX509ExtendedKeyUsageExt* NewL(const TDesC8& aBinaryData);
williamr@2
  1298
	
williamr@2
  1299
	/** Creates a new CX509ExtendedKeyUsageExt object from the specified buffer 
williamr@2
  1300
	* containing the binary coded representation, and puts a pointer to it onto 
williamr@2
  1301
	* the cleanup stack.
williamr@2
  1302
	* 
williamr@2
  1303
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1304
	* @return				The new CX509ExtendedKeyUsageExt object. */
williamr@2
  1305
	IMPORT_C static CX509ExtendedKeyUsageExt* NewLC(const TDesC8& aBinaryData);
williamr@2
  1306
	
williamr@2
  1307
	/** Creates a new CX509ExtendedKeyUsageExt object from the specified buffer 
williamr@2
  1308
	* containing the binary coded representation, starting at the specified offset.
williamr@2
  1309
	* 
williamr@2
  1310
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1311
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1312
	* @return				The new CX509ExtendedKeyUsageExt object. */
williamr@2
  1313
	IMPORT_C static CX509ExtendedKeyUsageExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1314
	
williamr@2
  1315
	/** Creates a new CX509ExtendedKeyUsageExt object from the specified buffer 
williamr@2
  1316
	* containing the binary coded representation, starting at the specified offset, 
williamr@2
  1317
	* and puts a pointer to it onto the cleanup stack.
williamr@2
  1318
	* 
williamr@2
  1319
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1320
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1321
	* @return				The new CX509ExtendedKeyUsageExt object. */
williamr@2
  1322
	IMPORT_C static CX509ExtendedKeyUsageExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1323
	
williamr@2
  1324
	/** Destructor.
williamr@2
  1325
	* 
williamr@2
  1326
	* Frees all resources owned by the object, prior to its destruction. */
williamr@2
  1327
	IMPORT_C ~CX509ExtendedKeyUsageExt();
williamr@2
  1328
	
williamr@2
  1329
	/** Gets the sequence of Object Ids (OID) that identify the key usages.
williamr@2
  1330
	* 
williamr@2
  1331
	* The sequence is held in a set of heap descriptors.
williamr@2
  1332
	* 
williamr@2
  1333
	* @return	A reference to the array of pointers to the heap descriptors that 
williamr@2
  1334
	* 	contain the OIDs. */
williamr@2
  1335
	IMPORT_C const CArrayPtrFlat<HBufC>& KeyUsages() const;
williamr@2
  1336
private:
williamr@2
  1337
	CX509ExtendedKeyUsageExt();
williamr@2
  1338
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1339
	CArrayPtrFlat<HBufC>* iKeyUsages;
williamr@2
  1340
	};
williamr@2
  1341
williamr@2
  1342
//11) authority information access
williamr@2
  1343
williamr@2
  1344
class CX509AccessDescription : public CBase
williamr@2
  1345
/** This class provides the access method OID and access location as used by X.509 private internet extensions
williamr@2
  1346
 * (authority information access).
williamr@2
  1347
 *
williamr@2
  1348
 * @publishedAll
williamr@2
  1349
 * @released 
williamr@2
  1350
 */
williamr@2
  1351
	{
williamr@2
  1352
public:
williamr@2
  1353
williamr@2
  1354
	/** 
williamr@2
  1355
	 * @internalComponent
williamr@2
  1356
	 * 
williamr@2
  1357
	 * Creates a new CX509AccessDescription object from the specified buffer 
williamr@2
  1358
	 * containing the binary coded representation.
williamr@2
  1359
	 * 
williamr@2
  1360
	 * @param aBinaryData	The encoded binary data.
williamr@2
  1361
	 * @return				The new CX509AccessDescription object. 
williamr@2
  1362
	 **/
williamr@2
  1363
	static CX509AccessDescription* NewL(const TDesC8& aBinaryData);
williamr@2
  1364
williamr@2
  1365
	/** 
williamr@2
  1366
	 * @internalComponent
williamr@2
  1367
	 *
williamr@2
  1368
	 * Creates a new CX509AccessDescription object from the specified buffer 
williamr@2
  1369
	 * containing the binary coded representation, and puts a pointer to it onto 
williamr@2
  1370
	 * the cleanup stack.
williamr@2
  1371
	 * 
williamr@2
  1372
	 * @param aBinaryData	The encoded binary representation.
williamr@2
  1373
	 * @return				The new CX509AccessDescription object. 
williamr@2
  1374
	 **/
williamr@2
  1375
	static CX509AccessDescription* NewLC(const TDesC8& aBinaryData);
williamr@2
  1376
williamr@2
  1377
	/** 
williamr@2
  1378
	 * @internalComponent
williamr@2
  1379
	 *
williamr@2
  1380
	 * Creates a new CX509AuthInfoAccessExt object from the specified buffer 
williamr@2
  1381
	 * containing the binary coded representation, starting at the specified offset.
williamr@2
  1382
	 * 
williamr@2
  1383
	 * @param aBinaryData	The encoded binary representation.
williamr@2
  1384
	 * @param aPos			The offset position from which to start decoding.
williamr@2
  1385
	 * @return				The new CX509AuthInfoAccessExt object. 
williamr@2
  1386
	 **/
williamr@2
  1387
	static CX509AccessDescription* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1388
williamr@2
  1389
	/**
williamr@2
  1390
	 * @internalComponent
williamr@2
  1391
	 *
williamr@2
  1392
	 *  Creates a new CX509AccessDescription object from the specified buffer 
williamr@2
  1393
	 * containing the binary coded representation, starting at the specified offset, 
williamr@2
  1394
	 * and puts a pointer to it onto the cleanup stack.
williamr@2
  1395
	 * 
williamr@2
  1396
	 * @param aBinaryData	The encoded binary representation.
williamr@2
  1397
	 * @param aPos			The offset position from which to start decoding.
williamr@2
  1398
	 * @return				The new CX509AccessDescription object. 
williamr@2
  1399
	 **/
williamr@2
  1400
	static CX509AccessDescription* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1401
williamr@2
  1402
	/** Destructor. Frees all resources owned by the object, prior to its destruction. 
williamr@2
  1403
	*/
williamr@2
  1404
	virtual ~CX509AccessDescription();
williamr@2
  1405
williamr@2
  1406
	/** Gets the Access Method OID.
williamr@2
  1407
	*
williamr@2
  1408
	* @return	A non modifiable pointer descriptor to point to the access method OID.
williamr@2
  1409
	*/
williamr@2
  1410
	IMPORT_C TPtrC Method() const; 
williamr@2
  1411
williamr@2
  1412
	/** Gets the Access Location field which specifies the location where the additional 
williamr@2
  1413
	* information of the CA can be obtained.
williamr@2
  1414
	*
williamr@2
  1415
	* @return	A reference to access location .
williamr@2
  1416
	*/
williamr@2
  1417
	IMPORT_C const CX509GeneralName& Location() const;
williamr@2
  1418
private:
williamr@2
  1419
	CX509AccessDescription();
williamr@2
  1420
	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1421
	HBufC* iMethodId;
williamr@2
  1422
	CX509GeneralName* iLocation;
williamr@2
  1423
	};
williamr@2
  1424
williamr@2
  1425
class CX509AuthInfoAccessExt : public CX509ExtensionBase
williamr@2
  1426
/** An X.509 certificate extension that defines the authority information access.
williamr@2
  1427
 * 
williamr@2
  1428
 * 
williamr@2
  1429
 * @publishedAll
williamr@2
  1430
 * @released
williamr@2
  1431
 */
williamr@2
  1432
williamr@2
  1433
	{
williamr@2
  1434
public:
williamr@2
  1435
williamr@2
  1436
	/** Creates a new CX509AuthInfoAccessExt object from the specified buffer 
williamr@2
  1437
	* containing the binary coded representation.
williamr@2
  1438
	* 
williamr@2
  1439
	* @param aBinaryData	The encoded binary data.
williamr@2
  1440
	* @return				The new CX509AuthInfoAccessExt object. 
williamr@2
  1441
	*/
williamr@2
  1442
	IMPORT_C static CX509AuthInfoAccessExt* NewL(const TDesC8& aBinaryData);
williamr@2
  1443
williamr@2
  1444
	/** Creates a new CX509AuthInfoAccessExt object from the specified buffer 
williamr@2
  1445
	* containing the binary coded representation, and puts a pointer to it onto 
williamr@2
  1446
	* the cleanup stack.
williamr@2
  1447
	* 
williamr@2
  1448
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1449
	* @return				The new CX509AuthInfoAccessExt object. 
williamr@2
  1450
	*/
williamr@2
  1451
	IMPORT_C static CX509AuthInfoAccessExt* NewLC(const TDesC8& aBinaryData);
williamr@2
  1452
williamr@2
  1453
	/** Creates a new CX509AuthInfoAccessExt object from the specified buffer 
williamr@2
  1454
	* containing the binary coded representation, starting at the specified offset.
williamr@2
  1455
	* 
williamr@2
  1456
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1457
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1458
	* @return				The new CX509AuthInfoAccessExt object. 
williamr@2
  1459
	*/
williamr@2
  1460
	IMPORT_C static CX509AuthInfoAccessExt* NewL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1461
williamr@2
  1462
	/** Creates a new CX509AuthInfoAccessExt object from the specified buffer 
williamr@2
  1463
	* containing the binary coded representation, starting at the specified offset, 
williamr@2
  1464
	* and puts a pointer to it onto the cleanup stack.
williamr@2
  1465
	* 
williamr@2
  1466
	* @param aBinaryData	The encoded binary representation.
williamr@2
  1467
	* @param aPos			The offset position from which to start decoding.
williamr@2
  1468
	* @return				The new CX509AuthInfoAccessExt object. 
williamr@2
  1469
	*/
williamr@2
  1470
	IMPORT_C static CX509AuthInfoAccessExt* NewLC(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1471
williamr@2
  1472
	/** Destructor. Frees all resources owned by the object, prior to its destruction. 
williamr@2
  1473
	*/
williamr@2
  1474
	IMPORT_C ~CX509AuthInfoAccessExt();
williamr@2
  1475
williamr@2
  1476
	/** Gets the authority access description containing the method and location of additional information of CA ,
williamr@2
  1477
	* who issued the certificate in which this extension appears.
williamr@2
  1478
	*
williamr@2
  1479
	* @return	A reference to the array of pointers to the authority access descriptions.
williamr@2
  1480
	*/
williamr@2
  1481
	IMPORT_C const CArrayPtrFlat<CX509AccessDescription>& AccessDescriptions() const;
williamr@2
  1482
private:
williamr@2
  1483
	CX509AuthInfoAccessExt();
williamr@2
  1484
	void DoConstructL(const TDesC8& aBinaryData, TInt& aPos);
williamr@2
  1485
	CArrayPtrFlat<CX509AccessDescription>* iAccessDescs;
williamr@2
  1486
	};
williamr@2
  1487
williamr@2
  1488
#endif