sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: sl@0: #ifndef __PLUGINENTRY_H__ sl@0: #define __PLUGINENTRY_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "keys.h" sl@0: #include sl@0: #include sl@0: #include "symmetriccipherplugin.h" sl@0: #include "asymmetriccipherplugin.h" sl@0: #include "signerplugin.h" sl@0: #include "verifierplugin.h" sl@0: #include "keypairgeneratorplugin.h" sl@0: #include "keyagreementplugin.h" sl@0: sl@0: sl@0: #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT sl@0: #include sl@0: #endif sl@0: sl@0: using namespace CryptoSpi; sl@0: sl@0: class CCryptoPluginEntry sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: * Enumerates the set of plug-ins supported by the module for a given interface sl@0: * e.g. all of the hash plug-ins. sl@0: * sl@0: * @param aInterface The UID of the plug-in interface type. If the UID is not recognised sl@0: * then the NULL pointer must be returned. sl@0: * @param aNumPlugins The number of plug-in characteristics objects in the result. sl@0: * @param A pointer to an array of characteristics objects. The SPI casts this to sl@0: * the expected sub-class of TCharacteristics for the specified interface UID. sl@0: */ sl@0: IMPORT_C static const TCharacteristics** Enumerate(TUid aInterface, TInt& aNumPlugins); sl@0: sl@0: /** sl@0: * Retrieves the extended characteristics about a given implementation of an sl@0: * algorithm within the current plug-in DLL. sl@0: * sl@0: * @param aImplementationUid The UID of the implementation requested sl@0: * @return A pointer to the extended characteristics, allocated on the heap, sl@0: * which should be deleted once the caller has finished with it. sl@0: */ sl@0: IMPORT_C static void GetExtendedCharacteristicsL(TUid aImplementationUid, CExtendedCharacteristics*&); sl@0: sl@0: /** sl@0: * Creates a new instance of an asymmetric cipher sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric cipher object. sl@0: * @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate. sl@0: * @param aKey The encryption/decryption key. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateAsymmetricCipherL(MAsymmetricCipher*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aKey, sl@0: TUid aCryptoMode, sl@0: TUid aPaddingMode, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: sl@0: /** sl@0: * Creates a new instance of an asymmetric signer. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric signer object. sl@0: * @param aImplementationId The UID of the signer plug-in to instantiate. sl@0: * @param aKey The signing key. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateAsymmetricSignerL(MSigner*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aKey, sl@0: TUid aPaddingMode, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: sl@0: /** sl@0: * Creates a new instance of an asymmetric verifier. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric verifier object. sl@0: * @param aImplementationId The UID of the verifier plug-in to instantiate. sl@0: * @param aKey The key to verify the signature with. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateAsymmetricVerifierL(MVerifier*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aKey, sl@0: TUid aPaddingMode, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: sl@0: /** sl@0: * @deprecated sl@0: * sl@0: * Creates a new instance of a Hash object. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new hash object. sl@0: * @param aImplementationId The UID of the hash plug-in to instantiate. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateHashL(MHash*& aPlugin, sl@0: TUid aImplementationId, sl@0: TUid aOperationMode, sl@0: const CKey* aKey, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: sl@0: /** sl@0: * Creates a new instance of a key agreement system. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric key pair generator object. sl@0: * @param aImplementationId The UID of the key agreement plug-in to instantiate. sl@0: * @param aPrivateKey The private key to combine with the other parties public key sl@0: * during the agreement. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateKeyAgreementL(MKeyAgreement*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aPrivateKey, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: sl@0: /** sl@0: * Creates a new instance of an asymmetric key pair generator. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric key pair generator object. sl@0: * @param aImplementationId The UID of the verifier plug-in to instantiate. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateKeyPairGeneratorL(MKeyPairGenerator*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: sl@0: /** sl@0: * Creates a new instance of a Random object. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to the new random object. sl@0: * @param aImplementationId The UID of the random plug-in to instantiate. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateRandomL(MRandom*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: sl@0: /** sl@0: * Creates a new instance of a symmetric cipher sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric object. sl@0: * @param aImplementationId The UID of the symmetric cipher plug-in to instantiate. sl@0: * @param aKey The encryption/decryption key. sl@0: * @param aCryptoMode Encrypt or Decrypt. sl@0: * @param aOperationMode the block cipher mode to use ECB, CBC, CTR etc sl@0: * @param aPadding the padding scheme to use. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateSymmetricCipherL(MSymmetricCipher*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aKey, sl@0: TUid aCryptoMode, sl@0: TUid aOperationMode, sl@0: TUid aPadding, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: sl@0: /** sl@0: * Creates a new instance of an asymmetric cipher sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric cipher object. sl@0: * @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate. sl@0: * @param aKey The encryption/decryption key. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncAsymmetricCipherL(MAsyncAsymmetricCipher*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aKey, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: /** sl@0: * Creates a new instance of an asymmetric signer. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric signer object. sl@0: * @param aImplementationId The UID of the signer plug-in to instantiate. sl@0: * @param aKey The signing key. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncAsymmetricSignerL(MAsyncSigner*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aKey, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: /** sl@0: * Creates a new instance of an asymmetric verifier. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric verifier object. sl@0: * @param aImplementationId The UID of the verifier plug-in to instantiate. sl@0: * @param aKey The key to verify the signature with. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncAsymmetricVerifierL(MAsyncVerifier*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aKey, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: /** sl@0: * @deprecated sl@0: * sl@0: * Creates a new instance of a Hash object. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new hash object. sl@0: * @param aImplementationId The UID of the hash plug-in to instantiate. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin, sl@0: TUid aImplementationId, sl@0: TUid aOperationMode, sl@0: const CKey* aKey, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: /** sl@0: * Creates a new instance of a key agreement system. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric key pair generator object. sl@0: * @param aImplementationId The UID of the key agreement plug-in to instantiate. sl@0: * @param aKey The private key to combine with the other parties public key sl@0: * during the agreement. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncKeyAgreementL(MAsyncKeyAgreement*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aPrivateKey, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: /** sl@0: * Creates a new instance of an asymmetric key pair generator. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric key pair generator object. sl@0: * @param aImplementationId The UID of the verifier plug-in to instantiate. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncKeyPairGeneratorL(MAsyncKeyPairGenerator*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: /** sl@0: * Creates a new instance of a Random object. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to the new random object. sl@0: * @param aImplementationId The UID of the random plug-in to instantiate. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncRandomL(MAsyncRandom*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: /** sl@0: * Creates a new instance of a symmetric cipher sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new asymmetric object. sl@0: * @param aImplementationId The UID of the symmetric cipher plug-in to instantiate. sl@0: * @param aKey The encryption/decryption key. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncSymmetricCipherL(MAsyncSymmetricCipher*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CKey& aKey, sl@0: TUid aMode, sl@0: TUid aPadding, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT sl@0: sl@0: /** sl@0: * Creates a new instance of a Hash object. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new hash object. sl@0: * @param aImplementationId The UID of the hash plug-in to instantiate. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateHashL(MHash*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: /** sl@0: * Creates a new instance of a Hash object. sl@0: * sl@0: * @param aPlugin A reference to a pointer that should be set to point to sl@0: * the new hash object. sl@0: * @param aImplementationId The UID of the hash plug-in to instantiate. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin, sl@0: TUid aImplementationId, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: /** sl@0: * Create a CMac instance (if implementation is software based) sl@0: * sl@0: * @param aMac The pointer to CMac sl@0: * @param aImplementationId The specific hash or cipher plug-in to instantiate.. sl@0: * @param aKey The key for calculating message authentication code value. sl@0: * Based on the algorithm used we will define the properties of the key. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: */ sl@0: IMPORT_C static void CreateMacL(MMac*& aPlugin, sl@0: const TUid aImplementationId, sl@0: const CKey& aKey, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: sl@0: /** sl@0: * Create a CAsyncMac instance sl@0: * sl@0: * @param aMac The pointer to CAsyncMac sl@0: * @param aImplementationId The specific hash or cipher plug-in to instantiate.. sl@0: * @param aKey The key for calculating message authentication code value. sl@0: * Based on the algorithm used we will define the properties of the key. sl@0: * @param aAlgorithmParams The parameters that are specific to a particular sl@0: * algorithm. This is for extendibility and will normally be null. sl@0: * @return KErrNone if successful; otherwise, a system wide error code. sl@0: sl@0: IMPORT_C static void CreateAsyncMacL(MAsyncMac*& aPlugin, sl@0: const TUid aImplementationId, sl@0: const CKey& aKey, sl@0: const CCryptoParams* aAlgorithmParams); sl@0: */ sl@0: sl@0: #endif sl@0: sl@0: }; sl@0: sl@0: sl@0: #endif // __PLUGINENTRY_H__