1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/pluginentry.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,414 @@
1.4 +/*
1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @internalComponent
1.25 + @released
1.26 +*/
1.27 +
1.28 +#ifndef __PLUGINENTRY_H__
1.29 +#define __PLUGINENTRY_H__
1.30 +
1.31 +#include <cryptospi/cryptoparams.h>
1.32 +#include <e32cmn.h>
1.33 +#include <cryptospi/cryptospidef.h>
1.34 +#include "keys.h"
1.35 +#include <cryptospi/hashplugin.h>
1.36 +#include <cryptospi/randomplugin.h>
1.37 +#include "symmetriccipherplugin.h"
1.38 +#include "asymmetriccipherplugin.h"
1.39 +#include "signerplugin.h"
1.40 +#include "verifierplugin.h"
1.41 +#include "keypairgeneratorplugin.h"
1.42 +#include "keyagreementplugin.h"
1.43 +
1.44 +
1.45 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
1.46 + #include <cryptospi/macplugin.h>
1.47 +#endif
1.48 +
1.49 +using namespace CryptoSpi;
1.50 +
1.51 +class CCryptoPluginEntry
1.52 + {
1.53 +public:
1.54 +
1.55 + /**
1.56 + * Enumerates the set of plug-ins supported by the module for a given interface
1.57 + * e.g. all of the hash plug-ins.
1.58 + *
1.59 + * @param aInterface The UID of the plug-in interface type. If the UID is not recognised
1.60 + * then the NULL pointer must be returned.
1.61 + * @param aNumPlugins The number of plug-in characteristics objects in the result.
1.62 + * @param A pointer to an array of characteristics objects. The SPI casts this to
1.63 + * the expected sub-class of TCharacteristics for the specified interface UID.
1.64 + */
1.65 + IMPORT_C static const TCharacteristics** Enumerate(TUid aInterface, TInt& aNumPlugins);
1.66 +
1.67 + /**
1.68 + * Retrieves the extended characteristics about a given implementation of an
1.69 + * algorithm within the current plug-in DLL.
1.70 + *
1.71 + * @param aImplementationUid The UID of the implementation requested
1.72 + * @return A pointer to the extended characteristics, allocated on the heap,
1.73 + * which should be deleted once the caller has finished with it.
1.74 + */
1.75 + IMPORT_C static void GetExtendedCharacteristicsL(TUid aImplementationUid, CExtendedCharacteristics*&);
1.76 +
1.77 + /**
1.78 + * Creates a new instance of an asymmetric cipher
1.79 + *
1.80 + * @param aPlugin A reference to a pointer that should be set to point to
1.81 + * the new asymmetric cipher object.
1.82 + * @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate.
1.83 + * @param aKey The encryption/decryption key.
1.84 + * @param aAlgorithmParams The parameters that are specific to a particular
1.85 + * algorithm. This is for extendibility and will normally be null.
1.86 + * @return KErrNone if successful; otherwise, a system wide error code.
1.87 + */
1.88 + IMPORT_C static void CreateAsymmetricCipherL(MAsymmetricCipher*& aPlugin,
1.89 + TUid aImplementationId,
1.90 + const CKey& aKey,
1.91 + TUid aCryptoMode,
1.92 + TUid aPaddingMode,
1.93 + const CCryptoParams* aAlgorithmParams);
1.94 +
1.95 + /**
1.96 + * Creates a new instance of an asymmetric signer.
1.97 + *
1.98 + * @param aPlugin A reference to a pointer that should be set to point to
1.99 + * the new asymmetric signer object.
1.100 + * @param aImplementationId The UID of the signer plug-in to instantiate.
1.101 + * @param aKey The signing key.
1.102 + * @param aAlgorithmParams The parameters that are specific to a particular
1.103 + * algorithm. This is for extendibility and will normally be null.
1.104 + * @return KErrNone if successful; otherwise, a system wide error code.
1.105 + */
1.106 + IMPORT_C static void CreateAsymmetricSignerL(MSigner*& aPlugin,
1.107 + TUid aImplementationId,
1.108 + const CKey& aKey,
1.109 + TUid aPaddingMode,
1.110 + const CCryptoParams* aAlgorithmParams);
1.111 +
1.112 + /**
1.113 + * Creates a new instance of an asymmetric verifier.
1.114 + *
1.115 + * @param aPlugin A reference to a pointer that should be set to point to
1.116 + * the new asymmetric verifier object.
1.117 + * @param aImplementationId The UID of the verifier plug-in to instantiate.
1.118 + * @param aKey The key to verify the signature with.
1.119 + * @param aAlgorithmParams The parameters that are specific to a particular
1.120 + * algorithm. This is for extendibility and will normally be null.
1.121 + * @return KErrNone if successful; otherwise, a system wide error code.
1.122 + */
1.123 + IMPORT_C static void CreateAsymmetricVerifierL(MVerifier*& aPlugin,
1.124 + TUid aImplementationId,
1.125 + const CKey& aKey,
1.126 + TUid aPaddingMode,
1.127 + const CCryptoParams* aAlgorithmParams);
1.128 +
1.129 + /**
1.130 + * @deprecated
1.131 + *
1.132 + * Creates a new instance of a Hash object.
1.133 + *
1.134 + * @param aPlugin A reference to a pointer that should be set to point to
1.135 + * the new hash object.
1.136 + * @param aImplementationId The UID of the hash plug-in to instantiate.
1.137 + * @param aAlgorithmParams The parameters that are specific to a particular
1.138 + * algorithm. This is for extendibility and will normally be null.
1.139 + * @return KErrNone if successful; otherwise, a system wide error code.
1.140 + */
1.141 + IMPORT_C static void CreateHashL(MHash*& aPlugin,
1.142 + TUid aImplementationId,
1.143 + TUid aOperationMode,
1.144 + const CKey* aKey,
1.145 + const CCryptoParams* aAlgorithmParams);
1.146 +
1.147 + /**
1.148 + * Creates a new instance of a key agreement system.
1.149 + *
1.150 + * @param aPlugin A reference to a pointer that should be set to point to
1.151 + * the new asymmetric key pair generator object.
1.152 + * @param aImplementationId The UID of the key agreement plug-in to instantiate.
1.153 + * @param aPrivateKey The private key to combine with the other parties public key
1.154 + * during the agreement.
1.155 + * @param aAlgorithmParams The parameters that are specific to a particular
1.156 + * algorithm. This is for extendibility and will normally be null.
1.157 + * @return KErrNone if successful; otherwise, a system wide error code.
1.158 + */
1.159 + IMPORT_C static void CreateKeyAgreementL(MKeyAgreement*& aPlugin,
1.160 + TUid aImplementationId,
1.161 + const CKey& aPrivateKey,
1.162 + const CCryptoParams* aAlgorithmParams);
1.163 +
1.164 + /**
1.165 + * Creates a new instance of an asymmetric key pair generator.
1.166 + *
1.167 + * @param aPlugin A reference to a pointer that should be set to point to
1.168 + * the new asymmetric key pair generator object.
1.169 + * @param aImplementationId The UID of the verifier plug-in to instantiate.
1.170 + * @param aAlgorithmParams The parameters that are specific to a particular
1.171 + * algorithm. This is for extendibility and will normally be null.
1.172 + * @return KErrNone if successful; otherwise, a system wide error code.
1.173 + */
1.174 + IMPORT_C static void CreateKeyPairGeneratorL(MKeyPairGenerator*& aPlugin,
1.175 + TUid aImplementationId,
1.176 + const CCryptoParams* aAlgorithmParams);
1.177 +
1.178 + /**
1.179 + * Creates a new instance of a Random object.
1.180 + *
1.181 + * @param aPlugin A reference to a pointer that should be set to point to the new random object.
1.182 + * @param aImplementationId The UID of the random plug-in to instantiate.
1.183 + * @param aAlgorithmParams The parameters that are specific to a particular
1.184 + * algorithm. This is for extendibility and will normally be null.
1.185 + * @return KErrNone if successful; otherwise, a system wide error code.
1.186 + */
1.187 + IMPORT_C static void CreateRandomL(MRandom*& aPlugin,
1.188 + TUid aImplementationId,
1.189 + const CCryptoParams* aAlgorithmParams);
1.190 +
1.191 + /**
1.192 + * Creates a new instance of a symmetric cipher
1.193 + *
1.194 + * @param aPlugin A reference to a pointer that should be set to point to
1.195 + * the new asymmetric object.
1.196 + * @param aImplementationId The UID of the symmetric cipher plug-in to instantiate.
1.197 + * @param aKey The encryption/decryption key.
1.198 + * @param aCryptoMode Encrypt or Decrypt.
1.199 + * @param aOperationMode the block cipher mode to use ECB, CBC, CTR etc
1.200 + * @param aPadding the padding scheme to use.
1.201 + * @param aAlgorithmParams The parameters that are specific to a particular
1.202 + * algorithm. This is for extendibility and will normally be null.
1.203 + * @return KErrNone if successful; otherwise, a system wide error code.
1.204 + */
1.205 + IMPORT_C static void CreateSymmetricCipherL(MSymmetricCipher*& aPlugin,
1.206 + TUid aImplementationId,
1.207 + const CKey& aKey,
1.208 + TUid aCryptoMode,
1.209 + TUid aOperationMode,
1.210 + TUid aPadding,
1.211 + const CCryptoParams* aAlgorithmParams);
1.212 +
1.213 + /**
1.214 + * Creates a new instance of an asymmetric cipher
1.215 + *
1.216 + * @param aPlugin A reference to a pointer that should be set to point to
1.217 + * the new asymmetric cipher object.
1.218 + * @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate.
1.219 + * @param aKey The encryption/decryption key.
1.220 + * @param aAlgorithmParams The parameters that are specific to a particular
1.221 + * algorithm. This is for extendibility and will normally be null.
1.222 + * @return KErrNone if successful; otherwise, a system wide error code.
1.223 +
1.224 + IMPORT_C static void CreateAsyncAsymmetricCipherL(MAsyncAsymmetricCipher*& aPlugin,
1.225 + TUid aImplementationId,
1.226 + const CKey& aKey,
1.227 + const CCryptoParams* aAlgorithmParams);
1.228 + */
1.229 +
1.230 + /**
1.231 + * Creates a new instance of an asymmetric signer.
1.232 + *
1.233 + * @param aPlugin A reference to a pointer that should be set to point to
1.234 + * the new asymmetric signer object.
1.235 + * @param aImplementationId The UID of the signer plug-in to instantiate.
1.236 + * @param aKey The signing key.
1.237 + * @param aAlgorithmParams The parameters that are specific to a particular
1.238 + * algorithm. This is for extendibility and will normally be null.
1.239 + * @return KErrNone if successful; otherwise, a system wide error code.
1.240 +
1.241 + IMPORT_C static void CreateAsyncAsymmetricSignerL(MAsyncSigner*& aPlugin,
1.242 + TUid aImplementationId,
1.243 + const CKey& aKey,
1.244 + const CCryptoParams* aAlgorithmParams);
1.245 + */
1.246 +
1.247 + /**
1.248 + * Creates a new instance of an asymmetric verifier.
1.249 + *
1.250 + * @param aPlugin A reference to a pointer that should be set to point to
1.251 + * the new asymmetric verifier object.
1.252 + * @param aImplementationId The UID of the verifier plug-in to instantiate.
1.253 + * @param aKey The key to verify the signature with.
1.254 + * @param aAlgorithmParams The parameters that are specific to a particular
1.255 + * algorithm. This is for extendibility and will normally be null.
1.256 + * @return KErrNone if successful; otherwise, a system wide error code.
1.257 +
1.258 + IMPORT_C static void CreateAsyncAsymmetricVerifierL(MAsyncVerifier*& aPlugin,
1.259 + TUid aImplementationId,
1.260 + const CKey& aKey,
1.261 + const CCryptoParams* aAlgorithmParams);
1.262 + */
1.263 +
1.264 + /**
1.265 + * @deprecated
1.266 + *
1.267 + * Creates a new instance of a Hash object.
1.268 + *
1.269 + * @param aPlugin A reference to a pointer that should be set to point to
1.270 + * the new hash object.
1.271 + * @param aImplementationId The UID of the hash plug-in to instantiate.
1.272 + * @param aAlgorithmParams The parameters that are specific to a particular
1.273 + * algorithm. This is for extendibility and will normally be null.
1.274 + * @return KErrNone if successful; otherwise, a system wide error code.
1.275 +
1.276 + IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin,
1.277 + TUid aImplementationId,
1.278 + TUid aOperationMode,
1.279 + const CKey* aKey,
1.280 + const CCryptoParams* aAlgorithmParams);
1.281 + */
1.282 +
1.283 + /**
1.284 + * Creates a new instance of a key agreement system.
1.285 + *
1.286 + * @param aPlugin A reference to a pointer that should be set to point to
1.287 + * the new asymmetric key pair generator object.
1.288 + * @param aImplementationId The UID of the key agreement plug-in to instantiate.
1.289 + * @param aKey The private key to combine with the other parties public key
1.290 + * during the agreement.
1.291 + * @param aAlgorithmParams The parameters that are specific to a particular
1.292 + * algorithm. This is for extendibility and will normally be null.
1.293 + * @return KErrNone if successful; otherwise, a system wide error code.
1.294 +
1.295 + IMPORT_C static void CreateAsyncKeyAgreementL(MAsyncKeyAgreement*& aPlugin,
1.296 + TUid aImplementationId,
1.297 + const CKey& aPrivateKey,
1.298 + const CCryptoParams* aAlgorithmParams);
1.299 + */
1.300 +
1.301 + /**
1.302 + * Creates a new instance of an asymmetric key pair generator.
1.303 + *
1.304 + * @param aPlugin A reference to a pointer that should be set to point to
1.305 + * the new asymmetric key pair generator object.
1.306 + * @param aImplementationId The UID of the verifier plug-in to instantiate.
1.307 + * @param aAlgorithmParams The parameters that are specific to a particular
1.308 + * algorithm. This is for extendibility and will normally be null.
1.309 + * @return KErrNone if successful; otherwise, a system wide error code.
1.310 +
1.311 + IMPORT_C static void CreateAsyncKeyPairGeneratorL(MAsyncKeyPairGenerator*& aPlugin,
1.312 + TUid aImplementationId,
1.313 + const CCryptoParams* aAlgorithmParams);
1.314 + */
1.315 +
1.316 + /**
1.317 + * Creates a new instance of a Random object.
1.318 + *
1.319 + * @param aPlugin A reference to a pointer that should be set to point to the new random object.
1.320 + * @param aImplementationId The UID of the random plug-in to instantiate.
1.321 + * @param aAlgorithmParams The parameters that are specific to a particular
1.322 + * algorithm. This is for extendibility and will normally be null.
1.323 + * @return KErrNone if successful; otherwise, a system wide error code.
1.324 +
1.325 + IMPORT_C static void CreateAsyncRandomL(MAsyncRandom*& aPlugin,
1.326 + TUid aImplementationId,
1.327 + const CCryptoParams* aAlgorithmParams);
1.328 + */
1.329 +
1.330 + /**
1.331 + * Creates a new instance of a symmetric cipher
1.332 + *
1.333 + * @param aPlugin A reference to a pointer that should be set to point to
1.334 + * the new asymmetric object.
1.335 + * @param aImplementationId The UID of the symmetric cipher plug-in to instantiate.
1.336 + * @param aKey The encryption/decryption key.
1.337 + * @param aAlgorithmParams The parameters that are specific to a particular
1.338 + * algorithm. This is for extendibility and will normally be null.
1.339 + * @return KErrNone if successful; otherwise, a system wide error code.
1.340 +
1.341 + IMPORT_C static void CreateAsyncSymmetricCipherL(MAsyncSymmetricCipher*& aPlugin,
1.342 + TUid aImplementationId,
1.343 + const CKey& aKey,
1.344 + TUid aMode,
1.345 + TUid aPadding,
1.346 + const CCryptoParams* aAlgorithmParams);
1.347 + */
1.348 +
1.349 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
1.350 +
1.351 + /**
1.352 + * Creates a new instance of a Hash object.
1.353 + *
1.354 + * @param aPlugin A reference to a pointer that should be set to point to
1.355 + * the new hash object.
1.356 + * @param aImplementationId The UID of the hash plug-in to instantiate.
1.357 + * @param aAlgorithmParams The parameters that are specific to a particular
1.358 + * algorithm. This is for extendibility and will normally be null.
1.359 + * @return KErrNone if successful; otherwise, a system wide error code.
1.360 + */
1.361 + IMPORT_C static void CreateHashL(MHash*& aPlugin,
1.362 + TUid aImplementationId,
1.363 + const CCryptoParams* aAlgorithmParams);
1.364 + /**
1.365 + * Creates a new instance of a Hash object.
1.366 + *
1.367 + * @param aPlugin A reference to a pointer that should be set to point to
1.368 + * the new hash object.
1.369 + * @param aImplementationId The UID of the hash plug-in to instantiate.
1.370 + * @param aAlgorithmParams The parameters that are specific to a particular
1.371 + * algorithm. This is for extendibility and will normally be null.
1.372 + * @return KErrNone if successful; otherwise, a system wide error code.
1.373 +
1.374 + IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin,
1.375 + TUid aImplementationId,
1.376 + const CCryptoParams* aAlgorithmParams);
1.377 + */
1.378 +
1.379 + /**
1.380 + * Create a CMac instance (if implementation is software based)
1.381 + *
1.382 + * @param aMac The pointer to CMac
1.383 + * @param aImplementationId The specific hash or cipher plug-in to instantiate..
1.384 + * @param aKey The key for calculating message authentication code value.
1.385 + * Based on the algorithm used we will define the properties of the key.
1.386 + * @param aAlgorithmParams The parameters that are specific to a particular
1.387 + * algorithm. This is for extendibility and will normally be null.
1.388 + * @return KErrNone if successful; otherwise, a system wide error code.
1.389 + */
1.390 + IMPORT_C static void CreateMacL(MMac*& aPlugin,
1.391 + const TUid aImplementationId,
1.392 + const CKey& aKey,
1.393 + const CCryptoParams* aAlgorithmParams);
1.394 +
1.395 + /**
1.396 + * Create a CAsyncMac instance
1.397 + *
1.398 + * @param aMac The pointer to CAsyncMac
1.399 + * @param aImplementationId The specific hash or cipher plug-in to instantiate..
1.400 + * @param aKey The key for calculating message authentication code value.
1.401 + * Based on the algorithm used we will define the properties of the key.
1.402 + * @param aAlgorithmParams The parameters that are specific to a particular
1.403 + * algorithm. This is for extendibility and will normally be null.
1.404 + * @return KErrNone if successful; otherwise, a system wide error code.
1.405 +
1.406 + IMPORT_C static void CreateAsyncMacL(MAsyncMac*& aPlugin,
1.407 + const TUid aImplementationId,
1.408 + const CKey& aKey,
1.409 + const CCryptoParams* aAlgorithmParams);
1.410 + */
1.411 +
1.412 +#endif
1.413 +
1.414 + };
1.415 +
1.416 +
1.417 +#endif // __PLUGINENTRY_H__