os/security/crypto/weakcryptospi/inc/spi/signerplugin.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-2010 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
* Signer 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_SIGNER_H__
sl@0
    27
#define __CRYPTOAPI_SIGNER_H__
sl@0
    28
sl@0
    29
#include <cryptospi/cryptoplugin.h>
sl@0
    30
#include <cryptospi/keys.h>
sl@0
    31
sl@0
    32
namespace CryptoSpi
sl@0
    33
	{
sl@0
    34
	/**
sl@0
    35
	The Signer definition. Intended to allow plug-ins to implement 
sl@0
    36
	extensible signature signer functionality, and to work with all
sl@0
    37
	known existing  signature algorithms, e.g. DSA, RSA etc
sl@0
    38
	*/
sl@0
    39
	class MSignatureBase : public MPlugin
sl@0
    40
		{
sl@0
    41
	public:
sl@0
    42
		/**
sl@0
    43
		Set the padding mode for the signer or verifier. Reset() is called to reinitialise the cipher.
sl@0
    44
		@param aPaddingMode The padding mode of the signer
sl@0
    45
		@leave KErrNotSupported if the padding mode is not supported.
sl@0
    46
		@leave ...	Any of the crypto error codes defined in 
sl@0
    47
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    48
		*/
sl@0
    49
		virtual void SetPaddingModeL(TUid aPaddingMode) = 0;
sl@0
    50
sl@0
    51
		/**
sl@0
    52
		Set the private key for the signer or verifier. Reset() is called to reinitialise the cipher.
sl@0
    53
		@param aPrivateKey The privatekey that used to sign
sl@0
    54
		@leave KErrArgument if key is not of the expected type.
sl@0
    55
		@leave KErrNotSupported if the key is not of valid length.
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 SetKeyL(const CKey& aPrivateKey) = 0;
sl@0
    60
sl@0
    61
		/**
sl@0
    62
		Gets the maximum size of input accepted by this object.
sl@0
    63
		@return The maximum length allowed in bytes
sl@0
    64
		@leave ...	Any of the crypto error codes defined in 
sl@0
    65
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    66
		*/	 
sl@0
    67
		virtual TInt GetMaximumInputLengthL() const = 0;
sl@0
    68
sl@0
    69
		/**
sl@0
    70
		Gets the maximum size of output that can be generated by this object.
sl@0
    71
		@return The maximum output length in bytes
sl@0
    72
		@leave ...	Any of the crypto error codes defined in 
sl@0
    73
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    74
		*/	 
sl@0
    75
		virtual TInt GetMaximumOutputLengthL() const = 0;
sl@0
    76
		};
sl@0
    77
sl@0
    78
	class MSigner : public MSignatureBase
sl@0
    79
		{
sl@0
    80
	public:
sl@0
    81
sl@0
    82
		/**
sl@0
    83
		Signs the input hash
sl@0
    84
		@param aInput	The hash of the message to sign
sl@0
    85
		@param aSignature The signature of the hash 
sl@0
    86
		@leave ...	Any of the crypto error codes defined in 
sl@0
    87
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
    88
		*/
sl@0
    89
		virtual void SignL(const TDesC8& aInput, CCryptoParams& aSignature) = 0;
sl@0
    90
		};
sl@0
    91
sl@0
    92
sl@0
    93
	class MAsyncSigner : public MSignatureBase
sl@0
    94
		{
sl@0
    95
	public:
sl@0
    96
sl@0
    97
		/**
sl@0
    98
		Set the public key for the signer
sl@0
    99
		@param aInput	The hash of the message to sign
sl@0
   100
		@param aSignature The signature of the hash 
sl@0
   101
		@param aRequestStatus
sl@0
   102
		@leave ...	Any of the crypto error codes defined in 
sl@0
   103
  					cryptospi_errs.h or any of the system-wide error codes.
sl@0
   104
		*/
sl@0
   105
		virtual void SignL(const TDesC8& aInput, CCryptoParams& aSignature, TRequestStatus& aRequestStatus) = 0;
sl@0
   106
sl@0
   107
		/**
sl@0
   108
		Cancel the outstanding request
sl@0
   109
		*/
sl@0
   110
		virtual void Cancel() = 0;
sl@0
   111
sl@0
   112
		};
sl@0
   113
sl@0
   114
	} // namespace CryptoSpi
sl@0
   115
sl@0
   116
#endif //__CRYPTOAPI_SIGNER_H__