secsrv_plat/cms_api/inc/CCMSKEKRecipientInfo.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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCMSKEKRecipientInfo_H
       
    21 #define CCMSKEKRecipientInfo_H
       
    22 
       
    23 #include "CCMSRecipientInfo.h"
       
    24 
       
    25 // FORWARD DECLARATION
       
    26 class CCMSKeyIdentifier;
       
    27 
       
    28 // CONSTANTS
       
    29 const TInt KCMSKEKRecipientInfoVersion = 4;
       
    30 const TTagType KCMSKEKRecipientInfoTag = 2;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34 *  KEKRecipientInfo type module
       
    35 *
       
    36 *  ASN.1 definition:
       
    37 *    KEKRecipientInfo ::= SEQUENCE {
       
    38 *        version CMSVersion,  -- always set to 4
       
    39 *        kekid KEKIdentifier,
       
    40 *        keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
       
    41 *        encryptedKey EncryptedKey }
       
    42 *
       
    43 *  @lib cms.lib
       
    44 *  @since 2.8
       
    45 */
       
    46 class CCMSKEKRecipientInfo : public CCMSRecipientInfo
       
    47     {
       
    48     public:  // Constructors and destructor
       
    49 		/**
       
    50         * Two-phased constructor. Leaves the object in cleanup stack.
       
    51         */
       
    52         IMPORT_C static CCMSKEKRecipientInfo* NewLC();
       
    53 
       
    54         /**
       
    55         * Two-phased constructor.
       
    56         */
       
    57         IMPORT_C static CCMSKEKRecipientInfo* NewL();
       
    58 
       
    59         /**
       
    60         * Two-phased constructor. Copies of the parameters are made.
       
    61         *
       
    62         * @param aKekid KEKIdentifier
       
    63         * @param aKeyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier
       
    64         * @param aEncryptedKey EncryptedKey value
       
    65         */
       
    66         IMPORT_C static CCMSKEKRecipientInfo* NewL(
       
    67             const CCMSKeyIdentifier& aKekid,
       
    68             const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm,
       
    69             const TDesC8& aEncryptedKey );
       
    70 
       
    71         /**
       
    72         * Destructor.
       
    73         */
       
    74         virtual ~CCMSKEKRecipientInfo();
       
    75 
       
    76     public: // New functions
       
    77         /**
       
    78         * Getter for EncryptedKey
       
    79         * @since 2.8
       
    80         * @return EncryptedKey
       
    81         */
       
    82 		IMPORT_C const TDesC8& EncryptedKey() const;
       
    83 
       
    84         /**
       
    85         * Getter for KEKIdentifier
       
    86         * @since 2,8
       
    87         * @return KEKIdentifier
       
    88         */
       
    89 		IMPORT_C const CCMSKeyIdentifier& Kekid() const;
       
    90 
       
    91 		/**
       
    92         * Setter for EncryptedKey. Creates a copy of the parameters.
       
    93         * @since 2.8
       
    94         * @param aEncryptedKey EncryptedKey value.
       
    95         */
       
    96 		IMPORT_C void SetEncryptedKeyL(
       
    97             const TDesC8& aEncryptedKey );
       
    98 
       
    99 		/**
       
   100         * Setter for KEKIdentifier
       
   101         * @since 2.8
       
   102         * @param aKekid KEKIdentifier
       
   103         */
       
   104 		IMPORT_C void SetKekidL(
       
   105             const CCMSKeyIdentifier& aKekid );
       
   106 
       
   107     public: // Functions from base classes
       
   108 
       
   109 	 	/**
       
   110         * From MCMSModule
       
   111         * @since 2.8
       
   112         * @param aRawData raw-data to be parsed in this instance
       
   113         */
       
   114         void DecodeL( const TDesC8& aRawData );
       
   115 
       
   116 	 	/**
       
   117         * From MCMSModule
       
   118         * @since 2.8
       
   119         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   120         */
       
   121         CASN1EncBase* EncoderLC() const;
       
   122         
       
   123         /**
       
   124          * From CCMSRecipientInfo
       
   125          * @since 2.8
       
   126          * @return Returns ASN1 encoder with explicit tag 1 and leaves
       
   127          * it in CleanupStack.
       
   128          */
       
   129         CASN1EncBase* TaggedEncoderLC() const;
       
   130         
       
   131     protected:  // New functions
       
   132 
       
   133 	   /**
       
   134         * Protected construction to allow derivation
       
   135         */
       
   136         IMPORT_C void ConstructL(
       
   137             const CCMSKeyIdentifier& aKekid,
       
   138             const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm,
       
   139             const TDesC8& aEncryptedKey );
       
   140 
       
   141         /**
       
   142         * C++ constructor.
       
   143         */
       
   144         IMPORT_C CCMSKEKRecipientInfo( );
       
   145 
       
   146     private:    // Data
       
   147         // EncryptedKey, owned
       
   148         TDesC8* iEncryptedKey;
       
   149         // KEKIdentifier, owned
       
   150         CCMSKeyIdentifier* iKekid;
       
   151 
       
   152     };
       
   153 
       
   154 #endif      // CCMSKEKRecipientInfo_H
       
   155 
       
   156 // End of File