cryptoplugins/cryptospiplugins/source/softwarecrypto/signerimpl.h
changeset 19 cd501b96611d
equal deleted inserted replaced
15:da2ae96f639b 19:cd501b96611d
       
     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 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __SIGNERIMPL_H__
       
    20 #define __SIGNERIMPL_H__
       
    21 
       
    22 /**
       
    23 @file 
       
    24 @internalComponent
       
    25 @released
       
    26 */
       
    27 
       
    28 #include <e32base.h>
       
    29 #include <e32cmn.h>
       
    30 #include <cryptospi/cryptospidef.h>
       
    31 #include "signerplugin.h"
       
    32 #include <padding.h>
       
    33 
       
    34 #include "common/inlines.h"
       
    35 
       
    36 /**
       
    37  * Abstract base class for signer plug-ins.
       
    38  */
       
    39 namespace SoftwareCrypto
       
    40 	{
       
    41 	using namespace CryptoSpi;
       
    42 	
       
    43 	NONSHARABLE_CLASS(CSignerImpl) : public CBase, public MSigner
       
    44 		{
       
    45 	public:
       
    46 		// Override MPlugin virtual functions
       
    47 		void Close();
       
    48 		void Reset(); // Always call reset in super-class if you override this
       
    49 		TAny* GetExtension(TUid aExtensionId);
       
    50 		void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
       
    51 		// End of MPlugin
       
    52 
       
    53 		// Override MSignatureBase virtual functions
       
    54 		virtual void SetPaddingModeL(TUid aPaddingMode);
       
    55 		virtual void SetKeyL(const CKey& aPrivateKey);
       
    56 		virtual TInt GetMaximumInputLengthL() const;
       
    57 		virtual TInt GetMaximumOutputLengthL() const;
       
    58 		// End of MSignatureBase
       
    59 
       
    60 		/// Destructor
       
    61 		~CSignerImpl();
       
    62 		
       
    63 	protected:
       
    64 		/// Constructor
       
    65 		CSignerImpl();
       
    66 
       
    67 		/**
       
    68 		Second phase of construction
       
    69 		@param aKey The signing key
       
    70 		*/
       
    71 		virtual void ConstructL(const CKey& aKey);
       
    72 		
       
    73 		/**
       
    74 		Helper function implemented by concrete cipher sub-class that allows
       
    75 		GetCharacteristicsL to return the correct characteristics object.
       
    76 		@return The implemention uid
       
    77 		*/
       
    78 		virtual TUid ImplementationUid() const = 0;
       
    79 		
       
    80 		/**
       
    81 		Store the signing key. The key length is also checked to meet export restrictions and
       
    82 		to ensure that it is appropriate for the cipher.
       
    83 		@param aKey The key
       
    84 		*/
       
    85 		virtual void DoSetKeyL(const CKey& aKey);
       
    86 
       
    87 	protected:
       
    88 		/// the key, extracted from a CKey object
       
    89 		CKey* iKey;
       
    90 
       
    91 	private:
       
    92 		};
       
    93 	}
       
    94 
       
    95 #endif // __SIGNERIMPL_H__