secsrv_plat/cms_api/inc/CCMSOriginatorPublicKey.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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCMSOriginatorPublicKey_H
       
    21 #define CCMSOriginatorPublicKey_H
       
    22 
       
    23 #include "CCMSSequence.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CCMSX509AlgorithmIdentifier;
       
    27 
       
    28 // CLASS DECLARATION
       
    29 /**
       
    30 *  OriginatorPublicKey type module
       
    31 *
       
    32 *  ASN.1 definition:
       
    33 *  OriginatorPublicKey ::= SEQUENCE {
       
    34 *    algorithm AlgorithmIdentifier,
       
    35 *    publicKey BIT STRING }
       
    36 *
       
    37 *  @lib cms.lib
       
    38 *  @since 2.8
       
    39 */
       
    40 class CCMSOriginatorPublicKey : public CCMSSequence
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43 		/**
       
    44         * Two-phased constructor.
       
    45         */
       
    46         IMPORT_C static CCMSOriginatorPublicKey* NewL();
       
    47 
       
    48         /**
       
    49          * Two-phased copy constructor.
       
    50          */
       
    51         IMPORT_C static CCMSOriginatorPublicKey* NewL(
       
    52             const CCMSOriginatorPublicKey& aOriginatorPublicKey );
       
    53 
       
    54         /**
       
    55          * Two-phased copy constructor. Leaves the created object to
       
    56          * cleanup stack.
       
    57          */
       
    58         IMPORT_C static CCMSOriginatorPublicKey* NewLC(
       
    59             const CCMSOriginatorPublicKey& aOriginatorPublicKey );
       
    60 
       
    61         /**
       
    62         * Two-phased constructor. Copies of the parameters are made.
       
    63         *
       
    64         * @param aAlgorithm Algorithm Identifier.
       
    65         * @param aPublicKey The public key. Must be in big-endian order.
       
    66         */
       
    67         IMPORT_C static CCMSOriginatorPublicKey* NewL(
       
    68             const CCMSX509AlgorithmIdentifier& aAlgorithm,
       
    69             const TDesC8& aPublicKey );
       
    70 
       
    71         /**
       
    72         * Two-phased constructor. Copies of the parameters are made.
       
    73         * Leaves the created object to cleanup stack
       
    74         *
       
    75         * @param aAlgorithm Algorithm Identifier.
       
    76         * @param aPublicKey The public key. Must be in big-endian order.
       
    77         */
       
    78         IMPORT_C static CCMSOriginatorPublicKey* NewLC(
       
    79             const CCMSX509AlgorithmIdentifier& aAlgorithm,
       
    80             const TDesC8& aPublicKey );
       
    81 
       
    82         /**
       
    83         * Destructor.
       
    84         */
       
    85         virtual ~CCMSOriginatorPublicKey();
       
    86 
       
    87     public: // New functions
       
    88         /**
       
    89         * Getter for algorithm identifier
       
    90         * @since 2.8
       
    91         * @return The algorithm identifier
       
    92         */
       
    93 		IMPORT_C const CCMSX509AlgorithmIdentifier& Algorithm() const;
       
    94 
       
    95         /**
       
    96         * Getter for public key
       
    97         * @since 2,8
       
    98         * @return public key
       
    99         */
       
   100 		IMPORT_C const TDesC8& PublicKey() const;
       
   101 
       
   102 		/**
       
   103         * Setter for algorithm identifier. Create a copy of the parameters.
       
   104         * @since 2.8
       
   105         * @param aAlgorithm the algorithm identifier
       
   106         */
       
   107 		IMPORT_C void SetAlgorithmL(
       
   108             const CCMSX509AlgorithmIdentifier& aAlgorithm );
       
   109 
       
   110         /**
       
   111         * Setter for public key. Creates a copy of the parameter.
       
   112         * @since 2,8
       
   113         * @param aPublicKey the public key in big-endian format
       
   114         */
       
   115 		IMPORT_C void SetPublicKeyL( const TDesC8& aPublicKey );
       
   116 
       
   117     public: // Functions from base classes
       
   118 
       
   119 	 	/**
       
   120         * From MCMSModule
       
   121         * @since 2.8
       
   122         * @param aRawData raw-data to be parsed in this instance
       
   123         */
       
   124         void DecodeL( const TDesC8& aRawData );
       
   125 
       
   126 	 	/**
       
   127         * From MCMSModule
       
   128         * @since 2.8
       
   129         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   130         */
       
   131         CASN1EncBase* EncoderLC() const;
       
   132 
       
   133     protected:  // New functions
       
   134 
       
   135 	   /**
       
   136         * Protected construction to allow derivation
       
   137         */
       
   138         IMPORT_C void ConstructL( const CCMSX509AlgorithmIdentifier& aAlgorithm,
       
   139 								  const TDesC8& aPublicKey );
       
   140 
       
   141         /**
       
   142         * C++ default constructor.
       
   143         */
       
   144         IMPORT_C CCMSOriginatorPublicKey();
       
   145 
       
   146     private:    // Data
       
   147         // Issuer name, owned
       
   148         CCMSX509AlgorithmIdentifier* iAlgorithm;
       
   149         // public key, owned
       
   150 		HBufC8* iPublicKey;
       
   151 
       
   152     };
       
   153 
       
   154 #endif      // CCMSOriginatorPublicKey_H
       
   155 
       
   156 // End of File