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