1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/crypto/weakcryptospi/inc/spi/asymmetriccipherplugin.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,121 @@
1.4 +/*
1.5 +* Copyright (c) 2006-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 +* Asymmetric cipher abstract interface
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +/**
1.24 + @file
1.25 + @publishedPartner
1.26 + @released
1.27 +*/
1.28 +
1.29 +#ifndef __CRYPTOAPI_ASYMMETRICCIPHER_H__
1.30 +#define __CRYPTOAPI_ASYMMETRICCIPHER_H__
1.31 +
1.32 +#include <cryptospi/cryptoplugin.h>
1.33 +
1.34 +namespace CryptoSpi
1.35 + {
1.36 + /**
1.37 + The Asymmetric Cipher Base definition. Intended to allow plug-ins
1.38 + to implement extensible Asymmetric cipher functionality, and to work with all
1.39 + known existing Asymmetric algorithms, e.g. RSA DSA etc
1.40 + */
1.41 + class MAsymmetricCipherBase : public MPlugin
1.42 + {
1.43 + public:
1.44 +
1.45 + /**
1.46 + Set the public key of this cipher. Reset() is called to reinitialise the cipher.
1.47 + @param aKey The public key.
1.48 + @leave KErrArgument if aKey is not of the expected type.
1.49 + @leave KErrNotSupported if the key is not of valid length.
1.50 + @leave ... Any of the crypto error codes defined in
1.51 + cryptospi_errs.h or any of the system-wide error codes.
1.52 + */
1.53 + virtual void SetKeyL(const CKey& aKey) = 0;
1.54 +
1.55 + /**
1.56 + Set the crypto mode of this cipher. Reset() is called to reinitialise the cipher.
1.57 + @param aCryptoMode The crypto mode
1.58 + @leave KErrNotSupported if the specified mode is not supported.
1.59 + @leave ... Any of the crypto error codes defined in
1.60 + cryptospi_errs.h or any of the system-wide error codes.
1.61 + */
1.62 + virtual void SetCryptoModeL(TUid aCryptoMode) = 0;
1.63 +
1.64 + /**
1.65 + Set padding Mode of this cipher. Reset() is called to reinitialise the cipher.
1.66 + @param aPaddingMode The padding mode
1.67 + @leave KErrNotSupported if the specified mode is not supported.
1.68 + @leave ... Any of the crypto error codes defined in
1.69 + cryptospi_errs.h or any of the system-wide error codes.
1.70 + */
1.71 + virtual void SetPaddingModeL(TUid aPaddingMode) = 0;
1.72 +
1.73 + /**
1.74 + Gets the maximum size of input accepted by this object.
1.75 + @return The maximum input length allowed in bytes.
1.76 + @leave ... Any of the crypto error codes defined in
1.77 + cryptospi_errs.h or any of the system-wide error codes.
1.78 + */
1.79 + virtual TInt GetMaximumInputLengthL() const = 0;
1.80 +
1.81 + /**
1.82 + Gets the maximum size of output that can be generated by this object.
1.83 + @return The maximum output length in bytes.
1.84 + @leave ... Any of the crypto error codes defined in
1.85 + cryptospi_errs.h or any of the system-wide error codes.
1.86 + */
1.87 + virtual TInt GetMaximumOutputLengthL() const = 0;
1.88 + };
1.89 +
1.90 + class MAsymmetricCipher : public MAsymmetricCipherBase
1.91 + {
1.92 + public:
1.93 + /**
1.94 + Encrypts or decrypts aInput and appends the result to aOutput.
1.95 + @param aInput The input data to be processed.
1.96 + @param aOutput The resulting processed data appended to aOutput.
1.97 + @leave ... Any of the crypto error codes defined in
1.98 + cryptospi_errs.h or any of the system-wide error codes.
1.99 + */
1.100 + virtual void ProcessL(const TDesC8& aInput, TDes8& aOutput) = 0;
1.101 + };
1.102 +
1.103 + class MAsyncAsymmetricCipher : public MAsymmetricCipherBase
1.104 + {
1.105 + public:
1.106 +
1.107 + /**
1.108 + Encrypts or decrypts aInput and appends the result to aOutput asynchronously
1.109 + @param aInput The input data to be processed.
1.110 + @param aOutput The resulting processed data appended to aOutput.
1.111 + @param aRequestStatus
1.112 + @leave ... Any of the crypto error codes defined in
1.113 + cryptospi_errs.h or any of the system-wide error codes.
1.114 + */
1.115 + virtual void ProcessL(const TDesC8& aInput, TDes8& aOutput, TRequestStatus& aRequestStatus) = 0;
1.116 +
1.117 + /**
1.118 + Cancel the outstanding request
1.119 + */
1.120 + virtual void Cancel() = 0;
1.121 + };
1.122 + }
1.123 +
1.124 +#endif //__CRYPTOAPI_ASYMMETRICCIPHER_H__