os/security/cryptoservices/certificateandkeymgmt/inc/signed.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 *
    16 */
    17 
    18 
    19 /**
    20  @file 
    21  @publishedAll
    22  @released
    23 */
    24  
    25 #ifndef __SIGNED_H__
    26 #define __SIGNED_H__
    27 
    28 #include <e32base.h>
    29 #include <e32std.h>
    30 #include <s32std.h>
    31 #include <securitydefs.h>
    32 
    33 class CRSAPublicKey;
    34 class CDSAPublicKey;
    35 class CDSASignature;
    36 class CDSAParameters;
    37 
    38 /**  Enumerates the identity of the algorithm.
    39  *
    40  */
    41 enum TAlgorithmId
    42 	{
    43 	/** An RSA algorithm. */
    44 	ERSA,
    45 	/** A DSA algorithm. */
    46 	EDSA,
    47 	/** A DH algorithm. */
    48 	EDH,
    49 	/** A MD2 algorithm. */
    50 	EMD2,
    51 	/** A MD5 algorithm. */
    52 	EMD5,
    53 	/** A SHA-1 algorithm. */
    54 	ESHA1,
    55 	/** A SHA-224 algorithm. */
    56 	ESHA224,
    57 	/** A SHA-256 algorithm. */
    58 	ESHA256,
    59 	/** A SHA-384 algorithm. */
    60 	ESHA384,
    61 	/** A SHA-512 algorithm. */
    62 	ESHA512
    63 	};
    64 
    65 class CValidityPeriod : public CBase
    66 /** The period for which the certificate is valid. 
    67 * 
    68 * @since v6.0 */
    69 	{
    70 public:
    71 	/** Tests whether the specified date and time is within the validity period.
    72 	* 
    73 	* @param aTime	The date and time to be tested.
    74 	* @return 		ETrue, if the date and time is within the validity period;
    75 	* 				EFalse, otherwise. */
    76 	IMPORT_C TBool Valid(const TTime& aTime) const;
    77 
    78 	/** Gets the start of the validity period.
    79 	* 
    80 	* @return	The start date and time. */
    81 	IMPORT_C const TTime& Start() const;
    82 
    83 	/** Gets the end of the validity period.
    84 	* 
    85 	* @return	The end date and time. */
    86 	IMPORT_C const TTime& Finish() const;
    87 
    88 	/** Copy constructor.
    89 	* 
    90 	* @param aValidityPeriod	The validity period object to be copied. */
    91 	IMPORT_C CValidityPeriod(const CValidityPeriod& aValidityPeriod);
    92 
    93 protected:
    94 	/** Default constructor. */
    95 	IMPORT_C CValidityPeriod();
    96 
    97 	/** The start time of the validity period. */
    98 	TTime iStart;
    99 
   100 	/** The end time of the validity period. */
   101 	TTime iFinish;
   102 	};
   103 
   104 class CAlgorithmIdentifier : public CBase
   105 /** Contains an algorithm ID and any encoded parameters required by that algorithm.
   106 * 
   107 * An object of this type creates and owns a heap descriptor to contain the encoded 
   108 * parameters. 
   109 * 
   110 * @since v6.0 */
   111 	{
   112 public:
   113 	/** Creates a new algorithm ID object copied from an existing object.	
   114 	* 
   115 	* @param aAlgorithmIdentifier	The algorithm ID object to be copied. 
   116 	* @return 						A pointer to the new algorithm ID object. */
   117 	IMPORT_C static CAlgorithmIdentifier* NewL(const CAlgorithmIdentifier& aAlgorithmIdentifier);
   118 
   119 	/** Creates a new algorithm ID object copied from an existing object, and puts 
   120 	* a pointer to the new object onto the cleanup stack.
   121 	* 
   122 	* @param aAlgorithmIdentifier	The algorithm ID object to be copied. 
   123 	* @return 						A pointer to the new algorithm ID object. */
   124 	IMPORT_C static CAlgorithmIdentifier* NewLC(const CAlgorithmIdentifier& aAlgorithmIdentifier);
   125 
   126 	/** Creates a new algorithm ID object.
   127 	* 
   128 	* @param aAlgorithmId	The algorithm ID.
   129 	* @param aEncodedParams	The encoded parameters.
   130 	* @return 				A pointer to the new algorithm ID object. */
   131 	IMPORT_C static CAlgorithmIdentifier* NewL(TAlgorithmId& aAlgorithmId, const TDesC8& aEncodedParams);
   132 
   133 	/** Creates a new algorithm ID object, and puts a pointer to the new object onto 
   134 	* the cleanup stack.
   135 	* 
   136 	* @param aAlgorithmId	The algorithm ID.
   137 	* @param aEncodedParams	The encoded parameters.
   138 	* @return 				A pointer to the new algorithm ID object. */
   139 	IMPORT_C static CAlgorithmIdentifier* NewLC(TAlgorithmId& aAlgorithmId, const TDesC8& aEncodedParams);
   140 	
   141 	/** Tests whether this algorithm identifier object is equal to the specified algorithm 
   142 	* identifier object. 
   143 	* 
   144 	* @param aAlgorithmIdentifier	The algorithm identifier object to be compared.
   145 	* @return 						ETrue, if this algorithm identifier object is equal to the specified 
   146 	* 								algorithm identifier object; EFalse otherwise. */
   147 	IMPORT_C TBool operator == (const CAlgorithmIdentifier& aAlgorithmIdentifier) const;
   148 	
   149 	/** Gets the algorithm identifier.
   150 	* 
   151 	* @return	The algorithm identifier. */
   152 	IMPORT_C TAlgorithmId Algorithm() const;	//ID for the algorithm
   153 	
   154 	/** Gets the encoded parameters for the algorithm identifier.
   155 	* 
   156 	* Note that this object owns the heap descriptor that owns the encoded parameters.
   157 	* 
   158 	* @return 	The encoded parameters. */
   159 	IMPORT_C TPtrC8 EncodedParams() const;				//the encoded parameters
   160 	
   161 	/** Destructor.
   162 	*
   163 	* Frees all resources owned by the object. */
   164 	IMPORT_C ~CAlgorithmIdentifier();
   165 
   166 protected:
   167 	/** Default constructor. */
   168 	IMPORT_C CAlgorithmIdentifier();
   169 
   170 	/** Constructor taking the specified parameters.
   171 	* 
   172 	* @param aAlgorithmId	The algorithm ID. */
   173 	IMPORT_C CAlgorithmIdentifier(TAlgorithmId& aAlgorithmId);
   174 	
   175 	/** Second-phase constructor taking an existing algorithm identifier object.
   176 	* 
   177 	* @param aAlgorithmIdentifier	The algorithm identifier object. */
   178 	IMPORT_C virtual void ConstructL(const CAlgorithmIdentifier& aAlgorithmIdentifier);
   179 	
   180 	/** Second-phase constructor taking encoded parameters.
   181 	* 
   182 	* @param aEncodedParams	The encoded parameters. */
   183 	IMPORT_C virtual void ConstructL(const TDesC8& aEncodedParams);
   184 	
   185 	/** The algorithm ID. */
   186 	TAlgorithmId iAlgorithmId;
   187 	
   188 	/** The encoded parameters for the algorithm ID. */
   189 	HBufC8* iEncodedParams;
   190 	};
   191 
   192 class CSigningAlgorithmIdentifier : public CBase
   193 /** Contains two CAlgorithmIdentifier objects for comparison purposes.
   194 * 
   195 * Implements an equality operator. 
   196 * 
   197 * @since v6.0 */
   198 	{
   199 public:
   200 	/** Constructs a new Signing Algorithm Identifier object, copying an existing Signing 
   201 	* Algorithm Identifier object.
   202 	* 
   203 	* @param aSigningAlgorithmIdentifier	The Signing Algorithm Identifier object.
   204 	* @return								The new Signing Algorithm Identifier object. */
   205 	IMPORT_C static CSigningAlgorithmIdentifier* NewL(const CSigningAlgorithmIdentifier& aSigningAlgorithmIdentifier);
   206 	
   207 	/** Constructs a new Signing Algorithm Identifier object, copying an existing Signing 
   208 	* Algorithm Identifier object, and puts a pointer to it onto the cleanup stack.
   209 	* 
   210 	* @param aSigningAlgorithmIdentifier	The Signing Algorithm Identifier object.
   211 	* @return 								The new Signing Algorithm Identifier object. */
   212 	IMPORT_C static CSigningAlgorithmIdentifier* NewLC(const CSigningAlgorithmIdentifier& aSigningAlgorithmIdentifier);
   213 	
   214 	/** Tests whether the Signing Algorithm Identifier object is equal to the specified 
   215 	* Signing Algorithm Identifier object.
   216 	* 
   217 	* @param aSigningAlgorithmIdentifier  The Signing Algorithm Identifier object to be compared.
   218 	* @return 							  ETrue, if this object's Signing Algorithm Identifier value 
   219 	* 									  is equal to the specified Signing Algorithm Identifier 
   220 	*									  object's value; EFalse, otherwise. */
   221 	IMPORT_C TBool operator == (const CSigningAlgorithmIdentifier& aSigningAlgorithmIdentifier) const;
   222 	
   223 	/** Gets the signature ID of the asymmetric algorithm.
   224 	* 
   225 	* @return	The signature ID of the asymmetric algorithm. */
   226 	IMPORT_C const CAlgorithmIdentifier& AsymmetricAlgorithm() const;
   227 	
   228 	/** Gets the signature ID of the digest algorithm.
   229 	* 
   230 	* @return	The signature ID of the digest algorithm. */
   231 	IMPORT_C const CAlgorithmIdentifier& DigestAlgorithm() const;
   232 	
   233 	/** Destructor.
   234 	* 
   235 	* Frees all resources owned by the object, prior to its destruction. */
   236 	IMPORT_C ~CSigningAlgorithmIdentifier();
   237 
   238 protected:
   239 	/** Second-phase constructor.
   240 	 * @internalAll
   241 	 */
   242 	void ConstructL(const CSigningAlgorithmIdentifier& aSigningAlgorithmIdentifier);
   243 	
   244 	/** The signature ID of the asymmetric algorithm. */
   245 	CAlgorithmIdentifier* iAsymmetricAlgorithm;
   246 
   247 	/** The signature ID of the digest algorithm. */
   248 	CAlgorithmIdentifier* iDigestAlgorithm;
   249 	};
   250 
   251 class CSubjectPublicKeyInfo : public CBase
   252 /** A base class for a container that holds information about a subject public key.
   253 * 
   254 * It contains the algorithm ID, the encoded public key and the encoded parameters. 
   255 * 
   256 * @since v6.0 
   257 */
   258 //algorithm ID + encoded public key + encoded parameters
   259 	{
   260 public:
   261 	/** Creates a new subject public key object copied from an existing object.	
   262 	* 
   263 	* @param aSubjectPublicKeyInfo 	The subject public key object to be copied.
   264 	* @return 						A pointer to the new public key object. */
   265 	IMPORT_C static CSubjectPublicKeyInfo* NewL(const CSubjectPublicKeyInfo& aSubjectPublicKeyInfo);
   266 	
   267 	/** Creates a new subject public key object copied from an existing object and 
   268 	* puts a pointer to the new object onto the cleanup stack.	
   269 	* 
   270 	* @param aSubjectPublicKeyInfo 	The subject public key object to be copied.
   271 	* @return 						A pointer to the new public key object. */
   272 	IMPORT_C static CSubjectPublicKeyInfo* NewLC(const CSubjectPublicKeyInfo& aSubjectPublicKeyInfo);
   273 	
   274 	/** Gets the algorithm ID.
   275 	* 
   276 	* @return	The algorithm ID. */
   277 	IMPORT_C TAlgorithmId AlgorithmId() const;
   278 	
   279 	/** Gets the encoded parameters required by the algorithm.	
   280 	* 
   281 	* @return	A non-modifiable pointer descriptor representing the encoded parameters. */
   282 	IMPORT_C const TPtrC8 EncodedParams() const;
   283 	
   284 	/** Gets the encoded public key data.
   285 	* 
   286 	* @return 	A non-modifiable pointer descriptor representing the encoded public 
   287 	* 			key data. */
   288 	IMPORT_C const TPtrC8 KeyData() const;
   289 	
   290 	/** Destructor.
   291 	*
   292 	* Frees all resources owned by the object. */
   293 	IMPORT_C ~CSubjectPublicKeyInfo();
   294 protected:
   295 	/** Second-phase constructor.
   296 	* 
   297 	* @param aSubjectPublicKeyInfo	The subject public key object to be copied. */
   298 	IMPORT_C virtual void ConstructL(const CSubjectPublicKeyInfo& aSubjectPublicKeyInfo);
   299 	
   300 	/** The algorithm ID. */
   301 	CAlgorithmIdentifier* iAlgId;
   302 	
   303 	/** A heap descriptor representing the encoded key data. */
   304 	HBufC8* iEncodedKeyData;
   305 	};
   306 
   307 class CRSASignatureResult : public CBase
   308 /** The RSA public key algorithm signature result.
   309 * 
   310 * Derived classes:
   311 * @li CWTLSRSASignatureResult
   312 * @li CPKCS1SignatureResult.
   313 *
   314 * @see TKeyFactory::RSASignatureResultL()
   315 *
   316 * @since v6.0 */
   317 	{
   318 public:
   319 	/** Tests whether the signature result is valid.
   320 	* 
   321 	* @param aResult	The signature result.
   322 	* @return			ETrue if the signature result is valid, otherwise EFalse. */
   323 	IMPORT_C virtual TBool VerifyL(const TDesC8& aResult) = 0;
   324 	
   325 	/** Destructor.
   326 	*
   327 	* Frees all resources owned by the object. */
   328 	IMPORT_C ~CRSASignatureResult();
   329 protected:
   330 	/** Compares this RSA Signature Result object with the specified RSA Signature 
   331 	* Result object for equality.
   332 	*
   333 	* @param aResult 	The RSA Signature Result object to be compared.
   334 	* @return 			ETrue, if they are the same; EFalse, otherwise. */
   335 	IMPORT_C TBool operator == (const CRSASignatureResult& aResult) const;
   336 	
   337 	/** The digest algorithm ID. */
   338 	CAlgorithmIdentifier* iDigestAlgorithm;
   339 	
   340 	/** A heap descriptor representing the digest algorithm. */
   341 	HBufC8* iDigest;
   342 	};
   343 
   344 //signed object
   345 class TKeyFactory
   346 /** Constructs the public key objects used for signature verification from their 
   347 * encoded binary form. 
   348 * 
   349 * @since v6.0 */
   350 	{
   351 public:
   352 	/** Gets the RSA public key.
   353 	* 
   354 	* @param aEncoding 	A non-modifiable descriptor representing the entire encoding.
   355 	* @return 			The RSA Public key. */
   356 	virtual CRSAPublicKey* RSAPublicKeyL(const TDesC8& aEncoding) const = 0;
   357 	
   358 	/** Gets the RSA signature result.
   359 	* 
   360 	* @param aDigestAlgorithm 	The algorithm ID.
   361 	* @param aDigest 			A non-modifiable descriptor representing the digest algorithm.
   362 	* @return 					The RSA signature result. */
   363 	virtual CRSASignatureResult* RSASignatureResultL(const CAlgorithmIdentifier& aDigestAlgorithm, TDesC8& aDigest) const = 0;
   364 	
   365 	/** Gets the DSA public key.
   366 	* 
   367 	* @param aParams 	The DSA parameters
   368 	* @param aEncoding 	A non-modifiable descriptor representing the entire encoding.
   369 	* @return 			The DSA public key. */
   370 	virtual CDSAPublicKey* DSAPublicKeyL(const CDSAParameters& aParams, const TDesC8& aEncoding) const = 0;
   371 	
   372 	/** Gets the digital DSA signature given an encoding key.
   373 	* 
   374 	* @param aEncoding 	A non-modifiable descriptor representing the entire encoding.
   375 	* @return 			The DSA signature. */
   376 	virtual CDSASignature* DSASignatureL(const TDesC8& aEncoding) const = 0;
   377 	
   378 	/** Gets the DSA parameters.
   379 	* 
   380 	* @param aEncoding 	A non-modifiable descriptor representing the entire encoding.
   381 	* @return 			The DSA parameters. */
   382 	virtual CDSAParameters* DSAParametersL(const TDesC8& aEncoding) const = 0;
   383 	//	New function for TKeyFactory API
   384 	virtual CDSAPublicKey* DSAPublicKeyL(const TDesC8& aParamsEncoding, const TDesC8& aEncoding) const = 0;
   385 	};
   386 
   387 class CSigningKeyParameters : public CBase
   388 /** Contains the parameter information required by some signing algorithms.
   389 * 
   390 * The DSA signing algorithm needs parameters as well as a key. Currently, this 
   391 * class only contains DSA parameters. 
   392 * 
   393 * @since v6.0 */
   394 	{
   395 public:
   396 	/** Creates a new signing key parameters object.
   397 	* 
   398 	* @return	A pointer to the new signing key parameters object. */
   399 	IMPORT_C static CSigningKeyParameters* NewL();
   400 	
   401 	/** Creates a new signing key parameters object and puts a pointer to the new object 
   402 	* onto the cleanup stack.
   403 	* 
   404 	* @return	A pointer to the new signing key parameters object. */
   405 	IMPORT_C static CSigningKeyParameters* NewLC();
   406 	
   407 	/** Creates a new signing key parameters object copied from an existing object.
   408 	* 
   409 	* @param aParameters 	The signing key parameters object to be copied.
   410 	* @return 				A pointer to the new parameters object. */
   411 	IMPORT_C static CSigningKeyParameters* NewL(const CSigningKeyParameters& aParameters);
   412 	
   413 	/** Creates a new signing key parameters object copied from an existing object 
   414 	* and puts a pointer to the new object onto the cleanup stack.
   415 	* 
   416 	* @param aParameters  The signing key parameters object to be copied.
   417 	* @return 			  A pointer to the new signing key parameters object. */
   418 	IMPORT_C static CSigningKeyParameters* NewLC(const CSigningKeyParameters& aParameters);
   419 	
   420 	/** Destructor.
   421 	* 
   422 	* Frees all resources owned by the object. */
   423 	IMPORT_C ~CSigningKeyParameters();
   424 	
   425 	/** Sets the DSA parameters.
   426 	* 
   427 	* @param aParams	The DSA parameters. */
   428 	IMPORT_C void SetDSAParamsL(const CDSAParameters& aParams);
   429 	
   430 	/** Gets the DSA parameters.
   431 	* 
   432 	* @return	The DSA parameters. 
   433 	* @internalAll
   434 	*/
   435 	const CDSAParameters* DSAParams() const;
   436 private:
   437 	CSigningKeyParameters();
   438 	void ConstructL(const CSigningKeyParameters& aParameters);
   439 	CDSAParameters* iDSAParams;
   440 	};
   441 
   442 
   443 class CSignedObject : public CBase
   444 /** Base class for certificates. 
   445 * 
   446 * @since v6.0 */
   447 	{
   448 public:	
   449 	/** Verifies a signature using the specified encoded key.
   450 	* 
   451 	* @param aEncodedKey 	The encoded key. 
   452 	* @return 				ETrue if the signature is valid, otherwise EFalse. */
   453 	IMPORT_C TBool VerifySignatureL(const TDesC8& aEncodedKey) const;
   454 	
   455 	/** Verifies a signature using the specified encoded key and hash.
   456 	* 
   457 	* @param aEncodedKey 	The encoded key. 
   458 	* @param aHash			The hash of the data to be validated.
   459 	* @return 				ETrue if the signature is valid, otherwise EFalse. */
   460 	IMPORT_C TBool VerifySignatureL(const TDesC8& aEncodedKey, const TDesC8& aHash) const;	
   461 	
   462 	/** Gets the digital signature.
   463 	* 
   464 	* @return	A non-modifiable pointer descriptor representing the digital signature. */
   465 	IMPORT_C const TPtrC8 Signature() const;
   466 	
   467 	/** Gets the signed data.
   468 	* 
   469 	* @return	A non-modifiable pointer descriptor representing the signed data. */
   470 	IMPORT_C virtual const TPtrC8 SignedDataL() const = 0;
   471 	
   472 	/** Gets the fingerprint.
   473 	* 
   474 	* The fingerprint returned is the SHA1 hash of the encoding of the entire object.
   475 	* 
   476 	* @return	A non-modifiable pointer descriptor representing the finger print. */
   477 	IMPORT_C const TPtrC8 Fingerprint() const;
   478 	
   479 	/** Gets the entire encoding.
   480 	* 
   481 	* @return	A non-modifiable pointer descriptor representing the entire encoding. */
   482 	IMPORT_C const TPtrC8 Encoding() const;
   483 	
   484 	/** Gets the signing algorithm ID used.
   485 	* 
   486 	* @return	The signing algorithm ID. */
   487 	IMPORT_C const CSigningAlgorithmIdentifier& SigningAlgorithm() const;
   488 	
   489 	/** Externalises the encoding of the entire object to a write stream.
   490 	* 
   491 	* The fingerprint and the signed data can be regenerated after restoration.
   492 	* 
   493 	* The presence of this function means that the standard templated operator<<() 
   494 	* can be used to externalise objects of this class.
   495 	* 
   496 	* @param aStream	Stream to which the object should be externalised. */
   497 	IMPORT_C virtual void ExternalizeL(RWriteStream& aStream) const;
   498 	
   499 	/** Internalises the encoded object from a read stream.
   500 	
   501 	* The class makes use of a specification-specific parser class for extracting 
   502 	* the various elements, that is provided by a subclass of CSignedObject. For 
   503 	* this reason this function is pure virtual.
   504 	* 
   505 	* The presence of this function means that the standard templated operator>>() 
   506 	* can be used to internalise objects of this class.
   507 	* 
   508 	* @param aStream	Stream from which the contents of the field should be internalised. */
   509 	IMPORT_C virtual void InternalizeL(RReadStream& aStream) = 0;
   510 	
   511 	/** Sets the signing key parameters.
   512 	* 
   513 	* @param aParameters	The signing key parameters. */
   514 	IMPORT_C void SetParametersL(const CSigningKeyParameters& aParameters);
   515 	
   516 	/** Gets the encoded data for the specified encoded data element, in the (to be 
   517 	* signed) tbsCertificate data structure, of the signed object.
   518 	* 
   519 	* @param aIndex	The encoded data element position in the tbsCertificate data 
   520 	* 				structure. See the enumeration: CX509Certificate::Anonymous.
   521 	* @return 		The encoded data for the specified data element of the signed object. */
   522 	IMPORT_C virtual const TPtrC8* DataElementEncoding(const TUint aIndex) const = 0;
   523 	
   524 	/** Destructor.
   525 	* 
   526 	* Frees all resources owned by the object. */
   527 	IMPORT_C ~CSignedObject();
   528 
   529 protected:
   530 	/** Verifies a RSA signature using the specified encoded key.
   531 	* 
   532 	* @param aEncodedKey 	The encoded key. 
   533 	* @return 				ETrue if the signature is valid, otherwise EFalse. 
   534 	* @internalAll
   535 	*/
   536 	TBool VerifyRSASignatureL(const TDesC8& aEncodedKey) const;
   537 	
   538 	/** @internalAll */	
   539 	TBool VerifyRSASignatureL(const TDesC8& aEncodedKey, const TDesC8& aHash) const;
   540 	
   541 	/** A pointer to a key factory object. */
   542 	TKeyFactory* iKeyFactory;
   543 	
   544 	/** A heap descriptor representing the entire encoding. */
   545 	HBufC8* iEncoding;
   546 	
   547 	/** The digital signature. */
   548 	HBufC8* iSignature;
   549 	
   550 	/** The fingerprint.
   551 	* 
   552 	* The SHA1 hash of the encoding of the entire object. */
   553 	HBufC8* iFingerprint;
   554 	
   555 	/** The signing key parameters */
   556 	CSigningKeyParameters* iParameters;
   557 	
   558 	/** The signing algorithm ID. */
   559 	CSigningAlgorithmIdentifier* iSigningAlgorithm;
   560 	};
   561 
   562 class CCertificate : public CSignedObject
   563 /** A data structure that binds a public key to a given individual.
   564 * 
   565 * A certificate is a signed object, and adds a serial number, a validity period 
   566 * and a subject public key.
   567 * 
   568 * This is a base class for classes that implement certificates of particular types. 
   569 * 
   570 * @since v6.0 */
   571 	{
   572 public:
   573 	/** Destructor.
   574 	* 
   575 	* Frees all resources owned by the object. */
   576 	IMPORT_C ~CCertificate();
   577 	
   578 	/** Gets the subject public key information.
   579 	* 
   580 	* @return	The subject public key information. */
   581 	IMPORT_C const CSubjectPublicKeyInfo& PublicKey() const;
   582 	
   583 	/** Gets the serial number.
   584 	* 
   585 	* @return	A non-modifiable pointer descriptor representing the serial number. */
   586 	IMPORT_C const TPtrC8 SerialNumber() const;
   587 	
   588 	/** Gets the validity period.
   589 	* 
   590 	* @return	The validity period. */
   591 	IMPORT_C const CValidityPeriod& ValidityPeriod() const;
   592 	
   593 	/** Tests whether a certificate is self-signed.
   594 	* 
   595 	* @return	ETrue, if it is self-signed; EFalse, otherwise. */
   596 	IMPORT_C virtual TBool IsSelfSignedL() const = 0;
   597 	
   598 	/** Gets the subject.
   599 	* 
   600 	* @return	A heap descriptor representing the subject. */
   601 	IMPORT_C virtual HBufC* SubjectL() const = 0;
   602 	
   603 	/** Gets the issuer.
   604 	* 
   605 	* @return	A heap descriptor representing the issuer. */
   606 	IMPORT_C virtual HBufC* IssuerL() const = 0;
   607 	
   608 	/** Gets the key identifier.
   609 	* 
   610 	* @return	The key identifier. */
   611 	IMPORT_C virtual TKeyIdentifier KeyIdentifierL() const;
   612 
   613 protected:
   614 	/** The serial number. */
   615 	HBufC8* iSerialNumber;
   616 
   617 	/** The validity period. */
   618 	CValidityPeriod* iValidityPeriod;
   619 
   620 	/** The subject public key information. */
   621 	CSubjectPublicKeyInfo* iSubjectPublicKeyInfo;
   622 	};
   623 
   624 #endif