secsrv_plat/cms_api/inc/CCMSRecipientEncryptedKey.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 CCMSRecipientEncryptedKey_H
       
    21 #define CCMSRecipientEncryptedKey_H
       
    22 
       
    23 #include "CCMSSequence.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CCMSIssuerAndSerialNumber;
       
    27 class CCMSKeyIdentifier;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 /**
       
    31 *  RecipientEncryptedKey type module
       
    32 *
       
    33 *  ASN.1 definition:
       
    34 *  RecipientEncryptedKey ::= SEQUENCE {
       
    35 *        rid KeyAgreeRecipientIdentifier,
       
    36 *        encryptedKey EncryptedKey }
       
    37 *
       
    38 *  KeyAgreeRecipientIdentifier ::= CHOICE {
       
    39 *        issuerAndSerialNumber IssuerAndSerialNumber,
       
    40 *        rKeyId [0] IMPLICIT RecipientKeyIdentifier }
       
    41 *
       
    42 *  EncryptedKey ::= OCTET STRING
       
    43 *
       
    44 *  @lib cms.lib
       
    45 *  @since 2.8
       
    46 */
       
    47 class CCMSRecipientEncryptedKey : public CCMSSequence
       
    48     {
       
    49     public:  // Constructors and destructor
       
    50 		/**
       
    51         * Two-phased constructor.
       
    52         */
       
    53         IMPORT_C static CCMSRecipientEncryptedKey* NewL();
       
    54 
       
    55         /**
       
    56         * Two-phased constructor. Copies of the parameters are made.
       
    57         *
       
    58         * @param aIssuerAndSerialNumber rid (KeyAgreeRecipientIdentifier) value
       
    59         * @param aEncryptedKey EncryptedKey value
       
    60         */
       
    61         IMPORT_C static CCMSRecipientEncryptedKey* NewL(
       
    62             const CCMSIssuerAndSerialNumber& aIssuerAndSerialNumber,
       
    63             const TDesC8& aEncryptedKey );
       
    64 
       
    65         /**
       
    66         * Two-phased constructor. Copies of the parameters are made.
       
    67         *
       
    68         * @param aRKeyId rid (KeyAgreeRecipientIdentifier) value
       
    69         * @param aEncryptedKey EncryptedKey value
       
    70         */
       
    71         IMPORT_C static CCMSRecipientEncryptedKey* NewL(
       
    72             const CCMSKeyIdentifier& aRKeyId,
       
    73             const TDesC8& aEncryptedKey );
       
    74 
       
    75 
       
    76         /**
       
    77         * Destructor.
       
    78         */
       
    79         virtual ~CCMSRecipientEncryptedKey();
       
    80 
       
    81     public: // New functions
       
    82         /**
       
    83         * Getter for EncryptedKey
       
    84         * @since 2.8
       
    85         * @return EncryptedKey
       
    86         */
       
    87 		IMPORT_C const TDesC8& EncryptedKey() const;
       
    88 
       
    89         /**
       
    90         * Getter for IssuerAndSerialNumber. Ownership is not transferred.
       
    91         * @since 2,8
       
    92         * @return IssuerAndSerialNumber or NULL if rid is not
       
    93         * IssuerAndSerialNumber
       
    94         */
       
    95 		IMPORT_C const CCMSIssuerAndSerialNumber* IssuerAndSerialNumber() const;
       
    96 
       
    97         /**
       
    98         * Getter for rKeyId. Ownership is not transferred.
       
    99         * @since 2,8
       
   100         * @return rKeyId or NULL if rid is not rKeyId.
       
   101         */
       
   102 		IMPORT_C const CCMSKeyIdentifier* RKeyId() const;
       
   103 
       
   104 		/**
       
   105         * Setter for EncryptedKey. Creates a copy of the parameters.
       
   106         * @since 2.8
       
   107         * @param aEncryptedKey EncryptedKey value.
       
   108         */
       
   109 		IMPORT_C void SetEncryptedKeyL(
       
   110             const TDesC8& aEncryptedKey );
       
   111 
       
   112 		/**
       
   113         * Setter for IssuerAndSerialNumber. Creates a copy of the parameters.
       
   114         * Note that any existing rKeyId value is deleted.
       
   115         * @since 2.8
       
   116         * @param aIssuerAndSerialNumber IssuerAndSerialNumber value.
       
   117         */
       
   118 		IMPORT_C void SetIssuerAndSerialNumberL(
       
   119             const CCMSIssuerAndSerialNumber& aIssuerAndSerialNumber );
       
   120 
       
   121 		/**
       
   122         * Setter for rKeyId. Creates a copy of the parameters.
       
   123         * Note that any existing IssuerAndSerialNumber value is deleted.
       
   124         * @since 2.8
       
   125         * @param aRKeyId RecipientEncryptedKey value.
       
   126         */
       
   127 		IMPORT_C void SetRKeyIdL(
       
   128             const CCMSKeyIdentifier& aRKeyId );
       
   129 
       
   130 
       
   131     public: // Functions from base classes
       
   132 
       
   133 	 	/**
       
   134         * From MCMSModule
       
   135         * @since 2.8
       
   136         * @param aRawData raw-data to be parsed in this instance
       
   137         */
       
   138         void DecodeL( const TDesC8& aRawData );
       
   139 
       
   140 	 	/**
       
   141         * From MCMSModule
       
   142         * @since 2.8
       
   143         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   144         */
       
   145         CASN1EncBase* EncoderLC() const;
       
   146 
       
   147     protected:  // New functions
       
   148 
       
   149 	   /**
       
   150         * Protected construction to allow derivation
       
   151         */
       
   152         IMPORT_C void ConstructL(
       
   153             const CCMSIssuerAndSerialNumber& aIssuerAndSerialNumber,
       
   154             const TDesC8& aEncryptedKey );
       
   155 
       
   156        /**
       
   157         * Protected construction to allow derivation
       
   158         */
       
   159         IMPORT_C void ConstructL(
       
   160             const CCMSKeyIdentifier& aRKeyId,
       
   161             const TDesC8& aEncryptedKey );
       
   162 
       
   163         /**
       
   164         * C++ default constructor.
       
   165         */
       
   166         IMPORT_C CCMSRecipientEncryptedKey();
       
   167 
       
   168     private:    // Data
       
   169         // EncryptedKey, owned
       
   170         TDesC8* iEncryptedKey;
       
   171         // IssuerAndSerialNumber, owned
       
   172         CCMSIssuerAndSerialNumber* iIssuerAndSerialNumber;
       
   173         // RecipientEncryptedKey, owned
       
   174         CCMSKeyIdentifier* iRKeyId;
       
   175 
       
   176     };
       
   177 
       
   178 #endif      // CCMSRecipientEncryptedKey_H
       
   179 
       
   180 // End of File