1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/crypto/weakcryptospi/source/symmetric/bufferedtransformationshim.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,99 @@
1.4 +/*
1.5 +* Copyright (c) 2006-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 +#ifndef __BUFFEREDTRANSFORMATIONSHIM_H__
1.23 +#define __BUFFEREDTRANSFORMATIONSHIM_H__
1.24 +
1.25 +#include <bufferedtransformation.h>
1.26 +
1.27 +/**
1.28 +@file
1.29 +@internalComponent
1.30 +@released
1.31 +*/
1.32 +
1.33 +namespace CryptoSpi
1.34 + {
1.35 + class CSymmetricCipher;
1.36 + }
1.37 +
1.38 +/**
1.39 + Shim class that delegates all operations to an Crypto Spi object.
1.40 + This object is constructed automatically by CBufferedEncryptorShim and should
1.41 + not be used directly.
1.42 + */
1.43 +NONSHARABLE_CLASS(CBufferedEncryptorShim) : public CBufferedEncryptor
1.44 +{
1.45 +public:
1.46 + /**
1.47 + Creates a new CBufferedEncryptorShim.
1.48 + N.B. It is the reponsiblity of the CALLER to check that block transform
1.49 + object contains an SPI delegate and that the delegate supports the specified
1.50 + padding mode.
1.51 + */
1.52 + static CBufferedEncryptorShim* NewL(CBlockTransformation* aBT, CPadding* aPadding);
1.53 +
1.54 + // From CBufferedTransformation
1.55 + void Process(const TDesC8& aInput, TDes8& aOutput);
1.56 + TInt MaxOutputLength(TInt aInputLength) const;
1.57 + void Reset();
1.58 + TInt BlockSize() const;
1.59 + TInt KeySize() const;
1.60 + void ProcessFinalL(const TDesC8& aInput, TDes8& aOutput);
1.61 + TInt MaxFinalOutputLength(TInt aInputLength) const;
1.62 +private:
1.63 + CBufferedEncryptorShim(CryptoSpi::CSymmetricCipher* aSymmetricCipherImpl);
1.64 + void ConstructL(CBlockTransformation* aBT, CPadding* aPadding);
1.65 +
1.66 + // owned by block transform - iBT
1.67 + CryptoSpi::CSymmetricCipher* iSymmetricCipherImpl;
1.68 +};
1.69 +
1.70 +/**
1.71 + Shim class that delegates all operations to an Crypto Spi object.
1.72 + This object is constructed automatically by CBufferedEncryptorShim and should
1.73 + not be used directly.
1.74 + */
1.75 +NONSHARABLE_CLASS(CBufferedDecryptorShim) : public CBufferedDecryptor
1.76 +{
1.77 +public:
1.78 + /**
1.79 + Creates a new CBufferedDecryptorShim.
1.80 + N.B. It is the reponsiblity of the CALLER to check that block transform
1.81 + object contains an SPI delegate and that the delegate supports the specified
1.82 + padding mode.
1.83 + */
1.84 + static CBufferedDecryptorShim* NewL(CBlockTransformation* aBT, CPadding* aPadding);
1.85 +
1.86 + // From CBufferedTransformation
1.87 + void Process(const TDesC8& aInput, TDes8& aOutput);
1.88 + TInt MaxOutputLength(TInt aInputLength) const;
1.89 + void Reset();
1.90 + TInt BlockSize() const;
1.91 + TInt KeySize() const;
1.92 + void ProcessFinalL(const TDesC8& aInput, TDes8& aOutput);
1.93 + TInt MaxFinalOutputLength(TInt aInputLength) const;
1.94 +private:
1.95 + CBufferedDecryptorShim(CryptoSpi::CSymmetricCipher* aSymmetricCipherImpl);
1.96 + void ConstructL(CBlockTransformation* aBT, CPadding* aPadding);
1.97 +
1.98 + // owned by block transform - iBT
1.99 + CryptoSpi::CSymmetricCipher* iSymmetricCipherImpl;
1.100 +};
1.101 +
1.102 +#endif // __BUFFEREDTRANSFORMATIONSHIM_H__