crypto/weakcryptospi/inc/spi/signerplugin.h
changeset 8 35751d3474b7
child 33 cf642210ecb7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/weakcryptospi/inc/spi/signerplugin.h	Thu Sep 10 14:01:51 2009 +0300
@@ -0,0 +1,101 @@
+/*
+* 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__