os/security/crypto/weakcryptospi/inc/msymmetriccipher.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2002-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 * csymmetriccipher.h
    16 * ** IMPORTANT ** PublishedPartner API's in this file are published to 3rd party developers via the 
    17 * Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted.
    18 * CSymmetricCipher class implementation
    19 *
    20 */
    21 
    22 
    23 /**
    24  @file 
    25  @publishedPartner
    26  @released
    27 */
    28  
    29 #ifndef __CSYMMETRICCIPHER_H__
    30 #define __CSYMMETRICCIPHER_H__
    31 
    32 #include <e32base.h>
    33 
    34 /**
    35  * Top-level interface designed to collate the behaviour of all symmetric
    36  * ciphers under one interface.
    37  *
    38  * See the Cryptography api-guide documentation.
    39  *
    40  * @publishedPartner
    41  * @released
    42  */
    43 class CSymmetricCipher : public CBase
    44 	{
    45 public:
    46 	/**
    47 	 * Runs the underlying transformation on aInput and appends the result to
    48 	 * aOutput.
    49 	 *
    50 	 * For incremental buffering rules see the Cryptography api-guide documentation.
    51 	 *
    52 	 * @param aInput	The input data to be processed.
    53 	 * @param aOutput	The resulting processed data appended to aOutput.  aOutput must
    54 	 *					have MaxOutputLength() empty bytes remaining in its length.
    55 	 */
    56 	virtual void Process(const TDesC8& aInput, TDes8& aOutput) = 0;
    57 
    58 	/**
    59 	 * Pads aInput to be block aligned using the underlying padding system, if any,
    60 	 * and then runs the underlying transformation on aInput, and appends the result
    61 	 * to aOutput.  
    62 	 *
    63 	 * For incremental buffering rules see the Cryptography api-guide documentation.
    64 	 *
    65 	 * @param aInput	The input data to be processed.
    66 	 * @param aOutput	The resulting, possibly padded, processed data appended to
    67 	 *					aOutput.  aOutput must have MaxFinalOutputLength() empty bytes
    68 	 *					remaining in its length.
    69 	 */
    70 	virtual void ProcessFinalL(const TDesC8& aInput, TDes8& aOutput) = 0;
    71 
    72 	/**	
    73 	 * Gets a tight upper bound on the number of bytes that would be returned by a
    74 	 * call to Process() with aInputLength bytes of data.
    75 	 *
    76 	 * @param aInputLength	The length of data to be supplied to Process() in bytes.
    77 	 * @return				The length of data which would result from a call to 
    78 	 *						Process() with an aInputLength number of bytes.
    79 	 */
    80 	virtual TInt MaxOutputLength(TInt aInputLength) const = 0;
    81 
    82 	/**	
    83 	 * Gets as tight an upper bound as possible on the number of bytes that would
    84 	 * be returned by a call to ProcessFinalL() with aInputLength bytes of data.
    85 	 *
    86 	 * @param aInputLength	The length of data to be supplied to Process() in bytes.
    87 	 * @return				An upper bound on the length of data which would result from 
    88 	 *						a call to ProcessFinalL() with an aInputLength number of bytes.
    89 	 */
    90 	virtual TInt MaxFinalOutputLength(TInt aInputLength) const = 0;
    91 
    92 	/**
    93 	 * Resets the cipher back to its original state. Clears all its buffers.
    94 	 */
    95 	virtual void Reset() = 0;
    96 
    97 	/**
    98 	 * Gets the block size in bits (8 for stream ciphers).
    99 	 *
   100 	 * @return	Block size of underlying cipher in bits.
   101 	 */
   102 	virtual TInt BlockSize() const = 0;
   103 
   104 	/**
   105 	 * Gets the key size in bits.
   106 	 *	
   107 	 * @return	Key size in bits.
   108 	 */
   109 	virtual TInt KeySize() const = 0;
   110 };
   111 
   112 
   113 #endif	//	__CSYMMETRICCIPHER_H__