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