os/security/cryptoservices/certificateandkeymgmt/inc/x509keys.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200 (2014-06-10)
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 * X.509 key classes and utility classes for key encoding/decoding.
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file
    22  @publishedAll
    23  @released
    24 */
    25 
    26 #if !defined (__X509KEYS_H__)
    27 #define __X509KEYS_H__
    28 
    29 #include <e32base.h>
    30 #include <e32std.h>
    31 #include <asymmetrickeys.h>
    32 #include <asymmetric.h>
    33 #include <hash.h>
    34 #include <bigint.h>
    35 #include <signed.h>
    36 
    37 // Forward declarations
    38 class CASN1EncBase;
    39 class CASN1EncContainer;
    40 class CASN1EncSequence;
    41 class CASN1EncBitString;
    42 
    43 
    44 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    45 #include <x509keyencoder.h>
    46 #endif
    47 
    48 class CX509RSAPublicKey : public CRSAPublicKey
    49 /** Adds the capability to decode DER-encoded RSA public keys.
    50 *
    51 * Adds a commitment to a specific encoding scheme allowing X.509 RSA public key 
    52 * superclasses to remain encoding-independent.
    53 *
    54 *
    55 * @since v6.0 
    56 */
    57 	{
    58 public:
    59 	/** Creates a new RSA Public key object from the specified buffer containing the 
    60 	* encoded binary representation.
    61 	* 
    62 	* Initialises the object from its encoded binary form into an internal representation.
    63 	* 
    64 	* @param aBinaryData	The encoded binary representation.
    65 	* @return				A pointer to the new CX509RSAPublicKey object. */
    66 	IMPORT_C static CX509RSAPublicKey* NewL(const TDesC8& aBinaryData);
    67 	
    68 	/** Creates a new RSA Public Key object from the specified buffer containing the
    69 	* encoded binary representation, and puts a pointer to it onto the cleanup stack.
    70 	* 
    71 	* @param aBinaryData	The encoded binary representation.
    72 	* @return				A pointer to the new CX509RSAPublicKey object. */
    73 	IMPORT_C static CX509RSAPublicKey* NewLC(const TDesC8& aBinaryData);
    74 	
    75 	/** Creates a new RSA Public key object from the specified buffer containing the 
    76 	* encoded binary representation, starting at the specified offset.
    77 	* 
    78 	* @param aBinaryData	The encoded binary representation.
    79 	* @param aPos			The offset position from which to start decoding.
    80 	* @return				A pointer to the new CX509RSAPublicKey object. */
    81 	IMPORT_C static CX509RSAPublicKey* NewL(const TDesC8& aBinaryData, TInt& aPos);
    82 	
    83 	/** Creates a new RSA Public key object from the specified buffer containing the 
    84 	* encoded binary representation, starting at the specified offset, and puts 
    85 	* a pointer to it onto the cleanup stack.
    86 	* 
    87 	* @param aBinaryData	The encoded binary representation.
    88 	* @param aPos			The offset position from which to start decoding.
    89 	* @return				A pointer to the new CX509RSAPublicKey object. */
    90 	IMPORT_C static CX509RSAPublicKey* NewLC(const TDesC8& aBinaryData, TInt& aPos);
    91 private:
    92 	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
    93 	CX509RSAPublicKey();
    94 	};
    95 
    96 class TASN1EncRSAPublicKey
    97 /**
    98  * Class for encoding RSA public keys to ASN.1 encoding.
    99  * 
   100  * @since v8.0 
   101  */
   102 	{
   103 public:
   104 	/** 
   105 	 * Encodes the supplied public key into buffer in DER format ASN.1:
   106 	 * @code
   107 	 * 		SEQUENCE-OF
   108 	 * 			INTEGER modulus
   109 	 * 			INTEGER exponent
   110 	 * @endcode
   111 	 * 
   112 	 * @param aKey	Key to encode.
   113 	 * @return		Allocated buffer containing DER encoding of
   114 	 *     			the supplied key aKey.
   115 	 */
   116 	IMPORT_C HBufC8* EncodeDERL(const CRSAPublicKey& aKey) const;
   117 	};
   118 
   119 class TASN1DecRSAPublicKey
   120 /** 
   121  * Class for decoding RSA public keys from ASN.1 DER encoding.
   122  * 
   123  * @since v8.0
   124  */
   125 	{
   126 public:
   127 	/** 
   128 	 * Decodes an RSA key from the supplied buffer starting at the 
   129 	 * specified position.
   130 	 * 
   131 	 * @param aDER	Buffer containing DER ASN.1 encoding of the key.
   132 	 * @param aPos	Starting position in the buffer (updated on exit).
   133 	 * @return		A pointer to the new CRSAPublicKey object.
   134 	 */
   135 	IMPORT_C CRSAPublicKey* DecodeDERL(const TDesC8& aDER, TInt& aPos) const;
   136 	};
   137 
   138 class TASN1DecRSAKeyPair
   139 /** 
   140  * Class for decoding RSA key pairs from ASN.1 DER encoding.
   141  * 
   142  * @since v8.0
   143  */
   144 	{
   145 public:
   146 	/**
   147 	 * Decodes an RSA key pair from buffer containing ASN.1 
   148 	 * DER-encoded private key. The encoding of a private key 
   149 	 * contains public key components as well.
   150 	 * 
   151 	 * @param aDER			DER-encoded private key.
   152 	 * @param aPos			Position in the buffer to start decoding 
   153 	 *     					(updated on exit).
   154 	 * @param aPublicKey	On return, the RSA public key object
   155 	 * @param aPrivateKey	On return, the RSA private key object
   156 	 * @param aKeyType		Key type, default is @c EStandardCRT
   157 	 */
   158 	IMPORT_C void DecodeDERL(const TDesC8& aDER, TInt& aPos, 
   159 								CRSAPublicKey*& aPublicKey,
   160 								CRSAPrivateKey*& aPrivateKey, 
   161 								TRSAPrivateKeyType aKeyType = EStandardCRT);
   162 	};
   163 
   164 class CX509DSAPublicKey : public CDSAPublicKey
   165 /** Encapsulates the X.509 DSA public key.
   166 * 
   167 * Adds a commitment to a specific encoding scheme allowing superclasses to remain 
   168 * encoding-independent. 
   169 * 
   170 * @since v6.0 
   171 */
   172 // DSA public key, params, signature.
   173 	{
   174 public:
   175 	/** Creates a new X.509 DSA public key object.
   176 	* 
   177 	* @param aParamsData	A non-modifiable descriptor representing the entire encoding.
   178 	* @param aBinaryData	The encoded binary representation.
   179 	* @return				A pointer to the new CX509DSAPublicKey object. */
   180 	IMPORT_C static CX509DSAPublicKey* NewL(const TDesC8& aParamsData, const TDesC8& aBinaryData);
   181 
   182 	/** Creates a new X.509 DSA public key object, and puts a pointer to it onto the cleanup stack.
   183 	* 
   184 	* @param aParamsData	A non-modifiable descriptor representing the entire encoding.
   185 	* @param aBinaryData	The encoded binary representation.
   186 	* @return				A pointer to the new CX509DSAPublicKey object. */
   187 	IMPORT_C static CX509DSAPublicKey* NewLC(const TDesC8& aParamsData, const TDesC8& aBinaryData);
   188 	
   189 	/** Creates a new X.509 DSA public key object.
   190 	* 
   191 	* @param aParams		The DSA parameters.
   192 	* @param aBinaryData	The encoded binary representation. 
   193 	* @return 				A pointer to the new CX509DSAPublicKey object. */
   194 	IMPORT_C static CX509DSAPublicKey* NewL(const CDSAParameters& aParams, const TDesC8& aBinaryData);
   195 	
   196 	/** Creates a new X.509 DSA public key object, and puts a pointer to it onto the cleanup stack.
   197 	* 
   198 	* @param aParams		The DSA parameters.
   199 	* @param aBinaryData	The encoded binary representation. 
   200 	* @return 				A pointer to the new CX509DSAPublicKey object. */
   201 	IMPORT_C static CX509DSAPublicKey* NewLC(const CDSAParameters& aParams, const TDesC8& aBinaryData);
   202 	
   203 	/** Creates a new X.509 DSA public key object.
   204 	* 
   205 	* @param aParamsData	A non-modifiable descriptor representing the entire encoding.
   206 	* @param aBinaryData	The encoded binary representation.
   207 	* @param aPos			The position from which to start decoding.
   208 	* @return 				A pointer to the new CX509DSAPublicKey object. */
   209 	IMPORT_C static CX509DSAPublicKey* NewL(const TDesC8& aParamsData, const TDesC8& aBinaryData,TInt& aPos);
   210 	
   211 	/** Creates a new X.509 DSA public key object, and puts a pointer to it onto the cleanup stack.
   212 	* 
   213 	* @param aParamsData	A non-modifiable descriptor representing the entire encoding.	
   214 	* @param aBinaryData	The encoded binary representation.
   215 	* @param aPos			The position from which to start decoding.
   216 	* @return 				A pointer to the new CX509DSAPublicKey object. */
   217 	IMPORT_C static CX509DSAPublicKey* NewLC(const TDesC8& aParamsData, const TDesC8& aBinaryData, TInt& aPos);
   218 	
   219 	/** Creates a new X.509 DSA public key object.
   220 	* 
   221 	* @param aParams		The DSA parameters.
   222 	* @param aBinaryData	The encoded binary representation.
   223 	* @param aPos			The position from which to start decoding. 
   224 	* @return 				A pointer to the new CX509DSAPublicKey object. */
   225 	IMPORT_C static CX509DSAPublicKey* NewL(const CDSAParameters& aParams, const TDesC8& aBinaryData, TInt& aPos);
   226 	
   227 	/** Creates a new X.509 DSA public key object, and puts a pointer to it onto the cleanup stack.
   228 	* 
   229 	* @param aParams 		The DSA parameters.
   230 	* @param aBinaryData	The encoded binary representation.
   231 	* @param aPos			The position from which to start decoding. 
   232 	* @return				A pointer to the new CX509DSAPublicKey object. */
   233 	IMPORT_C static CX509DSAPublicKey* NewLC(const CDSAParameters& aParams, const TDesC8& aBinaryData, TInt& aPos);
   234 public:
   235 	/** Gets the DSA parameters from the encoding key.
   236 	* 
   237 	* @param aParamsData	A non-modifiable descriptor representing the entire encoding.
   238 	* @return 				The DSA parameters. */
   239 	IMPORT_C static CDSAParameters* DSAParametersL(const TDesC8& aParamsData);
   240 protected:
   241 	/** @internalComponent */
   242 	void ConstructL(const TDesC8& aParamsData, const TDesC8& aBinaryData, TInt& aPos);
   243 	/** @internalComponent */
   244 	void ConstructL(const CDSAParameters& aParams, const TDesC8& aBinaryData, TInt& aPos);
   245 	/** @internalComponent */
   246 	CX509DSAPublicKey();
   247 	};
   248  
   249 class TASN1DecDSAKeyPair
   250 /** 
   251  * Class for decoding DSA key pairs from ASN.1 DER encoding.
   252  * 
   253  * @since v8.0
   254  */
   255 	{
   256 public:
   257 	/**
   258 	 * Decodes a DSA key pair from a buffer containing an ASN.1 
   259 	 * DER-encoded private key. 
   260 	 * 
   261 	 * The encoding of the private key contains public key components as well. 
   262 	 * 
   263 	 * The DER encoding has the following format:
   264 	 * @verbatim
   265 	 *     SEQUENCE-OF
   266      *         INTEGER version (==0, ignored)
   267 	 *         INTEGER p (public prime)
   268 	 *         INTEGER q (160-bit public subprime, q | p-1)
   269 	 *         INTEGER g (public generator of subgroup)
   270 	 *         INTEGER x (private key)
   271 	 *         INTEGER y (public key y=g^x)
   272 	 * @endverbatim
   273 	 * 
   274 	 * @param aDER			DER-encoded private key.
   275 	 * @param aPos			Position in the buffer to start decoding 
   276 	 *		     			(updated on exit).
   277 	 * @param aPublicKey	On return, the DSA public key object
   278 	 * @param aPrivateKey	On return, the DSA private key object
   279 	 */
   280 	IMPORT_C void DecodeDERL(const TDesC8& aDER, TInt& aPos, 
   281 								CDSAPublicKey*& aPublicKey, CDSAPrivateKey*& aPrivateKey);
   282 	};
   283 
   284 /**
   285  * Class for encoding DSA public keys to ASN.1 encoding.
   286  * 
   287  * @since v8.0
   288  */
   289 class TASN1EncDSAPublicKey
   290 	{
   291 public:
   292 	/** 
   293 	 * Encodes the supplied public key into a buffer in DER format.
   294 	 * 
   295 	 * Note that the encoding has the following format:
   296 	 * @code
   297 	 *     SEQUENCE-OF
   298 	 *         SEQUENCE-OF
   299 	 *             INTEGER p
   300 	 *             INTEGER q
   301 	 *             INTEGER g
   302 	 *         BIT STRING (encoded INTEGER public value)
   303 	 * @endcode
   304 	 * 
   305 	 * @param aKey	Key to encode.
   306 	 * @return		Sequence containing public key information.
   307 	 */
   308 	IMPORT_C CASN1EncSequence* EncodeDERL(const CDSAPublicKey& aKey) const;
   309 
   310 	/**
   311 	 * Encodes DSA parameters into an ASN.1 encoding structure suitable for 
   312 	 * inclusion into other objects, like a PKCS#10 certificate request.
   313 	 *
   314 	 * Note that the encoding has the following form:
   315 	 * @code
   316 	 *     SEQUENCE-OF
   317 	 *         INTEGER p
   318 	 *         INTEGER q
   319 	 *         INTEGER g
   320 	 * @endcode
   321 	 *
   322 	 * @param aKey	DSA public key.
   323 	 * @return		ASN.1 encoding structure on the cleanup stack.
   324 	 */
   325 	IMPORT_C CASN1EncSequence* EncodeParamsLC(const CDSAPublicKey& aKey) const;
   326 
   327 	/** 
   328 	 * Encodes a public key as a bit string.
   329 	 *
   330 	 * @param aKey 	DSA public key.
   331 	 * @return	ASN.1 bit string (public key). This is left on the cleanup stack.
   332 	 */
   333 
   334 	IMPORT_C CASN1EncBitString* EncodePublicValueLC(const CDSAPublicKey& aKey) const;
   335 	};
   336 
   337 class CX509DSASignature : public CDSASignature
   338 /** Encapsulates the X.509 DSA signature.
   339 * 
   340 * Adds a commitment to a specific encoding scheme allowing superclasses to remain 
   341 * encoding-independent. 
   342 * 
   343 * @since v6.0 */
   344 	{
   345 public:
   346 	/** Creates a new DSA Signature object from the specified buffer containing the 
   347 	* encoded binary representation.
   348 	* 
   349 	* @param aBinaryData	The encoded binary representation.
   350 	* @return				A pointer to the new CX509DSASignature object. */
   351 	IMPORT_C static CX509DSASignature* NewL(const TDesC8& aBinaryData);
   352 	
   353 	/** Creates a new DSA Signature object from the specified buffer containing the 
   354 	* encoded binary representation, and puts a pointer to it onto the cleanup stack.
   355 	* 
   356 	* @param aBinaryData	The encoded binary representation.
   357 	* @return				A pointer to the new CX509DSASignature object. */
   358 	IMPORT_C static CX509DSASignature* NewLC(const TDesC8& aBinaryData);
   359 	
   360 	/** Creates a new DSA Signature object from the specified buffer containing the 
   361 	* encoded binary representation, starting at the specified offset.
   362 	* 
   363 	* @param aBinaryData	The encoded binary representation.
   364 	* @param aPos			The offset position from which to start decoding.
   365 	* @return				A pointer to the new CX509DSASignature object. */
   366 	IMPORT_C static CX509DSASignature* NewL(const TDesC8& aBinaryData, TInt& aPos);
   367 	
   368 	/** Creates a new DSA Signature object from the specified buffer containing the 
   369 	* encoded binary representation, starting at the specified offset, and puts 
   370 	* a pointer to it onto the cleanup stack.
   371 	* 
   372 	* @param aBinaryData	The encoded binary representation.
   373 	* @param aPos			The offset position from which to start decoding.
   374 	* @return				A pointer to the new CX509DSASignature object. */
   375 	IMPORT_C static CX509DSASignature* NewLC(const TDesC8& aBinaryData, TInt& aPos);
   376 private:
   377 	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
   378 	CX509DSASignature();
   379 	};
   380 
   381 class CX509DHPublicKey : public CDHPublicKey
   382 /** Provides clients with the information they need for Diffie-Hellman key exchange 
   383 * within a protocol. 
   384 * 
   385 * @since v6.0 */
   386 	{
   387 public:
   388 	/** Creates a new CX509DHPublicKey object from the specified buffer containing the encoded 
   389 	* binary representation.
   390 	* 
   391 	* @param aParamsData	A non-modifiable descriptor representing the entire encoding.
   392 	* @param aKeyData 		
   393 	* @return 				A pointer to the new CX509DHPublicKey object.*/
   394 	IMPORT_C static CX509DHPublicKey* NewL(const TDesC8& aParamsData, const TDesC8& aKeyData);
   395 
   396 	/** Creates a new CX509DHPublicKey object from the specified buffer containing the encoded 
   397 	* binary representation, and puts a pointer to it onto the cleanup stack.
   398 	* 
   399 	* @param aParamsData	A non-modifiable descriptor representing the entire encoding.
   400 	* @param aKeyData 		
   401 	* @return 				A pointer to the new CX509DHPublicKey object.*/
   402 	IMPORT_C static CX509DHPublicKey* NewLC(const TDesC8& aParamsData, const TDesC8& aKeyData);
   403 public:
   404 	/** Destructor.
   405 	* 
   406 	* Frees all resources owned by the object, prior to its destruction. */
   407 	IMPORT_C virtual ~CX509DHPublicKey();
   408 protected:
   409 	/** @internalComponent */
   410 	CX509DHPublicKey();
   411 	/** @internalComponent */
   412 	void ConstructL(const TDesC8& aParamsData, const TDesC8& aKeyData);
   413 	};
   414 
   415 class CX509DHKeyPair : public CDHKeyPair
   416 /** This class represents the Diffie-Hellman Key Pair.
   417 *
   418 * @since v8.0 */
   419 {
   420 public:
   421 	/** Creates a new DH key pair object from the specified buffer containing 
   422 	* the encoded binary representation .
   423 	*  
   424 	* @param aParamsData	A non-modifiable descriptor representing the entire encoding.
   425 	* @return				A pointer to the new CX509DHKeyPair object.
   426 	*/
   427 	IMPORT_C static CX509DHKeyPair* NewL(const TDesC8& aParamsData);
   428 
   429 	/** Creates a new DH Key Pair object from the specified buffer containing the encoded binary  
   430 	* representation, and puts a pointer to it onto the cleanup stack.
   431 	*
   432 	* @param aParamsData	A non-modifiable descriptor representing the entire encoding.
   433 	* @return				A pointer to the new CX509DHKeyPair object.
   434 	*/
   435 	IMPORT_C static CX509DHKeyPair* NewLC(const TDesC8& aParamsData);
   436 public:
   437 
   438 	/** Virtual Destructor.
   439 	* Frees all resources owned by the object, prior to its destruction. 
   440 	*
   441 	*/
   442 	IMPORT_C virtual ~CX509DHKeyPair();
   443 protected:
   444 	/** @internalComponent */
   445 	CX509DHKeyPair();
   446 	/** @internalComponent */
   447 	void ConstructL(const TDesC8& aParamsData);
   448 };
   449 
   450 class CX509DHValidationParams : public CBase
   451 /** Validates Diffie-Hellman (DH) Domain parameters.
   452 * 
   453 * Provides access to the DH Validation Parameters, which are used to determine 
   454 * if the DH Public Key has been generated in conformance with the algorithm 
   455 * specified in ESDH (see RFC 2631). 
   456 * 
   457 * @since v6.0 */
   458 	{
   459 public:
   460 	/** Creates a new DH Validation parameters object from the specified buffer containing 
   461 	* the encoded binary representation.
   462 	* 
   463 	* @param aBinaryData	The encoded binary representation.
   464 	* @return				A pointer to the new CX509DHValidationParams object. */
   465 	IMPORT_C static CX509DHValidationParams* NewL(const TDesC8& aBinaryData);
   466 	
   467 	/** Creates a new DH Validation parameters object from the specified buffer containing 
   468 	* the encoded binary representation, and puts a pointer to it onto the cleanup stack.
   469 	* 
   470 	* @param aBinaryData	The encoded binary representation.
   471 	* @return				A pointer to the new CX509DHValidationParams object. */
   472 	IMPORT_C static CX509DHValidationParams* NewLC(const TDesC8& aBinaryData);
   473 	
   474 	/** Creates a new DH Validation parameters object from the specified buffer containing 
   475 	* the encoded binary representation, starting at the specified offset.
   476 	* 
   477 	* @param aBinaryData	The encoded binary representation.
   478 	* @param aPos			The offset position from which to start decoding.
   479 	* @return				A pointer to the new CX509DHValidationParams object. */
   480 	IMPORT_C static CX509DHValidationParams* NewL(const TDesC8& aBinaryData, TInt& aPos);
   481 	
   482 	/** Creates a new DH Validation parameters object from the specified buffer containing 
   483 	* the encoded binary representation, starting at the specified offset, and puts 
   484 	* a pointer to it onto the cleanup stack.
   485 	* 
   486 	* @param aBinaryData	The encoded binary representation.
   487 	* @param aPos			The offset position from which to start decoding.
   488 	* @return				A pointer to the new CX509DHValidationParams object. */
   489 	IMPORT_C static CX509DHValidationParams* NewLC(const TDesC8& aBinaryData, TInt& aPos);
   490 	
   491 	/** Gets a DSA prime generation seed.
   492 	* 
   493 	* @return	The bit string parameter used as the seed. */
   494 	IMPORT_C const TPtrC8 Seed() const;
   495 	
   496 	/** Gets the output from a DSA prime generation counter.
   497 	* 
   498 	* @return	The integer value output. */
   499 	IMPORT_C const TInteger& PGenCounter() const;
   500 	
   501 	/** Destructor.
   502 	* 
   503 	* Frees all resources owned by the object, prior to its destruction. */
   504 	virtual ~CX509DHValidationParams();
   505 protected:
   506 	/** @internalComponent */
   507 	CX509DHValidationParams();
   508 	/** @internalComponent */
   509 	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
   510 	HBufC8* iSeed;
   511 	RInteger iPGenCounter;
   512 	};
   513 
   514 class CX509DHDomainParams : public CBase
   515 /** Encapsulates the compulsory Diffie-Hellman domain parameter values P and G 
   516 * (See RFC 2459). 
   517 * 
   518 * @since v6.0 */
   519 	{
   520 public:
   521 	/** Creates a new DH Domain parameters object from the specified buffer containing 
   522 	* the encoded binary representation.
   523 	* 
   524 	* @param aBinaryData	The encoded binary representation.
   525 	* @return				A pointer to the new CX509DHDomainParams object. */
   526 	IMPORT_C static CX509DHDomainParams* NewL(const TDesC8& aBinaryData);
   527 	
   528 	/** Creates a new DH Domain parameters object from the specified buffer containing 
   529 	* the encoded binary representation, and puts a pointer to it onto the cleanup stack.
   530 	* 
   531 	* @param aBinaryData	The encoded binary representation.
   532 	* @return				A pointer to the new CX509DHDomainParams object. */
   533 	IMPORT_C static CX509DHDomainParams* NewLC(const TDesC8& aBinaryData);
   534 	
   535 	/** Creates a new DH Domain parameters object from the specified buffer containing 
   536 	* the encoded binary representation, starting at the specified offset.
   537 	* 
   538 	* @param aBinaryData	The encoded binary representation.
   539 	* @param aPos			The offset position from which to start decoding.
   540 	* @return				A pointer to the new CX509DHDomainParams object. */
   541 	IMPORT_C static CX509DHDomainParams* NewL(const TDesC8& aBinaryData, TInt& aPos);
   542 	
   543 	/** Creates a new DH Domain parameters object from the specified buffer containing 
   544 	* the encoded binary representation, starting at the specified offset, and puts 
   545 	* a pointer to it onto the cleanup stack.
   546 	* 
   547 	* @param aBinaryData	The encoded binary representation.
   548 	* @param aPos			The offset position from which to start decoding.
   549 	* @return				A pointer to the new CX509DHDomainParams object. */
   550 	IMPORT_C static CX509DHDomainParams* NewLC(const TDesC8& aBinaryData, TInt& aPos);
   551 	
   552 	/** Gets the compulsory parameter value P.
   553 	* 
   554 	* @return	The compulsory parameter value P. */
   555 	IMPORT_C const TInteger& P() const;	
   556 	
   557 	/** Gets the compulsory parameter value G.
   558 	* 
   559 	* @return	The compulsory parameter value G. */
   560 	IMPORT_C const TInteger& G() const;	
   561 
   562 //the next 3 members are optional, in which case NULL is returned
   563 //the returned objects remain the property of this object
   564 
   565 //N.B. according to RFC 2459 the Q member is *not* optional, 
   566 //however it is not essential for doing DH, and empirical studies
   567 //suggest it doesn't get included much, so I'm relaxing the spec here
   568 //to permit DomainParams objects which contain no Q.
   569 
   570 	/** Gets the optional value Q.
   571 	* 
   572 	* @return	The optional value Q. */
   573 	IMPORT_C const TInteger& Q() const;	
   574 	
   575 	/** Gets the optional value J.
   576 	* 
   577 	* @return	The optional value J. */
   578 	IMPORT_C const TInteger& J() const;									
   579 	
   580 	/** Gets the optional validation parameters.
   581 	* 
   582 	* @return	The optional validation parameters. */
   583 	IMPORT_C const CX509DHValidationParams* ValidationParams() const;
   584 	
   585 	/** Destructor.
   586 	* 
   587 	* Frees all resources owned by the object, prior to its destruction. */
   588 	virtual ~CX509DHDomainParams();
   589 protected:
   590 	/** @internalComponent */
   591 	CX509DHDomainParams();
   592 	/** @internalComponent */
   593 	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
   594 	RInteger iP;
   595 	RInteger iG;
   596 	RInteger iQ;
   597 	RInteger iJ;
   598 	CX509DHValidationParams* iValidationParams;
   599 	};
   600 
   601 #endif