ipappprotocols_plat/srtp_api/inc/srtpmastersalt.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     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:    Contains SRTP master salt class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __SRTP_MASTER_SALT_H__
       
    22 #define __SRTP_MASTER_SALT_H__
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32def.h>
       
    26 #include <e32des8.h>
       
    27 #include "srtpdef.h"
       
    28 
       
    29 
       
    30 /**
       
    31 * Contains a salt used in encryption and decryption.
       
    32 */
       
    33 class CSRTPMasterSalt : public CBase
       
    34     {
       
    35     public: // constructor
       
    36     
       
    37         /**
       
    38         * Two-phased constructor.
       
    39         * CSRTPCryptoContext takes the ownership of MasterKey and MasterSalt 
       
    40         * @param aKey  The master salt value.
       
    41         * @param aN_S  The length of the session salt
       
    42         * @leave KErrNone if success, system-wide error code otherwise
       
    43         */
       
    44         IMPORT_C static CSRTPMasterSalt* NewL( const TDesC8& aKey, 
       
    45                         TUint aN_S = KSRTPDefSessionSaltingKeyLength );
       
    46 
       
    47         /**
       
    48         * Two-phased constructor.
       
    49         * CSRTPCryptoContext takes the ownership of MasterKey and MasterSalt 
       
    50         * @param aKey  The master salt value.
       
    51         * @param aN_S  The length of the session salt
       
    52         * @leave KErrNone if success, system-wide error code otherwise
       
    53         */
       
    54         IMPORT_C static CSRTPMasterSalt* NewLC( const TDesC8& aKey, 
       
    55                         TUint aN_S = KSRTPDefSessionSaltingKeyLength );
       
    56                         
       
    57         /**
       
    58         * Destructor
       
    59         */
       
    60         ~CSRTPMasterSalt();                
       
    61        
       
    62         /*
       
    63 		* Gets master salt
       
    64         * @return master salt
       
    65         */                                
       
    66         IMPORT_C  const TDesC8& MasterSalt() const;
       
    67                             
       
    68         /*
       
    69 		* Gets length of the session salt
       
    70         * @return length of the session salt
       
    71         */                                
       
    72         IMPORT_C  TUint SaltLength() const;
       
    73         
       
    74         /*
       
    75 		* Check the validity of the whole CSRTPMasterSalt
       
    76         * @return validity of this CSRTPMasterSalt
       
    77         */
       
    78         IMPORT_C  TBool Valid() const;                 
       
    79         
       
    80 
       
    81     private: // methods
       
    82         
       
    83         CSRTPMasterSalt( TUint aN_S );
       
    84         
       
    85         void ConstructL( const TDesC8& aKey );
       
    86     
       
    87         /* assignment operator */
       
    88          const CSRTPMasterSalt& operator=(const CSRTPMasterSalt& aSalt);  
       
    89 
       
    90     private: // data
       
    91         /**
       
    92         * The master salt value.
       
    93         * The length of the salt is determined by the Size() function.
       
    94         */
       
    95         HBufC8 *iKey;
       
    96 
       
    97         /**
       
    98         * The length of the session salt
       
    99         */
       
   100         const TUint iN_S;
       
   101 
       
   102     friend class CSRTPCryptoContext;
       
   103     
       
   104 	#ifdef EUNIT_TESTING
       
   105         friend class UT_CSRTPMasterSalt;
       
   106     #endif         
       
   107     };
       
   108 
       
   109 
       
   110 #endif // __SRTP_MASTER_SALT_H__