os/security/cryptoplugins/cryptospiplugins/test/dummyecchwplugin/src/dummyeccsignerimpl.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) 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 /**
    20  @file
    21  @internalComponent
    22  @released
    23 */
    24 #ifndef	CDUMMYECCSIGNERIMPL_H
    25 #define	CDUMMYECCSIGNERIMPL_H
    26 #include <e32base.h>
    27 #include <e32cmn.h>
    28 #include "keys.h"
    29 #include "signerplugin.h"
    30 
    31 namespace DummyEccHwCrypto
    32 	{
    33 	using namespace CryptoSpi;
    34 
    35     /**
    36      * Implements the MSigner interface.
    37      * 
    38      * This should be used to create the signer object to perform 
    39      * signing using ECC.
    40      */
    41 	NONSHARABLE_CLASS(CDummyECCSignerImpl) : public CBase, public MSigner
    42 		{
    43 	public:
    44 		static CDummyECCSignerImpl* NewL(const CryptoSpi::CKey& aKey, 
    45 			TUid aPaddingMode);
    46 		static CDummyECCSignerImpl* NewLC(const CryptoSpi::CKey& aKey, 
    47 			TUid aPaddingMode);
    48 
    49 		// MPlugin Interface
    50 		void Close();
    51         void Reset();
    52         void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
    53         const CExtendedCharacteristics* GetExtendedCharacteristicsL();
    54         TAny* GetExtension(TUid aExtensionId);
    55         // End of MPlugin Interface    
    56         
    57         // MSignatureBase inteface
    58 		void SetPaddingModeL(TUid aPaddingMode);
    59 		void SetKeyL(const CKey& aPrivateKey);
    60 		TInt GetMaximumInputLengthL() const;
    61 		TInt GetMaximumOutputLengthL() const;
    62 		// End of MSignatureBase inteface
    63 		
    64 		// MSigner interface
    65 		void SignL(const TDesC8& aInput, CCryptoParams& aSignature);
    66 
    67 		TUid ImplementationUid() const;
    68 		/// Destructor
    69 		~CDummyECCSignerImpl();
    70 
    71 	private:
    72 		CDummyECCSignerImpl(TUid aPaddingMode);
    73 		void ConstructL(const CryptoSpi::CKey& aKey);
    74 
    75 	private:
    76 	    /* The key extracted from a CKey object. This would just have 
    77          * a handle to the key stored in hardware. Hence the actual key 
    78          * would not be available to the user of this cryptoSPI plugin.
    79          */
    80         CKey* iKey;
    81 	    TUid iPaddingMode;
    82 		};
    83 	}
    84 
    85 #endif //CDUMMYECCSIGNERIMPL_H