First public contribution.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
25 #ifndef __PLUGINENTRY_H__
26 #define __PLUGINENTRY_H__
28 #include <cryptospi/cryptoparams.h>
30 #include <cryptospi/cryptospidef.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"
42 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
43 #include <cryptospi/macplugin.h>
46 using namespace CryptoSpi;
48 class CCryptoPluginEntry
53 * Enumerates the set of plug-ins supported by the module for a given interface
54 * e.g. all of the hash plug-ins.
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.
62 IMPORT_C static const TCharacteristics** Enumerate(TUid aInterface, TInt& aNumPlugins);
65 * Retrieves the extended characteristics about a given implementation of an
66 * algorithm within the current plug-in DLL.
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.
72 IMPORT_C static void GetExtendedCharacteristicsL(TUid aImplementationUid, CExtendedCharacteristics*&);
75 * Creates a new instance of an asymmetric cipher
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.
85 IMPORT_C static void CreateAsymmetricCipherL(MAsymmetricCipher*& aPlugin,
86 TUid aImplementationId,
90 const CCryptoParams* aAlgorithmParams);
93 * Creates a new instance of an asymmetric signer.
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.
103 IMPORT_C static void CreateAsymmetricSignerL(MSigner*& aPlugin,
104 TUid aImplementationId,
107 const CCryptoParams* aAlgorithmParams);
110 * Creates a new instance of an asymmetric verifier.
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.
120 IMPORT_C static void CreateAsymmetricVerifierL(MVerifier*& aPlugin,
121 TUid aImplementationId,
124 const CCryptoParams* aAlgorithmParams);
129 * Creates a new instance of a Hash object.
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.
138 IMPORT_C static void CreateHashL(MHash*& aPlugin,
139 TUid aImplementationId,
142 const CCryptoParams* aAlgorithmParams);
145 * Creates a new instance of a key agreement system.
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.
156 IMPORT_C static void CreateKeyAgreementL(MKeyAgreement*& aPlugin,
157 TUid aImplementationId,
158 const CKey& aPrivateKey,
159 const CCryptoParams* aAlgorithmParams);
162 * Creates a new instance of an asymmetric key pair generator.
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.
171 IMPORT_C static void CreateKeyPairGeneratorL(MKeyPairGenerator*& aPlugin,
172 TUid aImplementationId,
173 const CCryptoParams* aAlgorithmParams);
176 * Creates a new instance of a Random object.
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.
184 IMPORT_C static void CreateRandomL(MRandom*& aPlugin,
185 TUid aImplementationId,
186 const CCryptoParams* aAlgorithmParams);
189 * Creates a new instance of a symmetric cipher
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.
202 IMPORT_C static void CreateSymmetricCipherL(MSymmetricCipher*& aPlugin,
203 TUid aImplementationId,
208 const CCryptoParams* aAlgorithmParams);
211 * Creates a new instance of an asymmetric cipher
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.
221 IMPORT_C static void CreateAsyncAsymmetricCipherL(MAsyncAsymmetricCipher*& aPlugin,
222 TUid aImplementationId,
224 const CCryptoParams* aAlgorithmParams);
228 * Creates a new instance of an asymmetric signer.
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.
238 IMPORT_C static void CreateAsyncAsymmetricSignerL(MAsyncSigner*& aPlugin,
239 TUid aImplementationId,
241 const CCryptoParams* aAlgorithmParams);
245 * Creates a new instance of an asymmetric verifier.
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.
255 IMPORT_C static void CreateAsyncAsymmetricVerifierL(MAsyncVerifier*& aPlugin,
256 TUid aImplementationId,
258 const CCryptoParams* aAlgorithmParams);
264 * Creates a new instance of a Hash object.
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.
273 IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin,
274 TUid aImplementationId,
277 const CCryptoParams* aAlgorithmParams);
281 * Creates a new instance of a key agreement system.
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.
292 IMPORT_C static void CreateAsyncKeyAgreementL(MAsyncKeyAgreement*& aPlugin,
293 TUid aImplementationId,
294 const CKey& aPrivateKey,
295 const CCryptoParams* aAlgorithmParams);
299 * Creates a new instance of an asymmetric key pair generator.
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.
308 IMPORT_C static void CreateAsyncKeyPairGeneratorL(MAsyncKeyPairGenerator*& aPlugin,
309 TUid aImplementationId,
310 const CCryptoParams* aAlgorithmParams);
314 * Creates a new instance of a Random object.
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.
322 IMPORT_C static void CreateAsyncRandomL(MAsyncRandom*& aPlugin,
323 TUid aImplementationId,
324 const CCryptoParams* aAlgorithmParams);
328 * Creates a new instance of a symmetric cipher
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.
338 IMPORT_C static void CreateAsyncSymmetricCipherL(MAsyncSymmetricCipher*& aPlugin,
339 TUid aImplementationId,
343 const CCryptoParams* aAlgorithmParams);
346 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
349 * Creates a new instance of a Hash object.
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.
358 IMPORT_C static void CreateHashL(MHash*& aPlugin,
359 TUid aImplementationId,
360 const CCryptoParams* aAlgorithmParams);
362 * Creates a new instance of a Hash object.
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.
371 IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin,
372 TUid aImplementationId,
373 const CCryptoParams* aAlgorithmParams);
377 * Create a CMac instance (if implementation is software based)
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.
387 IMPORT_C static void CreateMacL(MMac*& aPlugin,
388 const TUid aImplementationId,
390 const CCryptoParams* aAlgorithmParams);
393 * Create a CAsyncMac instance
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.
403 IMPORT_C static void CreateAsyncMacL(MAsyncMac*& aPlugin,
404 const TUid aImplementationId,
406 const CCryptoParams* aAlgorithmParams);
414 #endif // __PLUGINENTRY_H__