| 19 |      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 __RSAVERIFYIMPL_H__
 | 
|  |     20 | #define __RSAVERIFYIMPL_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 | 
 | 
|  |     32 | #include "verifierimpl.h"
 | 
|  |     33 | #include "common/inlines.h"
 | 
|  |     34 | 
 | 
|  |     35 | /**
 | 
|  |     36 |  * Implementation of RSA verification
 | 
|  |     37 |  */
 | 
|  |     38 | namespace SoftwareCrypto
 | 
|  |     39 | 	{
 | 
|  |     40 | 	using namespace CryptoSpi;
 | 
|  |     41 | 	
 | 
|  |     42 | 	NONSHARABLE_CLASS(CRSAVerifierImpl) : public CVerifierImpl
 | 
|  |     43 | 		{
 | 
|  |     44 | 	public:
 | 
|  |     45 | 		/**
 | 
|  |     46 | 		Creates an instance of an RSA verifier plug-in.
 | 
|  |     47 | 		@param aKey The key
 | 
|  |     48 | 		@param aPaddingMode The padding mode
 | 
|  |     49 | 		@return A pointer to a CRSAVerifierImpl instance
 | 
|  |     50 | 		*/
 | 
|  |     51 | 		static CRSAVerifierImpl* NewL(const CKey& aKey, TUid aPaddingMode);
 | 
|  |     52 | 
 | 
|  |     53 | 		/**
 | 
|  |     54 | 		Creates an instance of an RSA verifier plug-in.
 | 
|  |     55 | 		@param aKey The key
 | 
|  |     56 | 		@param aPaddingMode The padding mode
 | 
|  |     57 | 		@return A pointer to a CRSAVerifierImpl instance
 | 
|  |     58 | 		*/
 | 
|  |     59 | 		static CRSAVerifierImpl* NewLC(const CKey& aKey, TUid aPaddingMode);
 | 
|  |     60 | 		
 | 
|  |     61 | 		// Override CVerifierImpl virtual functions
 | 
|  |     62 | 		TUid ImplementationUid() const;
 | 
|  |     63 | 		// End of CVerifierImpl
 | 
|  |     64 | 		
 | 
|  |     65 | 		// Override MSignatureBase virtual functions
 | 
|  |     66 | 		void SetPaddingModeL(TUid aPaddingMode);
 | 
|  |     67 | 		void SetKeyL(const CKey& aPublicKey);
 | 
|  |     68 | 		TInt GetMaximumInputLengthL() const;
 | 
|  |     69 | 		TInt GetMaximumOutputLengthL() const;
 | 
|  |     70 | 		// End of MSignatureBase
 | 
|  |     71 | 
 | 
|  |     72 | 		// Override MSigner virtual functions
 | 
|  |     73 | 		void VerifyL(const TDesC8& aInput, const CCryptoParams& aSignature, TBool& aVerificationResult);
 | 
|  |     74 | 		void InverseSignL(HBufC8*& aOutput, const CCryptoParams& aSignature);
 | 
|  |     75 | 		// End of MSigner
 | 
|  |     76 | 		
 | 
|  |     77 | 		const CExtendedCharacteristics* GetExtendedCharacteristicsL();
 | 
|  |     78 | 		static CExtendedCharacteristics* CreateExtendedCharacteristicsL();
 | 
|  |     79 | 		
 | 
|  |     80 | 		/// Destructor
 | 
|  |     81 | 		~CRSAVerifierImpl();
 | 
|  |     82 | 		
 | 
|  |     83 | 	protected:
 | 
|  |     84 | 		/// Constructor
 | 
|  |     85 | 		CRSAVerifierImpl(TUid aPaddingMode);
 | 
|  |     86 | 		
 | 
|  |     87 | 		/// second phase of construction
 | 
|  |     88 | 		virtual void ConstructL(const CKey& aKey);
 | 
|  |     89 | 		
 | 
|  |     90 | 	protected:
 | 
|  |     91 | 		/// the current padding scheme
 | 
|  |     92 | 		TUid iPaddingMode;
 | 
|  |     93 | 		CPadding* iPadding;
 | 
|  |     94 | 		};
 | 
|  |     95 | 	}
 | 
|  |     96 | 
 | 
|  |     97 | #endif // __RSAVERIFYIMPL_H__
 |