os/security/crypto/weakcryptospi/inc/spi/asymmetriccipherplugin.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* Asymmetric cipher abstract interface
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
 @file
sl@0
    22
 @publishedPartner
sl@0
    23
 @released
sl@0
    24
*/
sl@0
    25
sl@0
    26
#ifndef __CRYPTOAPI_ASYMMETRICCIPHER_H__
sl@0
    27
#define __CRYPTOAPI_ASYMMETRICCIPHER_H__
sl@0
    28
sl@0
    29
#include <cryptospi/cryptoplugin.h>
sl@0
    30
sl@0
    31
namespace CryptoSpi
sl@0
    32
	{
sl@0
    33
	/**
sl@0
    34
	The Asymmetric Cipher Base definition. Intended to allow plug-ins
sl@0
    35
	to implement extensible Asymmetric cipher functionality, and to work with all
sl@0
    36
	known existing Asymmetric algorithms, e.g. RSA DSA etc
sl@0
    37
	*/
sl@0
    38
	class MAsymmetricCipherBase : public MPlugin
sl@0
    39
		{
sl@0
    40
	public:
sl@0
    41
		
sl@0
    42
		/**
sl@0
    43
		Set the public key of this cipher. Reset() is called to reinitialise the cipher.
sl@0
    44
		@param aKey	The public key.
sl@0
    45
		@leave KErrArgument if aKey is not of the expected type.
sl@0
    46
		@leave KErrNotSupported if the key is not of valid length.
sl@0
    47
		@leave ...	Any of the crypto error codes defined in 
sl@0
    48
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    49
		*/
sl@0
    50
		virtual void SetKeyL(const CKey& aKey) = 0;
sl@0
    51
sl@0
    52
		/**
sl@0
    53
		Set the crypto mode of this cipher. Reset() is called to reinitialise the cipher.
sl@0
    54
		@param aCryptoMode	The crypto mode
sl@0
    55
		@leave KErrNotSupported if the specified mode is not supported.
sl@0
    56
		@leave ...	Any of the crypto error codes defined in 
sl@0
    57
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    58
		*/
sl@0
    59
		virtual void SetCryptoModeL(TUid aCryptoMode) = 0;
sl@0
    60
sl@0
    61
		/**
sl@0
    62
		Set padding Mode of this cipher. Reset() is called to reinitialise the cipher.
sl@0
    63
		@param aPaddingMode	The padding mode
sl@0
    64
		@leave	KErrNotSupported if the specified mode is not supported.
sl@0
    65
		@leave ...	Any of the crypto error codes defined in 
sl@0
    66
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    67
		*/
sl@0
    68
		virtual void SetPaddingModeL(TUid aPaddingMode) = 0;
sl@0
    69
sl@0
    70
		/**
sl@0
    71
		Gets the maximum size of input accepted by this object.	
sl@0
    72
		@return The maximum input length allowed in bytes.
sl@0
    73
		@leave ...	Any of the crypto error codes defined in 
sl@0
    74
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    75
		*/	 
sl@0
    76
		virtual TInt GetMaximumInputLengthL() const = 0;
sl@0
    77
sl@0
    78
		/**
sl@0
    79
		Gets the maximum size of output that can be generated by this object.
sl@0
    80
		@return The maximum output length in bytes.
sl@0
    81
		@leave ...	Any of the crypto error codes defined in 
sl@0
    82
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    83
		 */	 
sl@0
    84
		virtual TInt GetMaximumOutputLengthL() const = 0;
sl@0
    85
		};
sl@0
    86
sl@0
    87
	class MAsymmetricCipher : public MAsymmetricCipherBase
sl@0
    88
		{
sl@0
    89
	public:
sl@0
    90
		/**
sl@0
    91
		Encrypts or decrypts aInput and appends the result to aOutput.
sl@0
    92
		@param aInput	The input data to be processed.
sl@0
    93
		@param aOutput	The resulting processed data appended to aOutput.
sl@0
    94
		@leave ...	Any of the crypto error codes defined in 
sl@0
    95
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    96
		*/
sl@0
    97
		virtual void ProcessL(const TDesC8& aInput, TDes8& aOutput) = 0;
sl@0
    98
		};
sl@0
    99
sl@0
   100
	class MAsyncAsymmetricCipher : public MAsymmetricCipherBase
sl@0
   101
		{
sl@0
   102
	public:
sl@0
   103
sl@0
   104
		/**
sl@0
   105
		Encrypts or decrypts aInput and appends the result to aOutput asynchronously
sl@0
   106
		@param aInput	The input data to be processed.
sl@0
   107
		@param aOutput	The resulting processed data appended to aOutput.
sl@0
   108
		@param aRequestStatus
sl@0
   109
		@leave ...	Any of the crypto error codes defined in 
sl@0
   110
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
   111
		*/
sl@0
   112
		virtual void ProcessL(const TDesC8& aInput, TDes8& aOutput, TRequestStatus& aRequestStatus) = 0;
sl@0
   113
sl@0
   114
		/**
sl@0
   115
		Cancel the outstanding request
sl@0
   116
		*/
sl@0
   117
		virtual void Cancel() = 0;
sl@0
   118
		};
sl@0
   119
	}
sl@0
   120
sl@0
   121
#endif //__CRYPTOAPI_ASYMMETRICCIPHER_H__