os/security/crypto/weakcryptospi/source/symmetric/bufferedtransformationshim.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2006-2009 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 the License "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: 
    15 *
    16 */
    17 
    18 
    19 #ifndef __BUFFEREDTRANSFORMATIONSHIM_H__
    20 #define __BUFFEREDTRANSFORMATIONSHIM_H__
    21 
    22 #include <bufferedtransformation.h>
    23 
    24 /**
    25 @file
    26 @internalComponent
    27 @released
    28 */
    29 
    30 namespace CryptoSpi 
    31 	{
    32 	class CSymmetricCipher;
    33 	}
    34 
    35 /**
    36  Shim class that delegates all operations to an Crypto Spi object.
    37  This object is constructed automatically by CBufferedEncryptorShim and should
    38  not be used directly.
    39  */
    40 NONSHARABLE_CLASS(CBufferedEncryptorShim) : public CBufferedEncryptor
    41 {
    42 public:
    43 	/**
    44 	Creates a new CBufferedEncryptorShim.
    45 	N.B. It is the reponsiblity of the CALLER to check that block transform
    46 	object contains an SPI delegate and that the delegate supports the specified
    47 	padding mode.
    48 	*/
    49 	static CBufferedEncryptorShim* NewL(CBlockTransformation* aBT, CPadding* aPadding);
    50 	
    51 	// From CBufferedTransformation
    52 	void Process(const TDesC8& aInput, TDes8& aOutput);
    53 	TInt MaxOutputLength(TInt aInputLength) const;
    54 	void Reset();
    55 	TInt BlockSize() const;
    56 	TInt KeySize() const;	
    57 	void ProcessFinalL(const TDesC8& aInput, TDes8& aOutput);
    58 	TInt MaxFinalOutputLength(TInt aInputLength) const;
    59 private:	
    60 	CBufferedEncryptorShim(CryptoSpi::CSymmetricCipher* aSymmetricCipherImpl);
    61 	void ConstructL(CBlockTransformation* aBT, CPadding* aPadding);
    62 	
    63 	// owned by block transform - iBT
    64 	CryptoSpi::CSymmetricCipher* iSymmetricCipherImpl;
    65 };
    66 
    67 /**
    68  Shim class that delegates all operations to an Crypto Spi object.
    69  This object is constructed automatically by CBufferedEncryptorShim and should
    70  not be used directly.
    71  */
    72 NONSHARABLE_CLASS(CBufferedDecryptorShim) : public CBufferedDecryptor
    73 {
    74 public:
    75 	/**
    76 	Creates a new CBufferedDecryptorShim.
    77 	N.B. It is the reponsiblity of the CALLER to check that block transform
    78 	object contains an SPI delegate and that the delegate supports the specified
    79 	padding mode.
    80 	*/
    81 	static CBufferedDecryptorShim* NewL(CBlockTransformation* aBT, CPadding* aPadding);
    82 	
    83 	// From CBufferedTransformation	
    84 	void Process(const TDesC8& aInput, TDes8& aOutput);
    85 	TInt MaxOutputLength(TInt aInputLength) const;
    86 	void Reset();
    87 	TInt BlockSize() const;
    88 	TInt KeySize() const;	
    89 	void ProcessFinalL(const TDesC8& aInput, TDes8& aOutput);
    90 	TInt MaxFinalOutputLength(TInt aInputLength) const;
    91 private:	
    92 	CBufferedDecryptorShim(CryptoSpi::CSymmetricCipher* aSymmetricCipherImpl);
    93 	void ConstructL(CBlockTransformation* aBT, CPadding* aPadding);
    94 	
    95 	// owned by block transform - iBT
    96 	CryptoSpi::CSymmetricCipher* iSymmetricCipherImpl;
    97 };
    98 
    99 #endif	//	__BUFFEREDTRANSFORMATIONSHIM_H__