os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/verifierimpl.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2007-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 __VERIFIERIMPL_H__
    20 #define __VERIFIERIMPL_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 <padding.h>
    32 #include "verifierplugin.h"
    33 
    34 #include "common/inlines.h"
    35 
    36 /**
    37  * Abstract base class for verifier plug-ins.
    38  */
    39 namespace SoftwareCrypto
    40 	{
    41 	using namespace CryptoSpi;
    42 	
    43 	NONSHARABLE_CLASS(CVerifierImpl) : public CBase, public MVerifier
    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 		// Override MVerifier virtual functions
    61 		virtual void VerifyL(const TDesC8& aInput, const CCryptoParams& aSignature, TBool& aVerificationResult) = 0;
    62 		virtual void InverseSignL(HBufC8*& aOutput, const CCryptoParams& aSignature) = 0;
    63 		// End of MVerifier
    64 		
    65 		/// Destructor
    66 		~CVerifierImpl();
    67 		
    68 	protected:
    69 		/// Constructor
    70 		CVerifierImpl();
    71 		
    72 		virtual void ConstructL(const CKey& aKey);
    73 			
    74 		/**
    75 		Helper function implemented by concrete cipher sub-class that allows
    76 		GetCharacteristicsL to return the correct characteristics object.
    77 		@return The implemention uid
    78 		*/
    79 		virtual TUid ImplementationUid() const = 0;
    80 		
    81 		/**
    82 		Store the key to use for verifying.
    83 		The key length is also checked to meet export restrictions and
    84 		to ensure that it is appropriate for the cipher.
    85 		@param aKey The key
    86 		*/
    87 		virtual void DoSetKeyL(const CKey& aKey);
    88 		
    89 	protected:
    90 		/// the key
    91 		CKey* iKey;
    92 		};
    93 	}
    94 
    95 #endif // __VERIFIERIMPL_H__