|
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 #include <e32def.h> |
|
20 #include <e32cmn.h> |
|
21 #include "keys.h" |
|
22 #include <cryptospi/cryptospidef.h> |
|
23 |
|
24 #include "signerimpl.h" |
|
25 #include "pluginconfig.h" |
|
26 |
|
27 using namespace SoftwareCrypto; |
|
28 |
|
29 CSignerImpl::CSignerImpl() |
|
30 { |
|
31 } |
|
32 |
|
33 CSignerImpl::~CSignerImpl() |
|
34 { |
|
35 delete iKey; |
|
36 } |
|
37 |
|
38 void CSignerImpl::Close() |
|
39 { |
|
40 delete this; |
|
41 } |
|
42 |
|
43 void CSignerImpl::Reset() |
|
44 { |
|
45 } |
|
46 |
|
47 TAny* CSignerImpl::GetExtension(TUid /*aExtensionId*/) |
|
48 { |
|
49 return 0; |
|
50 } |
|
51 |
|
52 void CSignerImpl::GetCharacteristicsL(const TAny*& aPluginCharacteristics) |
|
53 { |
|
54 TInt numCiphers = sizeof(KSignerCharacteristics)/sizeof(TAsymmetricSignatureCharacteristics*); |
|
55 TInt32 implUid = ImplementationUid().iUid; |
|
56 for (TInt i = 0; i < numCiphers; ++i) |
|
57 { |
|
58 if (KSignerCharacteristics[i]->cmn.iImplementationUID == implUid) |
|
59 { |
|
60 aPluginCharacteristics = KSignerCharacteristics[i]; |
|
61 break; |
|
62 } |
|
63 } |
|
64 } |
|
65 |
|
66 void CSignerImpl::DoSetKeyL(const CKey& aPrivateKey) |
|
67 { |
|
68 delete iKey; |
|
69 iKey = CKey::NewL(aPrivateKey); |
|
70 } |
|
71 |
|
72 void CSignerImpl::ConstructL(const CKey& aPrivateKey) |
|
73 { |
|
74 SetKeyL(aPrivateKey); |
|
75 } |
|
76 |
|
77 |
|
78 // Methods implemented in subclass. No coverage here. |
|
79 #ifdef _BullseyeCoverage |
|
80 #pragma suppress_warnings on |
|
81 #pragma BullseyeCoverage off |
|
82 #pragma suppress_warnings off |
|
83 #endif |
|
84 void CSignerImpl::SetPaddingModeL(TUid /*aPaddingMode*/) |
|
85 { |
|
86 // Override in subclass |
|
87 User::Leave(KErrNotSupported); |
|
88 } |
|
89 |
|
90 void CSignerImpl::SetKeyL(const CKey& /*aPrivateKey*/) |
|
91 { |
|
92 // Override in subclass |
|
93 User::Leave(KErrNotSupported); |
|
94 } |
|
95 |
|
96 TInt CSignerImpl::GetMaximumInputLengthL() const |
|
97 { |
|
98 // Override in subclass |
|
99 User::Leave(KErrNotSupported); |
|
100 return 0; |
|
101 } |
|
102 |
|
103 TInt CSignerImpl::GetMaximumOutputLengthL() const |
|
104 { |
|
105 // Override in subclass |
|
106 User::Leave(KErrNotSupported); |
|
107 return 0; |
|
108 } |