secsrv_plat/cms_api/inc/CCMSX509AttributeCertificate.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 AttributeCertificate type
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCMSX509AttributeCertificate_H
       
    21 #define CCMSX509AttributeCertificate_H
       
    22 
       
    23 #include "CCMSSequence.h"
       
    24 #include "CCMSX509Signed.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CCMSX509AttributeCertificateInfo;
       
    28 class CCMSX509AlgorithmIdentifier;
       
    29 
       
    30 // Extensions
       
    31 class MCMSX509AttributeCertificateExtension;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 /**
       
    35 *  X.509 AttributeCertificateInfo type module
       
    36 *
       
    37 *  ASN.1 definition:
       
    38 * AttributeCertificate ::= SIGNED{AttributeCertificateInfo}
       
    39 *
       
    40 * SIGNATURE{ToBeSigned} ::= SEQUENCE {
       
    41 *  algorithmIdentifier  AlgorithmIdentifier,
       
    42 *  encrypted            ENCRYPTED-HASH{ToBeSigned}
       
    43 * }
       
    44 *
       
    45 * SIGNED{ToBeSigned} ::= SEQUENCE {
       
    46 *  toBeSigned  ToBeSigned,
       
    47 *  COMPONENTS OF SIGNATURE{ToBeSigned}
       
    48 * }
       
    49 *
       
    50 *  @lib cms.lib
       
    51 *  @since 3.0
       
    52 */
       
    53 class CCMSX509AttributeCertificate : public CCMSX509Signed
       
    54     {
       
    55 
       
    56     public:  // Constructors and destructor
       
    57 		/**
       
    58         * Two-phased constructor.
       
    59         */
       
    60         IMPORT_C static CCMSX509AttributeCertificate* NewL();
       
    61 
       
    62         /**
       
    63         * Two-phased constructor. Copies of the parameters are made.
       
    64         * 
       
    65         * @param aInfo AttributeCertificateInfo, contains the actual
       
    66         * data of the certificate.
       
    67         * @param aAlgorithmIdentifier identifies the algorithm used in
       
    68         * the signature 
       
    69         * @param aEncrypted must be the result of applying a hashing
       
    70         * procedure to the DER-encoded octets of a value of
       
    71         * aInfo and then applying an encipherment
       
    72         * procedure to those octets
       
    73         */
       
    74         IMPORT_C static CCMSX509AttributeCertificate* NewL(
       
    75             const CCMSX509AttributeCertificateInfo& aInfo,
       
    76             const CCMSX509AlgorithmIdentifier& aAlgorithmIdentifier,
       
    77             const TDesC8& aEncrypted
       
    78             );
       
    79         
       
    80         /**
       
    81         * Destructor.
       
    82         */
       
    83         virtual ~CCMSX509AttributeCertificate();
       
    84 
       
    85     public: // New functions
       
    86         /**
       
    87         * Getter for the info.
       
    88         * @since 3.0
       
    89         * @return X.509 AttributeCertificateInfo value
       
    90         */
       
    91 		IMPORT_C const CCMSX509AttributeCertificateInfo& Info() const;
       
    92 
       
    93         /**
       
    94         * Setter for the info. Creates a copy.
       
    95         * @since 3.0
       
    96         * @param aInfo X.509 AttributeCertificateInfo
       
    97         */
       
    98 		IMPORT_C void SetInfoL( const CCMSX509AttributeCertificateInfo& aInfo );
       
    99 
       
   100         /**
       
   101          * Decoder method with implicit tag checking.
       
   102          * @since 3.0
       
   103          * @param aRawData raw-data to be parsed in this instance
       
   104          * @param aImplicitTag tag to be checked
       
   105          */
       
   106         void DecodeImplicitTagL( const TDesC8& aRawData,
       
   107                                  const TTagType aImplicitTag );
       
   108         
       
   109     public: // Functions from base classes
       
   110 
       
   111 	 	/**
       
   112         * From MCMSModule
       
   113         * @since 3.0
       
   114         * @param aRawData raw-data to be parsed in this instance
       
   115         */
       
   116         void DecodeL( const TDesC8& aRawData );
       
   117 
       
   118 	 	/**
       
   119         * From MCMSModule
       
   120         * @since 3.0
       
   121         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   122         */
       
   123         CASN1EncBase* EncoderLC() const;
       
   124 
       
   125     protected:  // New functions
       
   126 
       
   127 	   /**
       
   128         * Protected construction to allow derivation
       
   129         */
       
   130         IMPORT_C void ConstructL(
       
   131             const CCMSX509AttributeCertificateInfo& aInfo,
       
   132             const CCMSX509AlgorithmIdentifier& aAlgorithmIdentifier,
       
   133             const TDesC8& aEncrypted
       
   134             );
       
   135 
       
   136         /**
       
   137          * Protected construction to allow derivation
       
   138          */
       
   139         IMPORT_C void ConstructL( );
       
   140         
       
   141         /**
       
   142         * C++ default constructor.
       
   143         */
       
   144         IMPORT_C CCMSX509AttributeCertificate( );
       
   145         
       
   146     private: // New Methods
       
   147 
       
   148         /**
       
   149          * Decodes internal data from a array of ASN.1 decoders
       
   150          * @param aItems items to internalize
       
   151          */
       
   152         void DecodeArrayL( CArrayPtr< TASN1DecGeneric >* aItems );
       
   153 
       
   154     private:    // Data
       
   155         // Contains the actual attribute certificate (without
       
   156         // signature). Owned.
       
   157         CCMSX509AttributeCertificateInfo* iInfo;
       
   158 
       
   159         // Reserved for extensions
       
   160         MCMSX509AttributeCertificateExtension* iReserved;
       
   161         
       
   162     };
       
   163 
       
   164 #endif      // CCMSX509AttributeCertificate_H
       
   165 
       
   166 // End of File