|
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 * keyagreement.h |
|
16 * Key Agreement Abstract Interface |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @publishedPartner |
|
24 @released |
|
25 */ |
|
26 |
|
27 #ifndef __CRYPTOAPI_KEYAGEEMENT_H__ |
|
28 #define __CRYPTOAPI_KEYAGEEMENT_H__ |
|
29 |
|
30 #include <cryptospi/cryptoplugin.h> |
|
31 |
|
32 |
|
33 /** |
|
34 The keyagreement definition. Intended to allow plug-ins |
|
35 to implement extensible keyagreement functionality, and to work with all |
|
36 known existing keyagreement algorithms, e.g. DiffieHellman, ECDH etc. A |
|
37 plug-in implementing this interface should expect the private key of one of |
|
38 the parties to be stored in it via SetKeyL() and then the public key of the |
|
39 other party to be used in the call to AgreeL(). |
|
40 */ |
|
41 |
|
42 namespace CryptoSpi |
|
43 { |
|
44 class CCryptoParams; |
|
45 |
|
46 class MKeyAgreement : public MPlugin |
|
47 { |
|
48 public: |
|
49 /** |
|
50 Set the private key for this keyagreement. Reset() is called to reinitialize the keyAgreement |
|
51 @param aSelfPrivateKey The private key of one of the parties |
|
52 @param aParams The parameters shared between both parties |
|
53 */ |
|
54 virtual void SetKeyL(const CKey& aSelfPrivateKey, const CCryptoParams* aParams) = 0; |
|
55 |
|
56 /** |
|
57 Performs the key agreement operation. |
|
58 @param aOtherPublicKey The public key of the other party |
|
59 @param aParams The parameters shared between both parties |
|
60 @return A pointer to a CKey instance containing the agreed key |
|
61 */ |
|
62 virtual CKey* AgreeL(const CKey& aOtherPublicKey, const CCryptoParams* aParams) = 0; |
|
63 }; |
|
64 |
|
65 |
|
66 class MAsyncKeyAgreement : public MPlugin |
|
67 { |
|
68 public: |
|
69 |
|
70 /** |
|
71 Set the private key for this keyagreement. Reset() is called to reinitialize the keyAgreement |
|
72 @param aSelfPrivateKey The private key of one of the parties |
|
73 @param aParams The parameters shared between both parties |
|
74 */ |
|
75 virtual void SetKeyL(const CKey& aSelfPrivateKey, const CCryptoParams* aParams) = 0; |
|
76 |
|
77 /** |
|
78 Performs the key agreement operation. |
|
79 @param aOtherPublicKey The public key of the other party |
|
80 @param aKey A pointer to a CKey instance containing the agreed key |
|
81 @param aParams The parameters shared between both parties |
|
82 @param aRequestStatus |
|
83 */ |
|
84 virtual void AgreeL(const CKey& aOtherPublicKey, CKey& aKey, const CCryptoParams* aParams, TRequestStatus& aRequestStatus) = 0; |
|
85 |
|
86 /** |
|
87 Cancel the outstanding request |
|
88 */ |
|
89 virtual void Cancel() = 0; |
|
90 }; |
|
91 |
|
92 } |
|
93 #endif //__CRYPTOAPI_KEYAGEEMENT_H__ |