secsrv_plat/cms_api/inc/CCMSX509CertificateList.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2002 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 "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 #ifndef CCMSX509CertificateList_H
       
    21 #define CCMSX509CertificateList_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "CCMSSequence.h"
       
    25 #include <x509cert.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CCMSX509AlgorithmIdentifier;
       
    29 // Extension
       
    30 class MCMSX509CertificateList;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34  * These two classes are containers for CertificateList data
       
    35  */
       
    36 class CCMSX509RevokedCertificate : public CBase
       
    37 	{
       
    38 	public: // Constructor and destructor
       
    39 	   /**
       
    40         * C++ default constructor.
       
    41         */
       
    42 		IMPORT_C CCMSX509RevokedCertificate();
       
    43 
       
    44        /**
       
    45         * Destructor.
       
    46         */
       
    47 		virtual ~CCMSX509RevokedCertificate();
       
    48 
       
    49 	public: // Data
       
    50 		TInt iUserCertificateSerialNumber;
       
    51 		TTime iRevokationDate;
       
    52 		// Owned extensions
       
    53 		CArrayPtrFlat< CX509CertExtension >* iExtensions;
       
    54 	};
       
    55 
       
    56 class CCMSX509CertificateListParameters : public CBase
       
    57 	{
       
    58 	public: // Constructor and destructor
       
    59 	   /**
       
    60         * C++ default constructor.
       
    61         */
       
    62 		IMPORT_C CCMSX509CertificateListParameters();
       
    63 
       
    64        /**
       
    65         * Destructor.
       
    66         */
       
    67 		virtual ~CCMSX509CertificateListParameters();
       
    68 
       
    69 	public: // Data
       
    70 		TInt iVersion;
       
    71 		// Signature algorithm, owned
       
    72 		CCMSX509AlgorithmIdentifier* iSignatureAlgorithm;
       
    73 		// Issuer, owned
       
    74 		CX500DistinguishedName* iIssuer;
       
    75 		TTime iThisUpdate;
       
    76 		TTime iNextUpdate;
       
    77 		// Owned revoked certificates
       
    78 		CArrayPtrFlat< CCMSX509RevokedCertificate >* iRevokedCertificates;
       
    79 		// Owned extensions
       
    80 		CArrayPtrFlat< CX509CertExtension >* iExtensions;
       
    81 		// Owned signature
       
    82 		HBufC8* iSignature;
       
    83 	};
       
    84 
       
    85 // CLASS DECLARATION
       
    86 /**
       
    87 *  X509 CertificateList
       
    88 *
       
    89 *  CertificateList  ::=  SEQUENCE  {
       
    90 *       tbsCertList          TBSCertList,
       
    91 *       signatureAlgorithm   AlgorithmIdentifier,
       
    92 *       signature            BIT STRING  }
       
    93 *
       
    94 *  TBSCertList  ::=  SEQUENCE  {
       
    95 *       version                 Version OPTIONAL,
       
    96 *                                    -- if present, shall be v2
       
    97 *       signature               AlgorithmIdentifier,
       
    98 *       issuer                  Name,
       
    99 *       thisUpdate              Time,
       
   100 *       nextUpdate              Time OPTIONAL,
       
   101 *       revokedCertificates     SEQUENCE OF SEQUENCE  {
       
   102 *            userCertificate         CertificateSerialNumber,
       
   103 *            revocationDate          Time,
       
   104 *            crlEntryExtensions      Extensions OPTIONAL
       
   105 *                                           -- if present, shall be v2
       
   106 *                                 }  OPTIONAL,
       
   107 *       crlExtensions           [0] Extensions OPTIONAL
       
   108 *                                          -- if present, shall be v2 -- }
       
   109 *
       
   110 *  Name            ::=   CHOICE { -- only one possibility for now --
       
   111 *                                   rdnSequence  RDNSequence }
       
   112 *
       
   113 *  RDNSequence     ::=   SEQUENCE OF RelativeDistinguishedName
       
   114 *
       
   115 *  RelativeDistinguishedName  ::=
       
   116 *                      SET SIZE (1 .. MAX) OF AttributeTypeAndValue
       
   117 *
       
   118 *  Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
       
   119 *
       
   120 *  CertificateSerialNumber  ::=  INTEGER
       
   121 *
       
   122 *  Time ::= CHOICE {
       
   123 *       utcTime        UTCTime,
       
   124 *       generalTime    GeneralizedTime }
       
   125 *
       
   126 *  @lib cms.lib
       
   127 *  @since 2.8
       
   128 */
       
   129 class CCMSX509CertificateList : public CCMSSequence
       
   130     {
       
   131     public:  // Constructors and destructor
       
   132 		/**
       
   133         * Two-phased constructor.
       
   134         * Leaves newly created instance in CleanupStack
       
   135         */
       
   136         IMPORT_C static CCMSX509CertificateList* NewLC();
       
   137 
       
   138         /**
       
   139         * Two-phased constructor.
       
   140         * Leaves newly created instance in CleanupStack
       
   141         * @param aSigningCertificate	Signing certificate
       
   142         * @param aRevokedCertificates 	List of revoked certificates
       
   143         */
       
   144         IMPORT_C static CCMSX509CertificateList* NewLC(
       
   145 			const CX509Certificate& aSigningCertificate,
       
   146 			const CArrayPtrFlat<CX509Certificate>& aRevokedCertificates );
       
   147         /**
       
   148         * Two-phased constructor.
       
   149         * Leaves newly created instance in CleanupStack
       
   150         * @param aParameters	Parameters used for creating list,
       
   151 		*						ownership transferred
       
   152         */
       
   153 		IMPORT_C static CCMSX509CertificateList* NewLC(
       
   154 			CCMSX509CertificateListParameters& aParameters );
       
   155         /**
       
   156         * Destructor.
       
   157         */
       
   158         virtual ~CCMSX509CertificateList();
       
   159 
       
   160     public: // New functions
       
   161 
       
   162         /**
       
   163 		* Getter for CertificateList parameters
       
   164 		* @since 2,8
       
   165 		* @return Signing certificate in CX509Certificate reference
       
   166 		*/
       
   167 		IMPORT_C const CCMSX509CertificateListParameters&
       
   168 													Parameters() const;
       
   169 
       
   170         /**
       
   171         * Setter for CertificateList parameters, takes ownership
       
   172         * @since 2.8
       
   173         * @param aSigningCertificate X.509 certificate to be set as signing
       
   174         */
       
   175 		IMPORT_C void SetParametersL(
       
   176 				CCMSX509CertificateListParameters& aSigningCertificate );
       
   177 
       
   178 
       
   179     public: // Functions from base classes
       
   180 
       
   181 	 	/**
       
   182         * From MCMSModule
       
   183         * @since 2.8
       
   184         * @param aRawData raw-data to be parsed in this instance
       
   185         */
       
   186         void DecodeL( const TDesC8& aRawData );
       
   187 
       
   188 	 	/**
       
   189         * From MCMSModule
       
   190         * @since 2.8
       
   191         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   192         */
       
   193         CASN1EncBase* EncoderLC() const;
       
   194 
       
   195     protected:  // New functions
       
   196 
       
   197 	   /**
       
   198         * Protected construction to allow derivation
       
   199         */
       
   200         IMPORT_C void ConstructL();
       
   201 
       
   202 	   /**
       
   203         * Protected construction to allow derivation
       
   204         */
       
   205         IMPORT_C void ConstructL( const CX509Certificate& aSigningCertificate,
       
   206 				const CArrayPtrFlat<CX509Certificate>& aRevokedCertificates  );
       
   207 
       
   208         /**
       
   209         * C++ default constructor.
       
   210         */
       
   211         IMPORT_C CCMSX509CertificateList();
       
   212 
       
   213 	private:	// New functions
       
   214 
       
   215 		/**
       
   216 		 * Encodes Extensions
       
   217 		 */
       
   218 		CASN1EncSequence* EncodeExtensionsLC(
       
   219 				const CArrayPtrFlat<CX509CertExtension>* aExtensions ) const;
       
   220 
       
   221 		/**
       
   222 		 * Decodes Extensions
       
   223 		 */
       
   224 		CArrayPtrFlat<CX509CertExtension>* DecodeExtensionsL(
       
   225 										const TASN1DecGeneric* aExtensions );
       
   226 
       
   227 
       
   228     private:    // Data
       
   229         // List parameters, owned
       
   230         CCMSX509CertificateListParameters* iParams;
       
   231 
       
   232 		// Reserved for extensions
       
   233 		MCMSX509CertificateList* iReserved;
       
   234     };
       
   235 
       
   236 #endif      // CCMSX509CertificateList_H
       
   237 
       
   238 // End of File