Update contrib.
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
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
29 #ifndef __CSYMMETRICCIPHER_H__
30 #define __CSYMMETRICCIPHER_H__
35 * Top-level interface designed to collate the behaviour of all symmetric
36 * ciphers under one interface.
38 * See the Cryptography api-guide documentation.
43 class CSymmetricCipher : public CBase
47 * Runs the underlying transformation on aInput and appends the result to
50 * For incremental buffering rules see the Cryptography api-guide documentation.
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.
56 virtual void Process(const TDesC8& aInput, TDes8& aOutput) = 0;
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
63 * For incremental buffering rules see the Cryptography api-guide documentation.
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.
70 virtual void ProcessFinalL(const TDesC8& aInput, TDes8& aOutput) = 0;
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.
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.
80 virtual TInt MaxOutputLength(TInt aInputLength) const = 0;
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.
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.
90 virtual TInt MaxFinalOutputLength(TInt aInputLength) const = 0;
93 * Resets the cipher back to its original state. Clears all its buffers.
95 virtual void Reset() = 0;
98 * Gets the block size in bits (8 for stream ciphers).
100 * @return Block size of underlying cipher in bits.
102 virtual TInt BlockSize() const = 0;
105 * Gets the key size in bits.
107 * @return Key size in bits.
109 virtual TInt KeySize() const = 0;
113 #endif // __CSYMMETRICCIPHER_H__