Update contrib.
2 * Copyright (c) 2006-2010 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>
31 #include <cryptospi/keys.h>
32 #include <cryptospi/hashplugin.h>
33 #include <cryptospi/randomplugin.h>
34 #include <cryptospi/symmetriccipherplugin.h>
35 #include <cryptospi/asymmetriccipherplugin.h>
36 #include <cryptospi/signerplugin.h>
37 #include <cryptospi/verifierplugin.h>
38 #include <cryptospi/keypairgeneratorplugin.h>
39 #include <cryptospi/keyagreementplugin.h>
41 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
42 #include <cryptospi/macplugin.h>
45 using namespace CryptoSpi;
47 class CCryptoPluginEntry
52 Enumerates the set of plug-ins supported by the module for a given interface
53 e.g. all of the hash plug-ins.
55 @param aInterface The UID of the plug-in interface type. If the UID is not recognised
56 then the NULL pointer must be returned.
57 @param aNumPlugins The number of plug-in characteristics objects in the result.
58 @param A pointer to an array of characteristics objects. The SPI casts this to
59 the expected sub-class of TCharacteristics for the specified interface UID.
61 IMPORT_C static const TCharacteristics** Enumerate(TUid aInterface, TInt& aNumPlugins);
64 Retrieves the extended characteristics about a given implementation of an
65 algorithm within the current plug-in DLL.
67 @param aImplementationUid The UID of the implementation requested
68 @return A pointer to the extended characteristics, allocated on the heap,
69 which should be deleted once the caller has finished with it.
71 IMPORT_C static void GetExtendedCharacteristicsL(TUid aImplementationUid, CExtendedCharacteristics*&);
74 Creates a new instance of an asymmetric cipher
76 @param aPlugin A reference to a pointer that should be set to point to
77 the new asymmetric cipher object.
78 @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate.
79 @param aKey The encryption/decryption key.
80 @param aAlgorithmParams The parameters that are specific to a particular
81 algorithm. This is for extendibility and will normally be null.
82 @return KErrNone if successful; otherwise, a system wide error code.
84 IMPORT_C static void CreateAsymmetricCipherL(MAsymmetricCipher*& aPlugin,
85 TUid aImplementationId,
89 const CCryptoParams* aAlgorithmParams);
92 Creates a new instance of an asymmetric signer.
94 @param aPlugin A reference to a pointer that should be set to point to
95 the new asymmetric signer object.
96 @param aImplementationId The UID of the signer plug-in to instantiate.
97 @param aKey The signing key.
98 @param aAlgorithmParams The parameters that are specific to a particular
99 algorithm. This is for extendibility and will normally be null.
100 @return KErrNone if successful; otherwise, a system wide error code.
102 IMPORT_C static void CreateAsymmetricSignerL(MSigner*& aPlugin,
103 TUid aImplementationId,
106 const CCryptoParams* aAlgorithmParams);
109 Creates a new instance of an asymmetric verifier.
111 @param aPlugin A reference to a pointer that should be set to point to
112 the new asymmetric verifier object.
113 @param aImplementationId The UID of the verifier plug-in to instantiate.
114 @param aKey The key to verify the signature with.
115 @param aAlgorithmParams The parameters that are specific to a particular
116 algorithm. This is for extendibility and will normally be null.
117 @return KErrNone if successful; otherwise, a system wide error code.
119 IMPORT_C static void CreateAsymmetricVerifierL(MVerifier*& aPlugin,
120 TUid aImplementationId,
123 const CCryptoParams* aAlgorithmParams);
128 Creates a new instance of a Hash object.
130 @param aPlugin A reference to a pointer that should be set to point to
132 @param aImplementationId The UID of the hash plug-in to instantiate.
133 @param aAlgorithmParams The parameters that are specific to a particular
134 algorithm. This is for extendibility and will normally be null.
135 @return KErrNone if successful; otherwise, a system wide error code.
137 IMPORT_C static void CreateHashL(MHash*& aPlugin,
138 TUid aImplementationId,
141 const CCryptoParams* aAlgorithmParams);
143 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
145 * Creates a new instance of a Hash object.
147 * @param aPlugin A reference to a pointer that should be set to point to
148 * the new hash object.
149 * @param aImplementationId The UID of the hash plug-in to instantiate.
150 * @param aAlgorithmParams The parameters that are specific to a particular
151 * algorithm. This is for extendibility and will normally be null.
152 * @return KErrNone if successful; otherwise, a system wide error code.
154 IMPORT_C static void CreateHashL(MHash*& aPlugin,
155 TUid aImplementationId,
156 const CCryptoParams* aAlgorithmParams);
160 Creates a new instance of a Random object.
162 @param aPlugin A reference to a pointer that should be set to point to the new random object.
163 @param aImplementationId The UID of the random plug-in to instantiate.
164 @param aAlgorithmParams The parameters that are specific to a particular
165 algorithm. This is for extendibility and will normally be null.
166 @return KErrNone if successful; otherwise, a system wide error code.
168 IMPORT_C static void CreateRandomL(MRandom*& aPlugin,
169 TUid aImplementationId,
170 const CCryptoParams* aAlgorithmParams);
174 Creates a new instance of a key agreement system.
176 @param aPlugin A reference to a pointer that should be set to point to
177 the new asymmetric key pair generator object.
178 @param aImplementationId The UID of the key agreement plug-in to instantiate.
179 @param aKey The private key to combine with the other parties public key
180 during the agreement.
181 @param aAlgorithmParams The parameters that are specific to a particular
182 algorithm. This is for extendibility and will normally be null.
183 @return KErrNone if successful; otherwise, a system wide error code.
185 IMPORT_C static void CreateKeyAgreementL(MKeyAgreement*& aPlugin,
186 TUid aImplementationId,
187 const CKey& aPrivateKey,
188 const CCryptoParams* aAlgorithmParams);
191 Creates a new instance of an asymmetric key pair generator.
193 @param aPlugin A reference to a pointer that should be set to point to
194 the new asymmetric key pair generator object.
195 @param aImplementationId The UID of the verifier plug-in to instantiate.
196 @param aAlgorithmParams The parameters that are specific to a particular
197 algorithm. This is for extendibility and will normally be null.
198 @return KErrNone if successful; otherwise, a system wide error code.
200 IMPORT_C static void CreateKeyPairGeneratorL(MKeyPairGenerator*& aPlugin,
201 TUid aImplementationId,
202 const CCryptoParams* aAlgorithmParams);
205 Creates a new instance of a symmetric cipher
207 @param aPlugin A reference to a pointer that should be set to point to
208 the new asymmetric object.
209 @param aImplementationId The UID of the symmetric cipher plug-in to instantiate.
210 @param aKey The encryption/decryption key.
211 @param aCryptoMode Encrypt or Decrypt.
212 @param aOperationMode the block cipher mode to use ECB, CBC, CTR etc
213 @param aPadding the padding scheme to use.
214 @param aAlgorithmParams The parameters that are specific to a particular
215 algorithm. This is for extendibility and will normally be null.
216 @return KErrNone if successful; otherwise, a system wide error code.
218 IMPORT_C static void CreateSymmetricCipherL(MSymmetricCipher*& aPlugin,
219 TUid aImplementationId,
224 const CCryptoParams* aAlgorithmParams);
226 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
228 * Create a CMac instance (if implementation is software based)
230 * @param aMac The pointer to CMac
231 * @param aImplementationId The specific hash or cipher plug-in to instantiate..
232 * @param aKey The key for calculating message authentication code value.
233 * Based on the algorithm used we will define the properties of the 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 CreateMacL(MMac*& aPlugin,
239 const TUid aImplementationId,
241 const CCryptoParams* aAlgorithmParams);
246 Creates a new instance of a Random object.
248 @param aPlugin A reference to a pointer that should be set to point to the new random object.
249 @param aImplementationId The UID of the random plug-in to instantiate.
250 @param aAlgorithmParams The parameters that are specific to a particular
251 algorithm. This is for extendibility and will normally be null.
252 @return KErrNone if successful; otherwise, a system wide error code.
254 IMPORT_C static void CreateAsyncRandomL(MAsyncRandom*& aPlugin,
255 TUid aImplementationId,
256 const CCryptoParams* aAlgorithmParams);
260 Creates a new instance of a Hash object.
262 @param aPlugin A reference to a pointer that should be set to point to
264 @param aImplementationId The UID of the hash plug-in to instantiate.
265 @param aAlgorithmParams The parameters that are specific to a particular
266 algorithm. This is for extendibility and will normally be null.
267 @return KErrNone if successful; otherwise, a system wide error code.
269 IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin,
270 TUid aImplementationId,
271 const CCryptoParams* aAlgorithmParams);
277 Creates a new instance of a symmetric cipher
279 @param aPlugin A reference to a pointer that should be set to point to
280 the new asymmetric object.
281 @param aImplementationId The UID of the symmetric cipher plug-in to instantiate.
282 @param aKey The encryption/decryption key.
283 @param aAlgorithmParams The parameters that are specific to a particular
284 algorithm. This is for extendibility and will normally be null.
285 @return KErrNone if successful; otherwise, a system wide error code.
287 IMPORT_C static void CreateAsyncSymmetricCipherL(MAsyncSymmetricCipher*& aPlugin,
288 TUid aImplementationId,
292 const CCryptoParams* aAlgorithmParams);
296 Creates a new instance of an asymmetric cipher
298 @param aPlugin A reference to a pointer that should be set to point to
299 the new asymmetric cipher object.
300 @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate.
301 @param aKey The encryption/decryption key.
302 @param aAlgorithmParams The parameters that are specific to a particular
303 algorithm. This is for extendibility and will normally be null.
304 @return KErrNone if successful; otherwise, a system wide error code.
306 IMPORT_C static void CreateAsyncAsymmetricCipherL(MAsyncAsymmetricCipher*& aPlugin,
307 TUid aImplementationId,
309 const CCryptoParams* aAlgorithmParams);
315 Creates a new instance of an asymmetric signer.
317 @param aPlugin A reference to a pointer that should be set to point to
318 the new asymmetric signer object.
319 @param aImplementationId The UID of the signer plug-in to instantiate.
320 @param aKey The signing key.
321 @param aAlgorithmParams The parameters that are specific to a particular
322 algorithm. This is for extendibility and will normally be null.
323 @return KErrNone if successful; otherwise, a system wide error code.
325 IMPORT_C static void CreateAsyncAsymmetricSignerL(MAsyncSigner*& aPlugin,
326 TUid aImplementationId,
328 const CCryptoParams* aAlgorithmParams);
331 Creates a new instance of an asymmetric verifier.
333 @param aPlugin A reference to a pointer that should be set to point to
334 the new asymmetric verifier object.
335 @param aImplementationId The UID of the verifier plug-in to instantiate.
336 @param aKey The key to verify the signature with.
337 @param aAlgorithmParams The parameters that are specific to a particular
338 algorithm. This is for extendibility and will normally be null.
339 @return KErrNone if successful; otherwise, a system wide error code.
341 IMPORT_C static void CreateAsyncAsymmetricVerifierL(MAsyncVerifier*& aPlugin,
342 TUid aImplementationId,
344 const CCryptoParams* aAlgorithmParams);
349 Creates a new instance of a key agreement system.
351 @param aPlugin A reference to a pointer that should be set to point to
352 the new asymmetric key pair generator object.
353 @param aImplementationId The UID of the key agreement plug-in to instantiate.
354 @param aKey The private key to combine with the other parties public key
355 during the agreement.
356 @param aAlgorithmParams The parameters that are specific to a particular
357 algorithm. This is for extendibility and will normally be null.
358 @return KErrNone if successful; otherwise, a system wide error code.
360 IMPORT_C static void CreateAsyncKeyAgreementL(MAsyncKeyAgreement*& aPlugin,
361 TUid aImplementationId,
362 const CKey& aPrivateKey,
363 const CCryptoParams* aAlgorithmParams);
366 Creates a new instance of an asymmetric key pair generator.
368 @param aPlugin A reference to a pointer that should be set to point to
369 the new asymmetric key pair generator object.
370 @param aImplementationId The UID of the verifier plug-in to instantiate.
371 @param aAlgorithmParams The parameters that are specific to a particular
372 algorithm. This is for extendibility and will normally be null.
373 @return KErrNone if successful; otherwise, a system wide error code.
376 IMPORT_C static void CreateAsyncKeyPairGeneratorL(MAsyncKeyPairGenerator*& aPlugin,
377 TUid aImplementationId,
378 const CCryptoParams* aAlgorithmParams);
382 #endif // __PLUGINENTRY_H__