sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #ifndef __BUFFEREDTRANSFORMATIONSHIM_H__ sl@0: #define __BUFFEREDTRANSFORMATIONSHIM_H__ sl@0: sl@0: #include sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: sl@0: namespace CryptoSpi sl@0: { sl@0: class CSymmetricCipher; sl@0: } sl@0: sl@0: /** sl@0: Shim class that delegates all operations to an Crypto Spi object. sl@0: This object is constructed automatically by CBufferedEncryptorShim and should sl@0: not be used directly. sl@0: */ sl@0: NONSHARABLE_CLASS(CBufferedEncryptorShim) : public CBufferedEncryptor sl@0: { sl@0: public: sl@0: /** sl@0: Creates a new CBufferedEncryptorShim. sl@0: N.B. It is the reponsiblity of the CALLER to check that block transform sl@0: object contains an SPI delegate and that the delegate supports the specified sl@0: padding mode. sl@0: */ sl@0: static CBufferedEncryptorShim* NewL(CBlockTransformation* aBT, CPadding* aPadding); sl@0: sl@0: // From CBufferedTransformation sl@0: void Process(const TDesC8& aInput, TDes8& aOutput); sl@0: TInt MaxOutputLength(TInt aInputLength) const; sl@0: void Reset(); sl@0: TInt BlockSize() const; sl@0: TInt KeySize() const; sl@0: void ProcessFinalL(const TDesC8& aInput, TDes8& aOutput); sl@0: TInt MaxFinalOutputLength(TInt aInputLength) const; sl@0: private: sl@0: CBufferedEncryptorShim(CryptoSpi::CSymmetricCipher* aSymmetricCipherImpl); sl@0: void ConstructL(CBlockTransformation* aBT, CPadding* aPadding); sl@0: sl@0: // owned by block transform - iBT sl@0: CryptoSpi::CSymmetricCipher* iSymmetricCipherImpl; sl@0: }; sl@0: sl@0: /** sl@0: Shim class that delegates all operations to an Crypto Spi object. sl@0: This object is constructed automatically by CBufferedEncryptorShim and should sl@0: not be used directly. sl@0: */ sl@0: NONSHARABLE_CLASS(CBufferedDecryptorShim) : public CBufferedDecryptor sl@0: { sl@0: public: sl@0: /** sl@0: Creates a new CBufferedDecryptorShim. sl@0: N.B. It is the reponsiblity of the CALLER to check that block transform sl@0: object contains an SPI delegate and that the delegate supports the specified sl@0: padding mode. sl@0: */ sl@0: static CBufferedDecryptorShim* NewL(CBlockTransformation* aBT, CPadding* aPadding); sl@0: sl@0: // From CBufferedTransformation sl@0: void Process(const TDesC8& aInput, TDes8& aOutput); sl@0: TInt MaxOutputLength(TInt aInputLength) const; sl@0: void Reset(); sl@0: TInt BlockSize() const; sl@0: TInt KeySize() const; sl@0: void ProcessFinalL(const TDesC8& aInput, TDes8& aOutput); sl@0: TInt MaxFinalOutputLength(TInt aInputLength) const; sl@0: private: sl@0: CBufferedDecryptorShim(CryptoSpi::CSymmetricCipher* aSymmetricCipherImpl); sl@0: void ConstructL(CBlockTransformation* aBT, CPadding* aPadding); sl@0: sl@0: // owned by block transform - iBT sl@0: CryptoSpi::CSymmetricCipher* iSymmetricCipherImpl; sl@0: }; sl@0: sl@0: #endif // __BUFFEREDTRANSFORMATIONSHIM_H__