crypto/weakcryptospi/inc/spi/signerplugin.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 24 Nov 2009 09:06:03 +0200
changeset 29 ece3df019add
parent 8 35751d3474b7
child 33 cf642210ecb7
permissions -rw-r--r--
Revision: 200948 Kit: 200948

/*
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
* Signer Abstract interface
*
*/


/**
 @file
 @publishedPartner
 @released
*/

#ifndef __CRYPTOAPI_SIGNER_H__
#define __CRYPTOAPI_SIGNER_H__

#include <cryptospi/cryptoplugin.h>
#include "keys.h"

namespace CryptoSpi
	{
	/**
	The Signer definition. Intended to allow plug-ins to implement 
	extensible signature signer functionality, and to work with all
	known existing  signature algorithms, e.g. DSA, RSA etc
	*/
	class MSignatureBase : public MPlugin
		{
	public:
		/**
		Set the padding mode for the signer or verifier. Reset() is called to reinitialise the cipher.
		@param aPaddingMode The padding mode of the signer
		*/
		virtual void SetPaddingModeL(TUid aPaddingMode) = 0;

		/**
		Set the private key for the signer or verifier. Reset() is called to reinitialise the cipher.
		@param aPrivateKey The privatekey that used to sign
		*/
		virtual void SetKeyL(const CKey& aPrivateKey) = 0;

		/**
		Gets the maximum size of input accepted by this object.
		@return The maximum length allowed in bytes
		*/	 
		virtual TInt GetMaximumInputLengthL() const = 0;

		/**
		Gets the maximum size of output that can be generated by this object.
		@return The maximum output length in bytes
		*/	 
		virtual TInt GetMaximumOutputLengthL() const = 0;
		};

	class MSigner : public MSignatureBase
		{
	public:

		/**
		Signs the input hash
		@param aInput	The hash of the message to sign
		@param aSignature The signature of the hash 
		*/
		virtual void SignL(const TDesC8& aInput, CCryptoParams& aSignature) = 0;
		};


	class MAsyncSigner : public MSignatureBase
		{
	public:

		/**
		Set the public key for the signer
		@param aInput	The hash of the message to sign
		@param aSignature The signature of the hash 
		@param aRequestStatus
		*/
		virtual void SignL(const TDesC8& aInput, CCryptoParams& aSignature, TRequestStatus& aRequestStatus) = 0;

		/**
		Cancel the outstanding request
		*/
		virtual void Cancel() = 0;

		};

	} // namespace CryptoSpi

#endif //__CRYPTOAPI_SIGNER_H__