os/security/cryptoplugins/cryptospiplugins/test/dummyecchwplugin/src/dummyeccimpl.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoplugins/cryptospiplugins/test/dummyecchwplugin/src/dummyeccimpl.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,97 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @internalComponent
1.25 + @released
1.26 +*/
1.27 +#ifndef CDUMMYECCIMPL_H
1.28 +#define CDUMMYECCIMPL_H
1.29 +
1.30 +#include <e32base.h>
1.31 +#include <e32cmn.h>
1.32 +#include <cryptospi/cryptospidef.h>
1.33 +#include "keys.h"
1.34 +#include "asymmetriccipherplugin.h"
1.35 +
1.36 +namespace DummyEccHwCrypto
1.37 + {
1.38 + using namespace CryptoSpi;
1.39 +
1.40 + /**
1.41 + * Implements the MAsymmetricCipher interface.
1.42 + *
1.43 + * This should be used to create the cipher object to perform
1.44 + * encryption / decryption using ECC.
1.45 + */
1.46 + NONSHARABLE_CLASS(CDummyECCCipherImpl) : public CBase, public MAsymmetricCipher
1.47 + {
1.48 + public:
1.49 + static CDummyECCCipherImpl* NewL(const CKey& aKey, TUid aCryptoMode, TUid aPaddingMode);
1.50 + static CDummyECCCipherImpl* NewLC(const CKey& aKey, TUid aCryptoMode, TUid aPaddingMode);
1.51 +
1.52 + // MPlugin Interface
1.53 + void Close();
1.54 + void Reset();
1.55 + void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
1.56 + const CExtendedCharacteristics* GetExtendedCharacteristicsL();
1.57 + TAny* GetExtension(TUid aExtensionId);
1.58 + // End of MPlugin Interface
1.59 +
1.60 + // MAsymmetricCipherBase Interface
1.61 + void SetKeyL(const CKey& aKey);
1.62 + void SetCryptoModeL(TUid aCryptoMode);
1.63 + void SetPaddingModeL(TUid aPaddingMode);
1.64 + TInt GetMaximumInputLengthL() const;
1.65 + TInt GetMaximumOutputLengthL() const;
1.66 + // End of MAsymmetricCipherBase Interface
1.67 +
1.68 + // MAsymmetricCipher Interface
1.69 + void ProcessL(const TDesC8& aInput, TDes8& aOutput);
1.70 +
1.71 + TUid ImplementationUid() const;
1.72 + // Destructor
1.73 + ~CDummyECCCipherImpl();
1.74 +
1.75 + private:
1.76 + CDummyECCCipherImpl(TUid aCryptoMode, TUid aPaddingMode);
1.77 + void ConstructL(const CKey& aKey);
1.78 + void DecryptL(const TDesC8& aInput, TDes8& aOutput);
1.79 + void EncryptL(const TDesC8& aInput, TDes8& aOutput);
1.80 +
1.81 + private:
1.82 + /* The key extracted from a CKey object. This would just have
1.83 + * a handle to the key stored in hardware. Hence the actual key
1.84 + * would not be available to the user of this cryptoSPI plugin.
1.85 + */
1.86 + CKey* iKey;
1.87 +
1.88 + /// encryption or decryption
1.89 + TUid iCryptoMode;
1.90 +
1.91 + /* The current padding scheme. This is not being used in the
1.92 + * reference implementation.
1.93 + */
1.94 + TUid iPaddingMode;
1.95 + };
1.96 +
1.97 +
1.98 + }
1.99 +
1.100 +#endif // CDUMMYECCIMPL_H