crypto/weakcryptospi/inc/spi/asymmetriccipherplugin.h
changeset 8 35751d3474b7
child 30 cf642210ecb7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2006-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 * Asymmetric cipher abstract interface
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @publishedPartner
       
    23  @released
       
    24 */
       
    25 
       
    26 #ifndef __CRYPTOAPI_ASYMMETRICCIPHER_H__
       
    27 #define __CRYPTOAPI_ASYMMETRICCIPHER_H__
       
    28 
       
    29 #include <cryptospi/cryptoplugin.h>
       
    30 
       
    31 namespace CryptoSpi
       
    32 	{
       
    33 	/**
       
    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
       
    37 	*/
       
    38 	class MAsymmetricCipherBase : public MPlugin
       
    39 		{
       
    40 	public:
       
    41 		
       
    42 		/**
       
    43 		Set the public key of this cipher. Reset() is called to reinitialise the cipher.
       
    44 		@param aKey	The public key.
       
    45 		*/
       
    46 		virtual void SetKeyL(const CKey& aKey) = 0;
       
    47 
       
    48 		/**
       
    49 		Set the crypto mode of this cipher. Reset() is called to reinitialise the cipher.
       
    50 		@param aCryptoMode	The crypto mode
       
    51 		*/
       
    52 		virtual void SetCryptoModeL(TUid aCryptoMode) = 0;
       
    53 
       
    54 		/**
       
    55 		Set padding Mode of this cipher. Reset() is called to reinitialise the cipher.
       
    56 		@param aPaddingMode	The padding mode
       
    57 		*/
       
    58 		virtual void SetPaddingModeL(TUid aPaddingMode) = 0;
       
    59 
       
    60 		/**
       
    61 		Gets the maximum size of input accepted by this object.	
       
    62 		@return The maximum input length allowed in bytes.
       
    63 		*/	 
       
    64 		virtual TInt GetMaximumInputLengthL() const = 0;
       
    65 
       
    66 		/**
       
    67 		Gets the maximum size of output that can be generated by this object.
       
    68 		@return The maximum output length in bytes.
       
    69 		 */	 
       
    70 		virtual TInt GetMaximumOutputLengthL() const = 0;
       
    71 		};
       
    72 
       
    73 	class MAsymmetricCipher : public MAsymmetricCipherBase
       
    74 		{
       
    75 	public:
       
    76 		/**
       
    77 		Encrypts or decrypts aInput and appends the result to aOutput.
       
    78 		@param aInput	The input data to be processed.
       
    79 		@param aOutput	The resulting processed data appended to aOutput.
       
    80 		*/
       
    81 		virtual void ProcessL(const TDesC8& aInput, TDes8& aOutput) = 0;
       
    82 		};
       
    83 
       
    84 	class MAsyncAsymmetricCipher : public MAsymmetricCipherBase
       
    85 		{
       
    86 	public:
       
    87 
       
    88 		/**
       
    89 		Encrypts or decrypts aInput and appends the result to aOutput asynchronously
       
    90 		@param aInput	The input data to be processed.
       
    91 		@param aOutput	The resulting processed data appended to aOutput.
       
    92 		@param aRequestStatus
       
    93 		*/
       
    94 		virtual void ProcessL(const TDesC8& aInput, TDes8& aOutput, TRequestStatus& aRequestStatus) = 0;
       
    95 
       
    96 		/**
       
    97 		Cancel the outstanding request
       
    98 		*/
       
    99 		virtual void Cancel() = 0;
       
   100 		};
       
   101 	}
       
   102 
       
   103 #endif //__CRYPTOAPI_ASYMMETRICCIPHER_H__