|
1 /* |
|
2 * Copyright (c) 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 /** |
|
20 * @file |
|
21 * @internalComponent |
|
22 * @released |
|
23 */ |
|
24 #ifndef CPLUGINENTRY_H |
|
25 #define CPLUGINENTRY_H |
|
26 |
|
27 #include <cryptospi/cryptoparams.h> |
|
28 #include <e32cmn.h> |
|
29 #include <cryptospi/cryptospidef.h> |
|
30 #include "keys.h" |
|
31 #include <cryptospi/hashplugin.h> |
|
32 #include <cryptospi/randomplugin.h> |
|
33 #include "symmetriccipherplugin.h" |
|
34 #include "asymmetriccipherplugin.h" |
|
35 #include "signerplugin.h" |
|
36 #include "verifierplugin.h" |
|
37 #include "keypairgeneratorplugin.h" |
|
38 #include "keyagreementplugin.h" |
|
39 |
|
40 using namespace CryptoSpi; |
|
41 |
|
42 class CCryptoPluginEntry |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Enumerates the set of plug-ins supported by the module for a given interface |
|
47 * e.g. all of the hash plug-ins. |
|
48 * |
|
49 * @param aInterface The UID of the plug-in interface type. If the UID is not recognised |
|
50 * then the NULL pointer must be returned. |
|
51 * @param aNumPlugins The number of plug-in characteristics objects in the result. |
|
52 */ |
|
53 IMPORT_C static const TCharacteristics** Enumerate(TUid aInterface, |
|
54 TInt& aNumPlugins); |
|
55 |
|
56 IMPORT_C static void GetExtendedCharacteristicsL(TUid aImplementationUid, |
|
57 CExtendedCharacteristics*&); |
|
58 |
|
59 /** |
|
60 * Creates a new instance of an asymmetric cipher |
|
61 * |
|
62 * @param aPlugin A reference to a pointer that should be set to point to |
|
63 * the new asymmetric cipher object. |
|
64 * @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate. |
|
65 * @param aKey The encryption/decryption key. |
|
66 * @param aPaddingMode The padding mode. |
|
67 * @param aAlgorithmParams The parameters that are specific to a particular |
|
68 * algorithm. This is for extendibility and will normally be null. |
|
69 * |
|
70 * @leave Function can leave with any system wide error codes in |
|
71 * case of failure. |
|
72 */ |
|
73 IMPORT_C static void CreateAsymmetricCipherL(MAsymmetricCipher*& aPlugin, |
|
74 TUid aImplementationId, const CKey& aKey, TUid aCryptoMode, |
|
75 TUid aPaddingMode, const CCryptoParams* aAlgorithmParams); |
|
76 |
|
77 /** |
|
78 * Creates a new instance of an asymmetric signer. |
|
79 * |
|
80 * @param aPlugin A reference to a pointer that should be set to point to |
|
81 * the new asymmetric signer object. |
|
82 * @param aImplementationId The UID of the signer plug-in to instantiate. |
|
83 * @param aKey The signing key. |
|
84 * @param aPaddingMode The padding mode. |
|
85 * @param aAlgorithmParams The parameters that are specific to a particular |
|
86 * algorithm. This is for extendibility and will normally be null. |
|
87 * |
|
88 * @leave Function can leave with any system wide error codes in |
|
89 * case of failure. |
|
90 */ |
|
91 IMPORT_C static void CreateAsymmetricSignerL(MSigner*& aPlugin, |
|
92 TUid aImplementationId, const CKey& aKey, TUid aPaddingMode, |
|
93 const CCryptoParams* aAlgorithmParams); |
|
94 |
|
95 /** |
|
96 * Creates a new instance of an asymmetric verifier. |
|
97 * |
|
98 * @param aPlugin A reference to a pointer that should be set to point to |
|
99 * the new asymmetric verifier object. |
|
100 * @param aImplementationId The UID of the verifier plug-in to instantiate. |
|
101 * @param aKey The key to verify the signature with. |
|
102 * @param aAlgorithmParams The parameters that are specific to a particular |
|
103 * algorithm. This is for extendibility and will normally be null. |
|
104 * |
|
105 * @leave Function can leave with any system wide error codes in |
|
106 * case of failure. |
|
107 */ |
|
108 IMPORT_C static void CreateAsymmetricVerifierL(MVerifier*& aPlugin, |
|
109 TUid aImplementationId, |
|
110 const CKey& aKey, |
|
111 TUid aPaddingMode, |
|
112 const CCryptoParams* aAlgorithmParams); |
|
113 |
|
114 /** |
|
115 * Creates a new instance of a Hash object. |
|
116 * |
|
117 * @param aPlugin A reference to a pointer that should be set to point to |
|
118 * the new hash object. |
|
119 * @param aImplementationId The UID of the hash plug-in to instantiate. |
|
120 * @param aAlgorithmParams The parameters that are specific to a particular |
|
121 * algorithm. This is for extendibility and will normally be null. |
|
122 * |
|
123 * @leave Function can leave with any system wide error codes in |
|
124 * case of failure. |
|
125 */ |
|
126 IMPORT_C static void CreateHashL(MHash*& aPlugin, |
|
127 TUid aImplementationId, |
|
128 TUid aOperationMode, |
|
129 const CKey* aKey, |
|
130 const CCryptoParams* aAlgorithmParams); |
|
131 |
|
132 /** |
|
133 * Creates a new instance of a Random object. |
|
134 * |
|
135 * @param aPlugin A reference to a pointer that should be set to point to the new random object. |
|
136 * @param aImplementationId The UID of the random plug-in to instantiate. |
|
137 * @param aAlgorithmParams The parameters that are specific to a particular |
|
138 * algorithm. This is for extendibility and will normally be null. |
|
139 * |
|
140 * @leave Function can leave with any system wide error codes in |
|
141 * case of failure. |
|
142 */ |
|
143 IMPORT_C static void CreateRandomL(MRandom*& aPlugin, |
|
144 TUid aImplementationId, |
|
145 const CCryptoParams* aAlgorithmParams); |
|
146 |
|
147 |
|
148 /** |
|
149 * Creates a new instance of a key agreement system. |
|
150 * |
|
151 * @param aPlugin A reference to a pointer that should be set to point to |
|
152 * the new asymmetric key pair generator object. |
|
153 * @param aImplementationId The UID of the key agreement plug-in to instantiate. |
|
154 * @param aPrivateKey The private key to combine with the other parties public key |
|
155 * during the agreement. |
|
156 * @param aAlgorithmParams The parameters that are specific to a particular |
|
157 * algorithm. This is for extendibility and will normally be null. |
|
158 * |
|
159 * @leave Function can leave with any system wide error codes in |
|
160 * case of failure. |
|
161 */ |
|
162 IMPORT_C static void CreateKeyAgreementL(MKeyAgreement*& aPlugin, |
|
163 TUid aImplementationId, |
|
164 const CKey& aPrivateKey, |
|
165 const CCryptoParams* aAlgorithmParams); |
|
166 |
|
167 /** |
|
168 * Creates a new instance of an asymmetric key pair generator. |
|
169 * |
|
170 * @param aPlugin A reference to a pointer that should be set to point to |
|
171 * the new asymmetric key pair generator object. |
|
172 * @param aImplementationId The UID of the verifier plug-in to instantiate. |
|
173 * @param aAlgorithmParams The parameters that are specific to a particular |
|
174 * algorithm. This is for extendibility and will normally be null. |
|
175 * |
|
176 * @leave Function can leave with any system wide error codes in |
|
177 * case of failure. |
|
178 */ |
|
179 IMPORT_C static void CreateKeyPairGeneratorL(MKeyPairGenerator*& aPlugin, |
|
180 TUid aImplementationId, |
|
181 const CCryptoParams* aAlgorithmParams); |
|
182 |
|
183 /** |
|
184 * Creates a new instance of a symmetric cipher |
|
185 * |
|
186 * @param aPlugin A reference to a pointer that should be set to point to |
|
187 * the new asymmetric object. |
|
188 * @param aImplementationId The UID of the symmetric cipher plug-in to instantiate. |
|
189 * @param aKey The encryption/decryption key. |
|
190 * @param aCryptoMode Encrypt or Decrypt. |
|
191 * @param aOperationMode the block cipher mode to use ECB, CBC, CTR etc |
|
192 * @param aPadding the padding scheme to use. |
|
193 * @param aAlgorithmParams The parameters that are specific to a particular |
|
194 * algorithm. This is for extendibility and will normally be null. |
|
195 * |
|
196 * @leave Function can leave with any system wide error codes in |
|
197 * case of failure. |
|
198 */ |
|
199 IMPORT_C static void CreateSymmetricCipherL(MSymmetricCipher*& aPlugin, |
|
200 TUid aImplementationId, |
|
201 const CKey& aKey, |
|
202 TUid aCryptoMode, |
|
203 TUid aOperationMode, |
|
204 TUid aPadding, |
|
205 const CCryptoParams* aAlgorithmParams); |
|
206 |
|
207 |
|
208 }; |
|
209 |
|
210 #endif // CPLUGINENTRY_H |