|
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 #ifndef __KEYAGREEMENTIMPL_H__ |
|
20 #define __KEYAGREEMENTIMPL_H__ |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalComponent |
|
25 @released |
|
26 */ |
|
27 |
|
28 #include <e32base.h> |
|
29 #include <cryptospi/cryptospidef.h> |
|
30 #include "keys.h" |
|
31 #include "keyagreementplugin.h" |
|
32 |
|
33 /** |
|
34 * Abstract base class for key agreement plug-ins. |
|
35 */ |
|
36 namespace SoftwareCrypto |
|
37 { |
|
38 using namespace CryptoSpi; |
|
39 |
|
40 NONSHARABLE_CLASS(CKeyAgreementImpl) : public CBase, public MKeyAgreement |
|
41 { |
|
42 public: |
|
43 |
|
44 // Override MPlugin virtual functions |
|
45 void Close(); |
|
46 void Reset(); // Always call reset in super-class if you override this |
|
47 TAny* GetExtension(TUid aExtensionId); |
|
48 void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics); |
|
49 // End of MPlugin |
|
50 |
|
51 // Override MKeyAgreement virtual functions |
|
52 void SetKeyL(const CKey& aSelfPrivateKey, const CCryptoParams* aParams); |
|
53 // End of MKeyAgreement |
|
54 |
|
55 /// Destructor |
|
56 ~CKeyAgreementImpl(); |
|
57 |
|
58 protected: |
|
59 /** |
|
60 Constructor |
|
61 */ |
|
62 CKeyAgreementImpl(); |
|
63 |
|
64 /** |
|
65 Second phase of construction. Always call ConstructL in the super-class |
|
66 if your override this method. |
|
67 @param aPrivateKey The private key of one of the parties |
|
68 @param aParams The parameters shared between both parties |
|
69 */ |
|
70 virtual void ConstructL(const CKey& aPrivateKey, const CCryptoParams* aParams); |
|
71 |
|
72 /** |
|
73 Helper function implemented by concrete cipher sub-class that allows |
|
74 GetCharacteristicsL to return the correct characteristics object. |
|
75 @return The implemention uid |
|
76 */ |
|
77 virtual TUid ImplementationUid() const = 0; |
|
78 |
|
79 private: |
|
80 |
|
81 protected: |
|
82 CKey* iPrivateKey; |
|
83 CCryptoParams* iSharedParams; // common parameters between our private key and their public key |
|
84 }; |
|
85 } |
|
86 |
|
87 #endif // __KEYAGREEMENTIMPL_H__ |