sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@internalComponent
|
sl@0
|
22 |
@released
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
#ifndef CDUMMYECCIMPL_H
|
sl@0
|
25 |
#define CDUMMYECCIMPL_H
|
sl@0
|
26 |
|
sl@0
|
27 |
#include <e32base.h>
|
sl@0
|
28 |
#include <e32cmn.h>
|
sl@0
|
29 |
#include <cryptospi/cryptospidef.h>
|
sl@0
|
30 |
#include "keys.h"
|
sl@0
|
31 |
#include "asymmetriccipherplugin.h"
|
sl@0
|
32 |
|
sl@0
|
33 |
namespace DummyEccHwCrypto
|
sl@0
|
34 |
{
|
sl@0
|
35 |
using namespace CryptoSpi;
|
sl@0
|
36 |
|
sl@0
|
37 |
/**
|
sl@0
|
38 |
* Implements the MAsymmetricCipher interface.
|
sl@0
|
39 |
*
|
sl@0
|
40 |
* This should be used to create the cipher object to perform
|
sl@0
|
41 |
* encryption / decryption using ECC.
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
NONSHARABLE_CLASS(CDummyECCCipherImpl) : public CBase, public MAsymmetricCipher
|
sl@0
|
44 |
{
|
sl@0
|
45 |
public:
|
sl@0
|
46 |
static CDummyECCCipherImpl* NewL(const CKey& aKey, TUid aCryptoMode, TUid aPaddingMode);
|
sl@0
|
47 |
static CDummyECCCipherImpl* NewLC(const CKey& aKey, TUid aCryptoMode, TUid aPaddingMode);
|
sl@0
|
48 |
|
sl@0
|
49 |
// MPlugin Interface
|
sl@0
|
50 |
void Close();
|
sl@0
|
51 |
void Reset();
|
sl@0
|
52 |
void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
|
sl@0
|
53 |
const CExtendedCharacteristics* GetExtendedCharacteristicsL();
|
sl@0
|
54 |
TAny* GetExtension(TUid aExtensionId);
|
sl@0
|
55 |
// End of MPlugin Interface
|
sl@0
|
56 |
|
sl@0
|
57 |
// MAsymmetricCipherBase Interface
|
sl@0
|
58 |
void SetKeyL(const CKey& aKey);
|
sl@0
|
59 |
void SetCryptoModeL(TUid aCryptoMode);
|
sl@0
|
60 |
void SetPaddingModeL(TUid aPaddingMode);
|
sl@0
|
61 |
TInt GetMaximumInputLengthL() const;
|
sl@0
|
62 |
TInt GetMaximumOutputLengthL() const;
|
sl@0
|
63 |
// End of MAsymmetricCipherBase Interface
|
sl@0
|
64 |
|
sl@0
|
65 |
// MAsymmetricCipher Interface
|
sl@0
|
66 |
void ProcessL(const TDesC8& aInput, TDes8& aOutput);
|
sl@0
|
67 |
|
sl@0
|
68 |
TUid ImplementationUid() const;
|
sl@0
|
69 |
// Destructor
|
sl@0
|
70 |
~CDummyECCCipherImpl();
|
sl@0
|
71 |
|
sl@0
|
72 |
private:
|
sl@0
|
73 |
CDummyECCCipherImpl(TUid aCryptoMode, TUid aPaddingMode);
|
sl@0
|
74 |
void ConstructL(const CKey& aKey);
|
sl@0
|
75 |
void DecryptL(const TDesC8& aInput, TDes8& aOutput);
|
sl@0
|
76 |
void EncryptL(const TDesC8& aInput, TDes8& aOutput);
|
sl@0
|
77 |
|
sl@0
|
78 |
private:
|
sl@0
|
79 |
/* The key extracted from a CKey object. This would just have
|
sl@0
|
80 |
* a handle to the key stored in hardware. Hence the actual key
|
sl@0
|
81 |
* would not be available to the user of this cryptoSPI plugin.
|
sl@0
|
82 |
*/
|
sl@0
|
83 |
CKey* iKey;
|
sl@0
|
84 |
|
sl@0
|
85 |
/// encryption or decryption
|
sl@0
|
86 |
TUid iCryptoMode;
|
sl@0
|
87 |
|
sl@0
|
88 |
/* The current padding scheme. This is not being used in the
|
sl@0
|
89 |
* reference implementation.
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
TUid iPaddingMode;
|
sl@0
|
92 |
};
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
}
|
sl@0
|
96 |
|
sl@0
|
97 |
#endif // CDUMMYECCIMPL_H
|