os/security/cryptoplugins/cryptospiplugins/test/h4drv/crypto_h4_plugin/rijndaelimpl.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoplugins/cryptospiplugins/test/h4drv/crypto_h4_plugin/rijndaelimpl.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,98 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @internalComponent
    1.25 + @released
    1.26 +*/
    1.27 +#ifndef	__RIJNDAELIMPL_H__
    1.28 +#define	__RIJNDAELIMPL_H__
    1.29 +#include <e32base.h>
    1.30 +#include <e32cmn.h>
    1.31 +#include "keys.h"
    1.32 +#include "h4cipherimpl.h"
    1.33 +#include "cryptodriver.h"
    1.34 +
    1.35 +/**
    1.36 +Plug-in class for AES (Rijndael) block cipher
    1.37 +*/
    1.38 +namespace HwCrypto
    1.39 +	{
    1.40 +	class __NOTSHARED CH4RijndaelImpl : public CH4CipherImpl
    1.41 +		{
    1.42 +	public:
    1.43 +	
    1.44 +		/**
    1.45 +		Creates an instance of an AES (Rijndael) symmetric cipher plug-in.
    1.46 +		@param aKey The key
    1.47 +		@param aCryptoMode Whether to encrypt or decrypt
    1.48 +		@param aOperationMode The block cipher mode ECB, CBC, CTR etc
    1.49 +		@param aPadding The padding scheme to use None, SSLv3, PKCS#7
    1.50 +		@return A pointer to a CH4RijndaelImpl instance
    1.51 +		*/
    1.52 +		static CH4RijndaelImpl* NewL(const CryptoSpi::CKey& aKey, 
    1.53 +			TUid aCryptoMode, TUid aOperationMode, TUid aPadding);
    1.54 +
    1.55 +		/**
    1.56 +		Creates an instance of an AES (Rijndael) symmetric cipher plug-in.
    1.57 +		A pointer to the plug-in instance is placed on the cleanup stack.
    1.58 +		@param aKey The key
    1.59 +		@param aCryptoMode Whether to encrypt or decrypt
    1.60 +		@param aOperationMode The block cipher mode ECB, CBC, CTR etc
    1.61 +		@param aPadding The padding scheme to use None, SSLv3, PKCS#7
    1.62 +		@return A pointer to a CH4RijndaelImpl instance
    1.63 +		*/
    1.64 +		static CH4RijndaelImpl* NewLC(const CryptoSpi::CKey& aKey, 
    1.65 +			TUid aCryptoMode,	TUid aOperationMode, TUid aPadding);
    1.66 +
    1.67 +		// From CSymmetricCipherImpl
    1.68 +		TBool IsValidKeyLength(TInt aKeyBytes) const;
    1.69 +		TUid ImplementationUid() const;
    1.70 +
    1.71 +		const CExtendedCharacteristics* GetExtendedCharacteristicsL();
    1.72 +		
    1.73 +		static CExtendedCharacteristics* StaticGetExtendedCharacteristicsL();
    1.74 +		
    1.75 +		/// Destructor
    1.76 +		~CH4RijndaelImpl();
    1.77 +
    1.78 +	private:
    1.79 +		/**
    1.80 +		Constructor
    1.81 +		@param aOperationMode The mode of operation e.g. CBC
    1.82 +		@param aCryptoMode Whether to encrypt or decrypt
    1.83 +		@param aPaddingMode The padding mode to use. None, SSL, PKCS#7
    1.84 +		*/
    1.85 +		CH4RijndaelImpl(TUid aOperationMode, TUid aCryptoMode, TUid aPaddingMode);
    1.86 +			
    1.87 +		///	second phase of construction	
    1.88 +		void ConstructL(const CryptoSpi::CKey& aKey);
    1.89 +					
    1.90 +		// From CH4CipherImpl
    1.91 +		virtual void DoSetupL();
    1.92 +		virtual void DoWriteL(const TUint8* aBuffer, TUint aNumBytes);
    1.93 +		virtual void DoReadL(TDes8 &aBuffer, TUint32 aLength);
    1.94 +				
    1.95 +	private:
    1.96 +		RCryptoDriver iDriver;
    1.97 +		TBool iDriverOpen;
    1.98 +		};
    1.99 +	}
   1.100 +
   1.101 +#endif //__RIJNDAELIMPL_H__