os/security/crypto/weakcrypto/inc/msymmetriccipher.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcrypto/inc/msymmetriccipher.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,113 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-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 +* csymmetriccipher.h
    1.19 +* ** IMPORTANT ** PublishedPartner API's in this file are published to 3rd party developers via the 
    1.20 +* Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted.
    1.21 +* CSymmetricCipher class implementation
    1.22 +*
    1.23 +*/
    1.24 +
    1.25 +
    1.26 +/**
    1.27 + @file 
    1.28 + @publishedPartner
    1.29 + @released
    1.30 +*/
    1.31 + 
    1.32 +#ifndef __CSYMMETRICCIPHER_H__
    1.33 +#define __CSYMMETRICCIPHER_H__
    1.34 +
    1.35 +#include <e32base.h>
    1.36 +
    1.37 +/**
    1.38 + * Top-level interface designed to collate the behaviour of all symmetric
    1.39 + * ciphers under one interface.
    1.40 + *
    1.41 + * See the Cryptography api-guide documentation.
    1.42 + *
    1.43 + * @publishedPartner
    1.44 + * @released
    1.45 + */
    1.46 +class CSymmetricCipher : public CBase
    1.47 +	{
    1.48 +public:
    1.49 +	/**
    1.50 +	 * Runs the underlying transformation on aInput and appends the result to
    1.51 +	 * aOutput.
    1.52 +	 *
    1.53 +	 * For incremental buffering rules see the Cryptography api-guide documentation.
    1.54 +	 *
    1.55 +	 * @param aInput	The input data to be processed.
    1.56 +	 * @param aOutput	The resulting processed data appended to aOutput.  aOutput must
    1.57 +	 *					have MaxOutputLength() empty bytes remaining in its length.
    1.58 +	 */
    1.59 +	virtual void Process(const TDesC8& aInput, TDes8& aOutput) = 0;
    1.60 +
    1.61 +	/**
    1.62 +	 * Pads aInput to be block aligned using the underlying padding system, if any,
    1.63 +	 * and then runs the underlying transformation on aInput, and appends the result
    1.64 +	 * to aOutput.  
    1.65 +	 *
    1.66 +	 * For incremental buffering rules see the Cryptography api-guide documentation.
    1.67 +	 *
    1.68 +	 * @param aInput	The input data to be processed.
    1.69 +	 * @param aOutput	The resulting, possibly padded, processed data appended to
    1.70 +	 *					aOutput.  aOutput must have MaxFinalOutputLength() empty bytes
    1.71 +	 *					remaining in its length.
    1.72 +	 */
    1.73 +	virtual void ProcessFinalL(const TDesC8& aInput, TDes8& aOutput) = 0;
    1.74 +
    1.75 +	/**	
    1.76 +	 * Gets a tight upper bound on the number of bytes that would be returned by a
    1.77 +	 * call to Process() with aInputLength bytes of data.
    1.78 +	 *
    1.79 +	 * @param aInputLength	The length of data to be supplied to Process() in bytes.
    1.80 +	 * @return				The length of data which would result from a call to 
    1.81 +	 *						Process() with an aInputLength number of bytes.
    1.82 +	 */
    1.83 +	virtual TInt MaxOutputLength(TInt aInputLength) const = 0;
    1.84 +
    1.85 +	/**	
    1.86 +	 * Gets as tight an upper bound as possible on the number of bytes that would
    1.87 +	 * be returned by a call to ProcessFinalL() with aInputLength bytes of data.
    1.88 +	 *
    1.89 +	 * @param aInputLength	The length of data to be supplied to Process() in bytes.
    1.90 +	 * @return				An upper bound on the length of data which would result from 
    1.91 +	 *						a call to ProcessFinalL() with an aInputLength number of bytes.
    1.92 +	 */
    1.93 +	virtual TInt MaxFinalOutputLength(TInt aInputLength) const = 0;
    1.94 +
    1.95 +	/**
    1.96 +	 * Resets the cipher back to its original state. Clears all its buffers.
    1.97 +	 */
    1.98 +	virtual void Reset() = 0;
    1.99 +
   1.100 +	/**
   1.101 +	 * Gets the block size in bytes (1 for stream ciphers).
   1.102 +	 *
   1.103 +	 * @return	Block size of underlying cipher in bytes.
   1.104 +	 */
   1.105 +	virtual TInt BlockSize() const = 0;
   1.106 +
   1.107 +	/**
   1.108 +	 * Gets the key size in bits.
   1.109 +	 *	
   1.110 +	 * @return	Key size in bits.
   1.111 +	 */
   1.112 +	virtual TInt KeySize() const = 0;
   1.113 +};
   1.114 +
   1.115 +
   1.116 +#endif	//	__CSYMMETRICCIPHER_H__