secsrv_plat/cms_api/inc/CCMSKeyAgreeRecipientInfo.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:  CMS KeyAgreeRecipientInfo type
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCMSKeyAgreeRecipientInfo_H
       
    21 #define CCMSKeyAgreeRecipientInfo_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "CCMSRecipientInfo.h"
       
    25 
       
    26 // FORWARD DECLARATION
       
    27 class CCMSOriginatorIdentifierOrKey;
       
    28 class CCMSRecipientEncryptedKey;
       
    29 
       
    30 //Extension
       
    31 class MCMSKeyAgreeRecipientInfo;
       
    32 
       
    33 // CONSTANTS
       
    34 const TInt KCMSKeyAgreeRecipientInfoVersion = 3;
       
    35 const TTagType KCMSKeyAgreeRecipientInfoTag = 1;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 /**
       
    39 *  KeyAgreeRecipientInfo type module
       
    40 *
       
    41 *  ASN.1 definition:
       
    42 *    KeyAgreeRecipientInfo ::= SEQUENCE {
       
    43 *        version CMSVersion,  -- always set to 3
       
    44 *        originator [0] EXPLICIT OriginatorIdentifierOrKey,
       
    45 *        ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
       
    46 *        keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
       
    47 *        recipientEncryptedKeys RecipientEncryptedKeys }
       
    48 *
       
    49 *    RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey
       
    50 *
       
    51 *    UserKeyingMaterial ::= OCTET STRING
       
    52 *
       
    53 *  @lib cms.lib
       
    54 *  @since 3.0
       
    55 */
       
    56 class CCMSKeyAgreeRecipientInfo : public CCMSRecipientInfo
       
    57     {
       
    58     public:  // Constructors and destructor
       
    59 		/**
       
    60         * Two-phased constructor. Leaves the object in cleanup stack.
       
    61         */
       
    62         IMPORT_C static CCMSKeyAgreeRecipientInfo* NewLC();
       
    63 
       
    64         /**
       
    65         * Two-phased constructor.
       
    66         */
       
    67         IMPORT_C static CCMSKeyAgreeRecipientInfo* NewL();
       
    68         
       
    69         /**
       
    70         * Two-phased constructor. Copies of the parameters are made.
       
    71         * @param aOriginator OriginatorIdentifierOrKey value
       
    72         * @param aKeyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier value
       
    73         * @param aRecipientEncryptedKeys RecipientEncryptedKeys value
       
    74         */
       
    75         IMPORT_C static CCMSKeyAgreeRecipientInfo* NewL(
       
    76             const CCMSOriginatorIdentifierOrKey& aOriginator,
       
    77             const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm,
       
    78             const CArrayPtr< CCMSRecipientEncryptedKey >& aRecipientEncryptedKeys );
       
    79 
       
    80         /**
       
    81         * Two-phased constructor. Copies of the parameters are made.
       
    82         * @param aOriginator OriginatorIdentifierOrKey value
       
    83         * @param aUkm UserKeyingMaterial value
       
    84         * @param aKeyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier value
       
    85         * @param aRecipientEncryptedKeys RecipientEncryptedKeys value
       
    86         */
       
    87         IMPORT_C static CCMSKeyAgreeRecipientInfo* NewL(
       
    88             const CCMSOriginatorIdentifierOrKey& aOriginator,
       
    89             const TDesC8& aUkm,
       
    90             const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm,
       
    91             const CArrayPtr< CCMSRecipientEncryptedKey >& aRecipientEncryptedKeys );
       
    92 
       
    93         /**
       
    94         * Destructor.
       
    95         */
       
    96         virtual ~CCMSKeyAgreeRecipientInfo();
       
    97 
       
    98     public: // New functions
       
    99 
       
   100         /**
       
   101         * Getter for Originator
       
   102         * @since 3.0
       
   103         * @return OriginatorIdentifierOrKey
       
   104         */
       
   105 		IMPORT_C const CCMSOriginatorIdentifierOrKey& Originator() const;
       
   106 
       
   107         /**
       
   108         * Getter for RecipientEncryptedKeys
       
   109         * @since 3.0
       
   110         * @return array of RecipientEncryptedKeys
       
   111         */
       
   112 		IMPORT_C const CArrayPtr< CCMSRecipientEncryptedKey >&
       
   113         RecipientEncryptedKeys() const;
       
   114 
       
   115         /**
       
   116         * Getter for UserKeyingMaterial. Ownership is not transferred.
       
   117         * @since 2,8
       
   118         * @return UserKeyingMaterial or NULL
       
   119         */
       
   120 		IMPORT_C const TDesC8* UserKeyingMaterial() const;
       
   121 
       
   122 		/**
       
   123         * Setter for Originator. Creates a copy of the parameters.
       
   124         * @since 3.0
       
   125         * @param aOriginator OriginatorIdentifierOrKey
       
   126         */
       
   127 		IMPORT_C void SetOriginatorL(
       
   128             const CCMSOriginatorIdentifierOrKey& aOriginator );
       
   129 
       
   130         /**
       
   131         * Setter for RecipientEncryptedKeys. Creates a copy of the parameters.
       
   132         * @since 3.0
       
   133         * @param aRecipientEncryptedKeys Array of RecipientEncryptedKeys
       
   134         */
       
   135 		IMPORT_C void SetRecipientEncryptedKeysL(
       
   136             const CArrayPtr< CCMSRecipientEncryptedKey >& aRecipientEncryptedKeys );
       
   137 
       
   138 		/**
       
   139         * Setter for UserKeyingMaterial. Creates a copy of the parameters.
       
   140         * @since 3.0
       
   141         * @param aUkm UserKeyingMaterial
       
   142         */
       
   143 		IMPORT_C void SetUserKeyingMaterialL(
       
   144             const TDesC8& aUkm );
       
   145 
       
   146     public: // Functions from base classes
       
   147 
       
   148 	 	/**
       
   149         * From MCMSModule
       
   150         * @since 3.0
       
   151         * @param aRawData raw-data to be parsed in this instance
       
   152         */
       
   153         void DecodeL( const TDesC8& aRawData );
       
   154 
       
   155 	 	/**
       
   156         * From MCMSModule
       
   157         * @since 3.0
       
   158         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   159         */
       
   160         CASN1EncBase* EncoderLC() const;
       
   161 
       
   162         /**
       
   163          * From CCMSRecipientInfo
       
   164          * @since 3.0
       
   165          * @return Returns ASN1 encoder with explicit tag 1 and leaves
       
   166          * it in CleanupStack.
       
   167          */
       
   168         CASN1EncBase* TaggedEncoderLC() const;
       
   169          
       
   170           
       
   171         
       
   172     protected:  // New functions
       
   173 
       
   174         /**
       
   175          * Protected constructor to allow derivation
       
   176          */
       
   177         IMPORT_C void ConstructL( );
       
   178 
       
   179 	   /**
       
   180         * Protected construction to allow derivation
       
   181         */
       
   182         IMPORT_C void ConstructL(
       
   183             const CCMSOriginatorIdentifierOrKey& aOriginator,
       
   184             const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm,
       
   185             const CArrayPtr< CCMSRecipientEncryptedKey >& aRecipientEncryptedKeys );
       
   186 
       
   187        /**
       
   188         * Protected construction to allow derivation
       
   189         */
       
   190         IMPORT_C void ConstructL(
       
   191             const CCMSOriginatorIdentifierOrKey& aOriginator,
       
   192             const TDesC8& aUkm,
       
   193             const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm,
       
   194             const CArrayPtr< CCMSRecipientEncryptedKey >& aRecipientEncryptedKeys );
       
   195 
       
   196         /**
       
   197         * C++ constructor.
       
   198         */
       
   199         IMPORT_C CCMSKeyAgreeRecipientInfo( );
       
   200 
       
   201     private:    // Data
       
   202         // originator, owned
       
   203         CCMSOriginatorIdentifierOrKey* iOriginator;
       
   204 
       
   205         // keyEncryptionAlgorithm, owned
       
   206         CCMSX509AlgorithmIdentifier* iKeyEncryptionAlgorithm;
       
   207 
       
   208         // recipientEncryptedKeys, owned
       
   209         CArrayPtr< CCMSRecipientEncryptedKey >* iRecipientEncryptedKeys;
       
   210 
       
   211         // UserKeyingMaterial, owned
       
   212         TDesC8* iUserKeyingMaterial;
       
   213 
       
   214         // Reserved for extensions
       
   215         MCMSKeyAgreeRecipientInfo* iReserved;
       
   216         
       
   217     };
       
   218 
       
   219 #endif      // CCMSKeyAgreeRecipientInfo_H
       
   220 
       
   221 // End of File