17
|
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 |
/**
|
|
20 |
@file
|
|
21 |
@internalComponent
|
|
22 |
@released
|
|
23 |
*/
|
|
24 |
|
|
25 |
#ifndef __PLUGINENTRY_H__
|
|
26 |
#define __PLUGINENTRY_H__
|
|
27 |
|
|
28 |
#include <cryptospi/cryptoparams.h>
|
|
29 |
#include <e32cmn.h>
|
|
30 |
#include <cryptospi/cryptospidef.h>
|
|
31 |
#include "keys.h"
|
|
32 |
#include <cryptospi/hashplugin.h>
|
|
33 |
#include <cryptospi/randomplugin.h>
|
|
34 |
#include "symmetriccipherplugin.h"
|
|
35 |
#include "asymmetriccipherplugin.h"
|
|
36 |
#include "signerplugin.h"
|
|
37 |
#include "verifierplugin.h"
|
|
38 |
#include "keypairgeneratorplugin.h"
|
|
39 |
#include "keyagreementplugin.h"
|
|
40 |
|
|
41 |
|
|
42 |
#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
|
|
43 |
#include <cryptospi/macplugin.h>
|
|
44 |
#endif
|
|
45 |
|
|
46 |
using namespace CryptoSpi;
|
|
47 |
|
|
48 |
class CCryptoPluginEntry
|
|
49 |
{
|
|
50 |
public:
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Enumerates the set of plug-ins supported by the module for a given interface
|
|
54 |
* e.g. all of the hash plug-ins.
|
|
55 |
*
|
|
56 |
* @param aInterface The UID of the plug-in interface type. If the UID is not recognised
|
|
57 |
* then the NULL pointer must be returned.
|
|
58 |
* @param aNumPlugins The number of plug-in characteristics objects in the result.
|
|
59 |
* @param A pointer to an array of characteristics objects. The SPI casts this to
|
|
60 |
* the expected sub-class of TCharacteristics for the specified interface UID.
|
|
61 |
*/
|
|
62 |
IMPORT_C static const TCharacteristics** Enumerate(TUid aInterface, TInt& aNumPlugins);
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Retrieves the extended characteristics about a given implementation of an
|
|
66 |
* algorithm within the current plug-in DLL.
|
|
67 |
*
|
|
68 |
* @param aImplementationUid The UID of the implementation requested
|
|
69 |
* @return A pointer to the extended characteristics, allocated on the heap,
|
|
70 |
* which should be deleted once the caller has finished with it.
|
|
71 |
*/
|
|
72 |
IMPORT_C static void GetExtendedCharacteristicsL(TUid aImplementationUid, CExtendedCharacteristics*&);
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Creates a new instance of an asymmetric cipher
|
|
76 |
*
|
|
77 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
78 |
* the new asymmetric cipher object.
|
|
79 |
* @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate.
|
|
80 |
* @param aKey The encryption/decryption key.
|
|
81 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
82 |
* algorithm. This is for extendibility and will normally be null.
|
|
83 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
84 |
*/
|
|
85 |
IMPORT_C static void CreateAsymmetricCipherL(MAsymmetricCipher*& aPlugin,
|
|
86 |
TUid aImplementationId,
|
|
87 |
const CKey& aKey,
|
|
88 |
TUid aCryptoMode,
|
|
89 |
TUid aPaddingMode,
|
|
90 |
const CCryptoParams* aAlgorithmParams);
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Creates a new instance of an asymmetric signer.
|
|
94 |
*
|
|
95 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
96 |
* the new asymmetric signer object.
|
|
97 |
* @param aImplementationId The UID of the signer plug-in to instantiate.
|
|
98 |
* @param aKey The signing key.
|
|
99 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
100 |
* algorithm. This is for extendibility and will normally be null.
|
|
101 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
102 |
*/
|
|
103 |
IMPORT_C static void CreateAsymmetricSignerL(MSigner*& aPlugin,
|
|
104 |
TUid aImplementationId,
|
|
105 |
const CKey& aKey,
|
|
106 |
TUid aPaddingMode,
|
|
107 |
const CCryptoParams* aAlgorithmParams);
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Creates a new instance of an asymmetric verifier.
|
|
111 |
*
|
|
112 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
113 |
* the new asymmetric verifier object.
|
|
114 |
* @param aImplementationId The UID of the verifier plug-in to instantiate.
|
|
115 |
* @param aKey The key to verify the signature with.
|
|
116 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
117 |
* algorithm. This is for extendibility and will normally be null.
|
|
118 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
119 |
*/
|
|
120 |
IMPORT_C static void CreateAsymmetricVerifierL(MVerifier*& aPlugin,
|
|
121 |
TUid aImplementationId,
|
|
122 |
const CKey& aKey,
|
|
123 |
TUid aPaddingMode,
|
|
124 |
const CCryptoParams* aAlgorithmParams);
|
|
125 |
|
|
126 |
/**
|
|
127 |
* @deprecated
|
|
128 |
*
|
|
129 |
* Creates a new instance of a Hash object.
|
|
130 |
*
|
|
131 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
132 |
* the new hash object.
|
|
133 |
* @param aImplementationId The UID of the hash plug-in to instantiate.
|
|
134 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
135 |
* algorithm. This is for extendibility and will normally be null.
|
|
136 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
137 |
*/
|
|
138 |
IMPORT_C static void CreateHashL(MHash*& aPlugin,
|
|
139 |
TUid aImplementationId,
|
|
140 |
TUid aOperationMode,
|
|
141 |
const CKey* aKey,
|
|
142 |
const CCryptoParams* aAlgorithmParams);
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Creates a new instance of a key agreement system.
|
|
146 |
*
|
|
147 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
148 |
* the new asymmetric key pair generator object.
|
|
149 |
* @param aImplementationId The UID of the key agreement plug-in to instantiate.
|
|
150 |
* @param aPrivateKey The private key to combine with the other parties public key
|
|
151 |
* during the agreement.
|
|
152 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
153 |
* algorithm. This is for extendibility and will normally be null.
|
|
154 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
155 |
*/
|
|
156 |
IMPORT_C static void CreateKeyAgreementL(MKeyAgreement*& aPlugin,
|
|
157 |
TUid aImplementationId,
|
|
158 |
const CKey& aPrivateKey,
|
|
159 |
const CCryptoParams* aAlgorithmParams);
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Creates a new instance of an asymmetric key pair generator.
|
|
163 |
*
|
|
164 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
165 |
* the new asymmetric key pair generator object.
|
|
166 |
* @param aImplementationId The UID of the verifier plug-in to instantiate.
|
|
167 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
168 |
* algorithm. This is for extendibility and will normally be null.
|
|
169 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
170 |
*/
|
|
171 |
IMPORT_C static void CreateKeyPairGeneratorL(MKeyPairGenerator*& aPlugin,
|
|
172 |
TUid aImplementationId,
|
|
173 |
const CCryptoParams* aAlgorithmParams);
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Creates a new instance of a Random object.
|
|
177 |
*
|
|
178 |
* @param aPlugin A reference to a pointer that should be set to point to the new random object.
|
|
179 |
* @param aImplementationId The UID of the random plug-in to instantiate.
|
|
180 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
181 |
* algorithm. This is for extendibility and will normally be null.
|
|
182 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
183 |
*/
|
|
184 |
IMPORT_C static void CreateRandomL(MRandom*& aPlugin,
|
|
185 |
TUid aImplementationId,
|
|
186 |
const CCryptoParams* aAlgorithmParams);
|
|
187 |
|
|
188 |
/**
|
|
189 |
* Creates a new instance of a symmetric cipher
|
|
190 |
*
|
|
191 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
192 |
* the new asymmetric object.
|
|
193 |
* @param aImplementationId The UID of the symmetric cipher plug-in to instantiate.
|
|
194 |
* @param aKey The encryption/decryption key.
|
|
195 |
* @param aCryptoMode Encrypt or Decrypt.
|
|
196 |
* @param aOperationMode the block cipher mode to use ECB, CBC, CTR etc
|
|
197 |
* @param aPadding the padding scheme to use.
|
|
198 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
199 |
* algorithm. This is for extendibility and will normally be null.
|
|
200 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
201 |
*/
|
|
202 |
IMPORT_C static void CreateSymmetricCipherL(MSymmetricCipher*& aPlugin,
|
|
203 |
TUid aImplementationId,
|
|
204 |
const CKey& aKey,
|
|
205 |
TUid aCryptoMode,
|
|
206 |
TUid aOperationMode,
|
|
207 |
TUid aPadding,
|
|
208 |
const CCryptoParams* aAlgorithmParams);
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Creates a new instance of an asymmetric cipher
|
|
212 |
*
|
|
213 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
214 |
* the new asymmetric cipher object.
|
|
215 |
* @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate.
|
|
216 |
* @param aKey The encryption/decryption key.
|
|
217 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
218 |
* algorithm. This is for extendibility and will normally be null.
|
|
219 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
220 |
|
|
221 |
IMPORT_C static void CreateAsyncAsymmetricCipherL(MAsyncAsymmetricCipher*& aPlugin,
|
|
222 |
TUid aImplementationId,
|
|
223 |
const CKey& aKey,
|
|
224 |
const CCryptoParams* aAlgorithmParams);
|
|
225 |
*/
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Creates a new instance of an asymmetric signer.
|
|
229 |
*
|
|
230 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
231 |
* the new asymmetric signer object.
|
|
232 |
* @param aImplementationId The UID of the signer plug-in to instantiate.
|
|
233 |
* @param aKey The signing key.
|
|
234 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
235 |
* algorithm. This is for extendibility and will normally be null.
|
|
236 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
237 |
|
|
238 |
IMPORT_C static void CreateAsyncAsymmetricSignerL(MAsyncSigner*& aPlugin,
|
|
239 |
TUid aImplementationId,
|
|
240 |
const CKey& aKey,
|
|
241 |
const CCryptoParams* aAlgorithmParams);
|
|
242 |
*/
|
|
243 |
|
|
244 |
/**
|
|
245 |
* Creates a new instance of an asymmetric verifier.
|
|
246 |
*
|
|
247 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
248 |
* the new asymmetric verifier object.
|
|
249 |
* @param aImplementationId The UID of the verifier plug-in to instantiate.
|
|
250 |
* @param aKey The key to verify the signature with.
|
|
251 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
252 |
* algorithm. This is for extendibility and will normally be null.
|
|
253 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
254 |
|
|
255 |
IMPORT_C static void CreateAsyncAsymmetricVerifierL(MAsyncVerifier*& aPlugin,
|
|
256 |
TUid aImplementationId,
|
|
257 |
const CKey& aKey,
|
|
258 |
const CCryptoParams* aAlgorithmParams);
|
|
259 |
*/
|
|
260 |
|
|
261 |
/**
|
|
262 |
* @deprecated
|
|
263 |
*
|
|
264 |
* Creates a new instance of a Hash object.
|
|
265 |
*
|
|
266 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
267 |
* the new hash object.
|
|
268 |
* @param aImplementationId The UID of the hash plug-in to instantiate.
|
|
269 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
270 |
* algorithm. This is for extendibility and will normally be null.
|
|
271 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
272 |
|
|
273 |
IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin,
|
|
274 |
TUid aImplementationId,
|
|
275 |
TUid aOperationMode,
|
|
276 |
const CKey* aKey,
|
|
277 |
const CCryptoParams* aAlgorithmParams);
|
|
278 |
*/
|
|
279 |
|
|
280 |
/**
|
|
281 |
* Creates a new instance of a key agreement system.
|
|
282 |
*
|
|
283 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
284 |
* the new asymmetric key pair generator object.
|
|
285 |
* @param aImplementationId The UID of the key agreement plug-in to instantiate.
|
|
286 |
* @param aKey The private key to combine with the other parties public key
|
|
287 |
* during the agreement.
|
|
288 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
289 |
* algorithm. This is for extendibility and will normally be null.
|
|
290 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
291 |
|
|
292 |
IMPORT_C static void CreateAsyncKeyAgreementL(MAsyncKeyAgreement*& aPlugin,
|
|
293 |
TUid aImplementationId,
|
|
294 |
const CKey& aPrivateKey,
|
|
295 |
const CCryptoParams* aAlgorithmParams);
|
|
296 |
*/
|
|
297 |
|
|
298 |
/**
|
|
299 |
* Creates a new instance of an asymmetric key pair generator.
|
|
300 |
*
|
|
301 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
302 |
* the new asymmetric key pair generator object.
|
|
303 |
* @param aImplementationId The UID of the verifier plug-in to instantiate.
|
|
304 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
305 |
* algorithm. This is for extendibility and will normally be null.
|
|
306 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
307 |
|
|
308 |
IMPORT_C static void CreateAsyncKeyPairGeneratorL(MAsyncKeyPairGenerator*& aPlugin,
|
|
309 |
TUid aImplementationId,
|
|
310 |
const CCryptoParams* aAlgorithmParams);
|
|
311 |
*/
|
|
312 |
|
|
313 |
/**
|
|
314 |
* Creates a new instance of a Random object.
|
|
315 |
*
|
|
316 |
* @param aPlugin A reference to a pointer that should be set to point to the new random object.
|
|
317 |
* @param aImplementationId The UID of the random plug-in to instantiate.
|
|
318 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
319 |
* algorithm. This is for extendibility and will normally be null.
|
|
320 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
321 |
|
|
322 |
IMPORT_C static void CreateAsyncRandomL(MAsyncRandom*& aPlugin,
|
|
323 |
TUid aImplementationId,
|
|
324 |
const CCryptoParams* aAlgorithmParams);
|
|
325 |
*/
|
|
326 |
|
|
327 |
/**
|
|
328 |
* Creates a new instance of a symmetric cipher
|
|
329 |
*
|
|
330 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
331 |
* the new asymmetric object.
|
|
332 |
* @param aImplementationId The UID of the symmetric cipher plug-in to instantiate.
|
|
333 |
* @param aKey The encryption/decryption key.
|
|
334 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
335 |
* algorithm. This is for extendibility and will normally be null.
|
|
336 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
337 |
|
|
338 |
IMPORT_C static void CreateAsyncSymmetricCipherL(MAsyncSymmetricCipher*& aPlugin,
|
|
339 |
TUid aImplementationId,
|
|
340 |
const CKey& aKey,
|
|
341 |
TUid aMode,
|
|
342 |
TUid aPadding,
|
|
343 |
const CCryptoParams* aAlgorithmParams);
|
|
344 |
*/
|
|
345 |
|
|
346 |
#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
|
|
347 |
|
|
348 |
/**
|
|
349 |
* Creates a new instance of a Hash object.
|
|
350 |
*
|
|
351 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
352 |
* the new hash object.
|
|
353 |
* @param aImplementationId The UID of the hash plug-in to instantiate.
|
|
354 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
355 |
* algorithm. This is for extendibility and will normally be null.
|
|
356 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
357 |
*/
|
|
358 |
IMPORT_C static void CreateHashL(MHash*& aPlugin,
|
|
359 |
TUid aImplementationId,
|
|
360 |
const CCryptoParams* aAlgorithmParams);
|
|
361 |
/**
|
|
362 |
* Creates a new instance of a Hash object.
|
|
363 |
*
|
|
364 |
* @param aPlugin A reference to a pointer that should be set to point to
|
|
365 |
* the new hash object.
|
|
366 |
* @param aImplementationId The UID of the hash plug-in to instantiate.
|
|
367 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
368 |
* algorithm. This is for extendibility and will normally be null.
|
|
369 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
370 |
|
|
371 |
IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin,
|
|
372 |
TUid aImplementationId,
|
|
373 |
const CCryptoParams* aAlgorithmParams);
|
|
374 |
*/
|
|
375 |
|
|
376 |
/**
|
|
377 |
* Create a CMac instance (if implementation is software based)
|
|
378 |
*
|
|
379 |
* @param aMac The pointer to CMac
|
|
380 |
* @param aImplementationId The specific hash or cipher plug-in to instantiate..
|
|
381 |
* @param aKey The key for calculating message authentication code value.
|
|
382 |
* Based on the algorithm used we will define the properties of the key.
|
|
383 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
384 |
* algorithm. This is for extendibility and will normally be null.
|
|
385 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
386 |
*/
|
|
387 |
IMPORT_C static void CreateMacL(MMac*& aPlugin,
|
|
388 |
const TUid aImplementationId,
|
|
389 |
const CKey& aKey,
|
|
390 |
const CCryptoParams* aAlgorithmParams);
|
|
391 |
|
|
392 |
/**
|
|
393 |
* Create a CAsyncMac instance
|
|
394 |
*
|
|
395 |
* @param aMac The pointer to CAsyncMac
|
|
396 |
* @param aImplementationId The specific hash or cipher plug-in to instantiate..
|
|
397 |
* @param aKey The key for calculating message authentication code value.
|
|
398 |
* Based on the algorithm used we will define the properties of the key.
|
|
399 |
* @param aAlgorithmParams The parameters that are specific to a particular
|
|
400 |
* algorithm. This is for extendibility and will normally be null.
|
|
401 |
* @return KErrNone if successful; otherwise, a system wide error code.
|
|
402 |
|
|
403 |
IMPORT_C static void CreateAsyncMacL(MAsyncMac*& aPlugin,
|
|
404 |
const TUid aImplementationId,
|
|
405 |
const CKey& aKey,
|
|
406 |
const CCryptoParams* aAlgorithmParams);
|
|
407 |
*/
|
|
408 |
|
|
409 |
#endif
|
|
410 |
|
|
411 |
};
|
|
412 |
|
|
413 |
|
|
414 |
#endif // __PLUGINENTRY_H__
|