secsrv_plat/cms_api/inc/CCMSX509AttributeCertificateInfo.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2004 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:  X.509 AttributeCertificateInfo type
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCMSX509AttributeCertificateInfo_H
       
    21 #define CCMSX509AttributeCertificateInfo_H
       
    22 
       
    23 #include "CCMSSequence.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CCMSX509GeneralNames;
       
    27 class CCMSX509IssuerSerial;
       
    28 class CCMSX509AlgorithmIdentifier;
       
    29 class CCMSAttribute;
       
    30 
       
    31 // Extensions
       
    32 class MCMSX509AttributeCertificateInfoExtension;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 /**
       
    36 *  X.509 AttributeCertificateInfo type module
       
    37 *
       
    38 *  ASN.1 definition:
       
    39 *   AttributeCertificateInfo ::= SEQUENCE {
       
    40 *    version                Version DEFAULT v1,
       
    41 *    subject
       
    42 *     CHOICE {baseCertificateID  [0]  IssuerSerial, --  associated
       
    43 *                                                with a Public Key Certificate--
       
    44 *             subjectName        [1]  GeneralNames}, --  associated  with a name
       
    45 *    issuer                 GeneralNames, --  CA issuing the attribute
       
    46 *                                             certificate
       
    47 *    signature              AlgorithmIdentifier,
       
    48 *    serialNumber           CertificateSerialNumber,
       
    49 *    attCertValidityPeriod  AttCertValidityPeriod,
       
    50 *    attributes             SEQUENCE OF Attribute,
       
    51 *    issuerUniqueID         UniqueIdentifier OPTIONAL,
       
    52 *    extensions             Extensions OPTIONAL
       
    53 *   }
       
    54 *
       
    55 *   CertificateSerialNumber ::= INTEGER
       
    56 *
       
    57 *   AttCertValidityPeriod ::= SEQUENCE {
       
    58 *    notBeforeTime  GeneralizedTime,
       
    59 *    notAfterTime   GeneralizedTime
       
    60 *   }
       
    61 *
       
    62 *  @lib cms.lib
       
    63 *  @since 3.0
       
    64 */
       
    65 class CCMSX509AttributeCertificateInfo : public CCMSSequence
       
    66     {
       
    67 
       
    68     private:
       
    69         /**
       
    70          * Container for certificate data
       
    71          */
       
    72         NONSHARABLE_CLASS( CAttributeCertificateData ) : public CBase
       
    73             {
       
    74             public: // destructor
       
    75                 ~CAttributeCertificateData();
       
    76             public: // data
       
    77                 // version
       
    78                 TInt iVersion;
       
    79 
       
    80                 // subject value, owned
       
    81                 CCMSX509IssuerSerial* iBaseCertificateID;
       
    82                 // subject value, owned
       
    83                 CCMSX509GeneralNames* iSubjectName;
       
    84 
       
    85                 // issuer, owned
       
    86                 CCMSX509GeneralNames* iIssuer;
       
    87                 // signature, owned
       
    88                 CCMSX509AlgorithmIdentifier* iSignature;
       
    89                 // serialNumber
       
    90                 TInt iSerialNumber;
       
    91                 
       
    92                 // attCertValidityPeriod not before time
       
    93                 TTime iNotBeforeTime;
       
    94                 // attCertValidityPeriod not after time
       
    95                 TTime iNotAfterTime;
       
    96 
       
    97                 // attributes, owned
       
    98                 CArrayPtr< CCMSAttribute >* iAttributes;
       
    99 
       
   100                 // issuerUniqueID, optional, owned
       
   101                 TDesC8* iIssuerUniqueID;
       
   102             };
       
   103         
       
   104     public:  // Constructors and destructor
       
   105 		/**
       
   106         * Two-phased constructor.
       
   107         */
       
   108         IMPORT_C static CCMSX509AttributeCertificateInfo* NewL();
       
   109 
       
   110         /**
       
   111         * Two-phased constructor. Copies of the parameters are made.
       
   112         * 
       
   113         * @param aBaseCertificateID subject, associated with a Public
       
   114         * Key Certificate
       
   115         * @param aIssuer CA issuing the attribute certificate
       
   116         * @param aSignature signature value
       
   117         * @param aSerialNumber serialNumber value
       
   118         * @param aNotBeforeTime attCertValidityPeriod value
       
   119         * @param aNotAfterTime attCertValidityPeriod value
       
   120         * @param aAttributes attributes value
       
   121         */
       
   122         IMPORT_C static CCMSX509AttributeCertificateInfo* NewL(
       
   123             const CCMSX509IssuerSerial& aBaseCertificateID,
       
   124             const CCMSX509GeneralNames& aIssuer,
       
   125             const CCMSX509AlgorithmIdentifier& aSignature,
       
   126             const TInt aSerialNumber,
       
   127             const TTime& aNotBeforeTime,
       
   128             const TTime& aNotAfterTime,
       
   129             const CArrayPtr< CCMSAttribute >& aAttributes );
       
   130             
       
   131         /**
       
   132         * Two-phased constructor. Copies of the parameters are made.
       
   133         * 
       
   134         * @param aSubjectName subject, associated with a name
       
   135         * @param aIssuer CA issuing the attribute certificate
       
   136         * @param aSignature signature value
       
   137         * @param aSerialNumber serialNumber value
       
   138         * @param aNotBeforeTime attCertValidityPeriod value
       
   139         * @param aNotAfterTime attCertValidityPeriod value
       
   140         * @param aAttributes attributes value
       
   141         */
       
   142         IMPORT_C static CCMSX509AttributeCertificateInfo* NewL(
       
   143             const CCMSX509GeneralNames& aSubjectName,
       
   144             const CCMSX509GeneralNames& aIssuer,
       
   145             const CCMSX509AlgorithmIdentifier& aSignature,
       
   146             const TInt aSerialNumber,
       
   147             const TTime& aNotBeforeTime,
       
   148             const TTime& aNotAfterTime,
       
   149             const CArrayPtr< CCMSAttribute >& aAttributes );
       
   150 
       
   151         
       
   152         /**
       
   153         * Destructor.
       
   154         */
       
   155         virtual ~CCMSX509AttributeCertificateInfo();
       
   156 
       
   157     public: // New functions
       
   158         /**
       
   159         * Getter for Version.
       
   160         * @since 3.0
       
   161         * @return Version value
       
   162         */
       
   163 		IMPORT_C TInt Version() const;
       
   164 
       
   165         /**
       
   166         * Getter for baseCertifiedID (subject value)
       
   167         * @since 3.0
       
   168         * @return X.509 IssuerSerial value, or NULL if subject is not
       
   169         * baseCertificateID
       
   170         */
       
   171 		IMPORT_C const CCMSX509IssuerSerial* BaseCertificateID() const;
       
   172 
       
   173         /**
       
   174         * Getter for subjectName (subject value)
       
   175         * @since 3.0
       
   176         * @return X.509 GeneralNames value, or NULL if subject
       
   177         * is not subjectName
       
   178         */
       
   179 		IMPORT_C const CCMSX509GeneralNames* SubjectName() const;
       
   180 
       
   181         /**
       
   182         * Getter for issuer.
       
   183         * @since 3.0
       
   184         * @return X.509 GeneralNames value
       
   185         */
       
   186 		IMPORT_C const CCMSX509GeneralNames& Issuer() const;
       
   187 
       
   188         /**
       
   189         * Getter for signature.
       
   190         * @since 3.0
       
   191         * @return X.509 AlgorithmIdentifier value
       
   192         */
       
   193 		IMPORT_C const CCMSX509AlgorithmIdentifier& Signature() const;
       
   194 
       
   195         /**
       
   196         * Getter for serialNumber.
       
   197         * @since 3.0
       
   198         * @return X.509 CertificateSerialNumber value
       
   199         */
       
   200 		IMPORT_C TInt SerialNumber() const;
       
   201 
       
   202         /**
       
   203         * Getter for notBeforeTime (part of attCertValidityPeriod).
       
   204         * @since 3.0
       
   205         * @return notBeforeTime value
       
   206         */
       
   207 		IMPORT_C const TTime& NotBeforeTime() const;
       
   208 
       
   209         /**
       
   210         * Getter for notAfterTime (part of attCertValidityPeriod).
       
   211         * @since 3.0
       
   212         * @return notAfterTime value
       
   213         */
       
   214 		IMPORT_C const TTime& NotAfterTime() const;
       
   215 
       
   216         /**
       
   217         * Getter for attributes
       
   218         * @since 3.0
       
   219         * @return attribute array
       
   220         */
       
   221 		IMPORT_C const CArrayPtr< CCMSAttribute >& Attributes() const;
       
   222 
       
   223         /**
       
   224         * Getter for issuerUniqueID
       
   225         * @since 3.0
       
   226         * @return X.509 UniqueIdentifier (BIT STRING), or NULL if
       
   227         * issuerUniqueID is absent.
       
   228         */
       
   229 		IMPORT_C const TDesC8* IssuerUniqueID() const;
       
   230         
       
   231         /**
       
   232         * Setter for Version
       
   233         * @since 3.0
       
   234         * @param aVersion Version value.
       
   235         */
       
   236 		IMPORT_C void SetVersion( const TInt aVersion );
       
   237 
       
   238 		/**
       
   239         * Setter for baseCertificateID. Creates a copy. Deletes also
       
   240         * subjectName value.
       
   241         * @since 3.0
       
   242         * @param aBaseCertificateID subject value, associated  with a
       
   243         * Public Key Certificate 
       
   244         */
       
   245 		IMPORT_C void SetBaseCertificateIDL(
       
   246             const CCMSX509IssuerSerial& aBaseCertificateID );
       
   247 
       
   248 		/**
       
   249         * Setter for subjectName. Creates a copy. Deletes also
       
   250         * baseCertificateID value.
       
   251         * @since 3.0
       
   252         * @param aSubjectName subject value, associated  with a name
       
   253         */
       
   254 		IMPORT_C void SetSubjectNameL(
       
   255             const CCMSX509GeneralNames& aSubjectName );
       
   256 
       
   257         /**
       
   258         * Setter for issuer. Creates a copy.
       
   259         * @since 3.0
       
   260         * @param aIssuer X.509 GeneralNames value
       
   261         */
       
   262 		IMPORT_C void SetIssuerL( const CCMSX509GeneralNames& aIssuer );
       
   263 
       
   264         /**
       
   265         * Setter for signature. Creates a copy.
       
   266         * @since 3.0
       
   267         * @param aSignature X.509 AlgorithmIdentifier value
       
   268         */
       
   269 		IMPORT_C void
       
   270         SetSignatureL( const CCMSX509AlgorithmIdentifier& aSignature );
       
   271 
       
   272         /**
       
   273         * Setter for serialNumber.
       
   274         * @since 3.0
       
   275         * @param aSerialNumber X.509 CertificateSerialNumber value
       
   276         */
       
   277 		IMPORT_C void SetSerialNumber( const TInt aSerialNumber );
       
   278 
       
   279         /**
       
   280         * Setter for notBeforeTime (part of attCertValidityPeriod).
       
   281         * Creates a copy
       
   282         * @since 3.0
       
   283         * @param aNotBeforeTime notBeforeTime value
       
   284         */
       
   285 		IMPORT_C void SetNotBeforeTimeL( const TTime& aNotBeforeTime );
       
   286 
       
   287         /**
       
   288         * Setter for notAfterTime (part of attCertValidityPeriod).
       
   289         * Creates a copy.
       
   290         * @since 3.0
       
   291         * @param aNotAfterTime notAfterTime value
       
   292         */
       
   293 		IMPORT_C void SetNotAfterTimeL( const TTime& aNotAfterTime );
       
   294 
       
   295         /**
       
   296         * Setter for attributes. Creates a copy.
       
   297         * @since 3.0
       
   298         * @param aAttributes attribute array
       
   299         */
       
   300 		IMPORT_C void
       
   301         SetAttributesL( const CArrayPtr< CCMSAttribute >& aAttributes );
       
   302 
       
   303         /**
       
   304         * Setter for issuerUniqueID. Creates a copy.
       
   305         * @since 3.0
       
   306         * @param aIssuerUniqueID X.509 UniqueIdentifier (BIT STRING)
       
   307         */
       
   308 		IMPORT_C void SetIssuerUniqueIDL( const TDesC8& aIssuerUniqueID );
       
   309                 
       
   310     public: // Functions from base classes
       
   311 
       
   312 	 	/**
       
   313         * From MCMSModule
       
   314         * @since 3.0
       
   315         * @param aRawData raw-data to be parsed in this instance
       
   316         */
       
   317         void DecodeL( const TDesC8& aRawData );
       
   318 
       
   319 	 	/**
       
   320         * From MCMSModule
       
   321         * @since 3.0
       
   322         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   323         */
       
   324         CASN1EncBase* EncoderLC() const;
       
   325 
       
   326     protected:  // New functions
       
   327 
       
   328 	   /**
       
   329         * Protected construction to allow derivation
       
   330         */
       
   331         IMPORT_C void ConstructL(
       
   332             const CCMSX509IssuerSerial& aBaseCertificateID,
       
   333             const CCMSX509GeneralNames& aIssuer,
       
   334             const CCMSX509AlgorithmIdentifier& aSignature,
       
   335             const TInt aSerialNumber,
       
   336             const TTime& aNotBeforeTime,
       
   337             const TTime& aNotAfterTime,
       
   338             const CArrayPtr< CCMSAttribute >& aAttributes );
       
   339             
       
   340        /**
       
   341         * Protected construction to allow derivation
       
   342         */
       
   343         IMPORT_C void ConstructL(
       
   344             const CCMSX509GeneralNames& aSubjectName,
       
   345             const CCMSX509GeneralNames& aIssuer,
       
   346             const CCMSX509AlgorithmIdentifier& aSignature,
       
   347             const TInt aSerialNumber,
       
   348             const TTime& aNotBeforeTime,
       
   349             const TTime& aNotAfterTime,
       
   350             const CArrayPtr< CCMSAttribute >& aAttributes );
       
   351 
       
   352         /**
       
   353          * Protected construction to allow derivation
       
   354          */
       
   355         IMPORT_C void ConstructL( );
       
   356         
       
   357         /**
       
   358         * C++ default constructor.
       
   359         */
       
   360         IMPORT_C CCMSX509AttributeCertificateInfo( );
       
   361 
       
   362     private:    // Data
       
   363         // Contains all members, owned
       
   364         CAttributeCertificateData* iData;
       
   365 
       
   366         // Reserved for extensions
       
   367         MCMSX509AttributeCertificateInfoExtension* iReserved;
       
   368         
       
   369     };
       
   370 
       
   371 #endif      // CCMSX509AttributeCertificateInfo_H
       
   372 
       
   373 // End of File