Update contrib.
2 * Copyright (c) 2006-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.
15 * Asymmetric cipher abstract interface
26 #ifndef __CRYPTOAPI_ASYMMETRICCIPHER_H__
27 #define __CRYPTOAPI_ASYMMETRICCIPHER_H__
29 #include <cryptospi/cryptoplugin.h>
34 The Asymmetric Cipher Base definition. Intended to allow plug-ins
35 to implement extensible Asymmetric cipher functionality, and to work with all
36 known existing Asymmetric algorithms, e.g. RSA DSA etc
38 class MAsymmetricCipherBase : public MPlugin
43 Set the public key of this cipher. Reset() is called to reinitialise the cipher.
44 @param aKey The public key.
45 @leave KErrArgument if aKey is not of the expected type.
46 @leave KErrNotSupported if the key is not of valid length.
47 @leave ... Any of the crypto error codes defined in
48 cryptospi_errs.h or any of the system-wide error codes.
50 virtual void SetKeyL(const CKey& aKey) = 0;
53 Set the crypto mode of this cipher. Reset() is called to reinitialise the cipher.
54 @param aCryptoMode The crypto mode
55 @leave KErrNotSupported if the specified mode is not supported.
56 @leave ... Any of the crypto error codes defined in
57 cryptospi_errs.h or any of the system-wide error codes.
59 virtual void SetCryptoModeL(TUid aCryptoMode) = 0;
62 Set padding Mode of this cipher. Reset() is called to reinitialise the cipher.
63 @param aPaddingMode The padding mode
64 @leave KErrNotSupported if the specified mode is not supported.
65 @leave ... Any of the crypto error codes defined in
66 cryptospi_errs.h or any of the system-wide error codes.
68 virtual void SetPaddingModeL(TUid aPaddingMode) = 0;
71 Gets the maximum size of input accepted by this object.
72 @return The maximum input length allowed in bytes.
73 @leave ... Any of the crypto error codes defined in
74 cryptospi_errs.h or any of the system-wide error codes.
76 virtual TInt GetMaximumInputLengthL() const = 0;
79 Gets the maximum size of output that can be generated by this object.
80 @return The maximum output length in bytes.
81 @leave ... Any of the crypto error codes defined in
82 cryptospi_errs.h or any of the system-wide error codes.
84 virtual TInt GetMaximumOutputLengthL() const = 0;
87 class MAsymmetricCipher : public MAsymmetricCipherBase
91 Encrypts or decrypts aInput and appends the result to aOutput.
92 @param aInput The input data to be processed.
93 @param aOutput The resulting processed data appended to aOutput.
94 @leave ... Any of the crypto error codes defined in
95 cryptospi_errs.h or any of the system-wide error codes.
97 virtual void ProcessL(const TDesC8& aInput, TDes8& aOutput) = 0;
100 class MAsyncAsymmetricCipher : public MAsymmetricCipherBase
105 Encrypts or decrypts aInput and appends the result to aOutput asynchronously
106 @param aInput The input data to be processed.
107 @param aOutput The resulting processed data appended to aOutput.
108 @param aRequestStatus
109 @leave ... Any of the crypto error codes defined in
110 cryptospi_errs.h or any of the system-wide error codes.
112 virtual void ProcessL(const TDesC8& aInput, TDes8& aOutput, TRequestStatus& aRequestStatus) = 0;
115 Cancel the outstanding request
117 virtual void Cancel() = 0;
121 #endif //__CRYPTOAPI_ASYMMETRICCIPHER_H__