rtp/srtpstack/inc/srtpaesctrcrypto.h
changeset 0 307788aac0a8
child 9 1e1cc61f56c3
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005 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:    Class for AES (in Counter Mode) encryption operations
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __SRTPAESCTRCRYPTO_H__
       
    22 #define __SRTPAESCTRCRYPTO_H__
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 
       
    27 class CSrtpAESCTRCrypto : public CBase
       
    28   	{
       
    29 public:
       
    30     /**
       
    31     * Constructor.
       
    32     * @leave KErrNone if success, system-wide error code otherwise
       
    33     */
       
    34 	IMPORT_C static CSrtpAESCTRCrypto* NewL();
       
    35 		
       
    36 	/**
       
    37     * AES CM cipher, produces generic keystream
       
    38     * @param aBitLength  key length.
       
    39     * @param aKey  Input key.
       
    40     * @param aIV  Integer Value (IV).
       
    41 	* Returns HBufC8* generated keystream
       
    42 	*/
       
    43 	IMPORT_C HBufC8* KeystreamL(TUint aBitLength, const TDesC8& aKey, const TDesC8& aIV );
       
    44 	
       
    45 	/**
       
    46     * AES CM cipher, produces key stream and performs an XOR operation for the text
       
    47     * @param aKey  Input key.
       
    48     * @param aIV  Integer Value (IV).
       
    49     * @param aSrc source data which will be encrypted.
       
    50 	* Returns HBufC8* decrypted/encrypted source
       
    51 	*/
       
    52 	IMPORT_C HBufC8* EncryptL(const TDesC8& aKey, const TDesC8& aIV, const TDesC8& aSrc);
       
    53 		
       
    54 	/**
       
    55     * Destructor
       
    56 	*/
       
    57 	~CSrtpAESCTRCrypto();
       
    58 private:
       
    59     /**
       
    60     * Default constructor.
       
    61     */
       
    62 	CSrtpAESCTRCrypto( );
       
    63 		
       
    64 	/**
       
    65     * Increases IV's value by one. 
       
    66     * Sets IV's last 32 bits to 0 if their value is max
       
    67     * @param aIV  Integer Value (IV).
       
    68 	*/
       
    69 	void IncreaseIV(TDes8& iv);
       
    70 	
       
    71 	#ifdef EUNIT_TESTING
       
    72         friend class UT_CSrtpAESCTRCrypto;
       
    73     #endif     
       
    74 	};
       
    75 
       
    76 #endif // __SrtpAESCTRCrypto_H__