os/security/crypto/weakcryptospi/source/spi/legacyselector.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 * legacy plugin selector definition
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file
    22  @internalComponent
    23  @released
    24 */
    25 
    26 #ifndef __CRYPTOAPI_LEGACYSELECTOR_H__
    27 #define __CRYPTOAPI_LEGACYSELECTOR_H__
    28 
    29 #include <cryptospi/pluginselectorbase.h>
    30 #include <cryptospi/cryptospidef.h>
    31 #include <cryptospi/cryptoplugin.h>
    32 #include <cryptospi/cryptoparams.h>
    33 
    34 namespace CryptoSpi
    35 	{
    36 	class CHash;
    37 	class CRandom;
    38 	class CSymmetricCipher;
    39 	class CAsymmetricCipher;
    40 	class CSigner;
    41 	class CVerifier;
    42 	class CKeyAgreement;
    43 	class CSymmetricKeyGenerator;
    44 	class CKeyPairGenerator;
    45 	class CKey;
    46 	class CCryptoParams;
    47 	class CCharacteristicsAndPluginName;
    48 
    49 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT	
    50 	class CMac;
    51 #endif
    52 	
    53 	NONSHARABLE_CLASS(CLegacySelector): public CBase, public MPluginSelector
    54 		{
    55 	public:
    56 
    57 		/**
    58 		NewL create the legacy selector.
    59 		@return A pointer to a CLegacySelector instance
    60 		*/		
    61 		static CLegacySelector* NewL();
    62 		
    63 		/**
    64 		NewLC create the legacy selector.
    65 		@return A pointer to a CLegacySelector instance
    66 		*/				
    67 		static CLegacySelector* NewLC();
    68 		
    69 		/**
    70 		Destructor
    71 		*/
    72 		~CLegacySelector();
    73 		
    74 		//virtual function from MPluginSelector
    75 		virtual void CreateHashL(CHash*& aHash,
    76 											TUid aAlgorithmUid,
    77 											TUid aOperationMode,
    78 											const CKey* aKey,
    79 											const CCryptoParams* aAlgorithmParams);
    80 											
    81 		//virtual function from MPluginSelector						
    82 		virtual void CreateRandomL(CRandom*& aRandom,
    83 											TUid aAlgorithmUid,
    84 											const CCryptoParams* aAlgorithmParams);
    85 		
    86 		//virtual function from MPluginSelector
    87 		virtual void CreateSymmetricCipherL(CSymmetricCipher*& aCipher,
    88 											TUid aAlgorithmUid,
    89 											const CKey& aKey,
    90 											TUid aCryptoMode,
    91 											TUid aOperationMode,
    92 											TUid aPaddingMode,
    93 											const CCryptoParams* aAlgorithmParams);
    94 		
    95 		//virtual function from MPluginSelector
    96 		virtual void CreateAsymmetricCipherL(CAsymmetricCipher*& aCipher,
    97 											TUid aAlgorithmUid,
    98 											const CKey& aKey,
    99 											TUid aCryptoMode,
   100 											TUid aPaddingMode,									
   101 											const CCryptoParams* aAlgorithmParams);
   102 											
   103 		//virtual function from MPluginSelector
   104 		virtual void CreateSignerL(CSigner*& aSigner,
   105 											TUid aAlgorithmUid,
   106 											const CKey& aKey,
   107 											TUid aPaddingMode,
   108 											const CCryptoParams* aAlgorithmParams);
   109 		
   110 		//virtual function from MPluginSelector
   111 		virtual void CreateVerifierL(CVerifier*& aVerifier,
   112 											TUid aAlgorithmUid,
   113 											const CKey& aKey,
   114 											TUid aPaddingMode,
   115 											const CCryptoParams* aAlgorithmParams);
   116 
   117 		//virtual function from MPluginSelector
   118 		virtual void CreateKeyPairGeneratorL(CKeyPairGenerator*& aKeyPairGenerator,
   119 											TUid aKeyAlgorithmUid,
   120 											const CCryptoParams* aAlgorithmParams);
   121 
   122 		//virtual function from MPluginSelector
   123 		virtual void CreateKeyAgreementL(CKeyAgreement*& aKeyAgreement,
   124 											TUid aAlgorithmUid,
   125 											const CKey& aPrivateKey,
   126 											const CCryptoParams* aAlgorithmParams);
   127 		
   128 		//virtual function from MPluginSelector
   129 		virtual void CreateAsyncHashL(CAsyncHash*& aHash,
   130 										TUid aAlgorithmUid,
   131 										TUid aOperationMode,
   132 										const CKey* aKey,
   133 										const CCryptoParams* aAlgorithmParams);
   134 		
   135 		//virtual function from MPluginSelector
   136 		virtual void CreateAsyncRandomL(CAsyncRandom*& aRandom,
   137 										TUid aAlgorithmUid,
   138 										const CCryptoParams* aAlgorithmParams);
   139 
   140 		//virtual function from MPluginSelector
   141 		virtual void CreateAsyncSymmetricCipherL(CAsyncSymmetricCipher*& aCipher,
   142 										TUid aAlgorithmUid,
   143 										const CKey& aKey,
   144 										TUid aCryptoMode,
   145 										TUid aOperationMode,
   146 										TUid aPaddingMode,
   147 										const CCryptoParams* aAlgorithmParams);
   148 										
   149 		//virtual function from MPluginSelector
   150 		virtual void CreateAsyncAsymmetricCipherL(CAsyncAsymmetricCipher*& aCipher,
   151 										TUid aAlgorithmUid,
   152 										const CKey& aKey,
   153 										TUid aCryptoMode,
   154 										TUid aPaddingMode,																						
   155 										const CCryptoParams* aAlgorithmParams);
   156 										
   157 		//virtual function from MPluginSelector
   158 		virtual void CreateAsyncSignerL(CAsyncSigner*& aSigner,
   159 										TUid aAlgorithmUid,
   160 										const CKey& aKey,
   161 										TUid aPaddingMode,
   162 										const CCryptoParams* aAlgorithmParams);
   163 										
   164 		//virtual function from MPluginSelector		
   165 		virtual void CreateAsyncVerifierL(CAsyncVerifier*& aVerifier,
   166 										TUid aAlgorithmUid,
   167 										const CKey& aKey,
   168 										TUid aPaddingMode,
   169 										const CCryptoParams* aAlgorithmParams);
   170 										
   171 		//virtual function from MPluginSelector
   172 		virtual void CreateAsyncKeyPairGeneratorL(CAsyncKeyPairGenerator*& aKeyPairGenerator,
   173 										TUid aAlgorithmUid,
   174 										const CCryptoParams* aAlgorithmParams);
   175 										
   176 		//virtual function from MPluginSelector
   177 		virtual void CreateAsyncKeyAgreementL(CAsyncKeyAgreement*& aKeyAgreement,
   178 										TUid aAlgorithmUid,
   179 										const CKey& aPrivateKey,
   180 										const CCryptoParams* aAlgorithmParams);		
   181 				
   182 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT			
   183 		//virtual function from MPluginSelector	
   184 		virtual void CreateMacL(CMac*& aMac,
   185 								const TUid aAlgorithmUid,
   186 								const CKey& aKey,
   187 								const CCryptoParams* aAlgorithmParams);
   188 				
   189 		//virtual function from MPluginSelector
   190 		virtual void CreateAsyncMacL(CAsyncMac*& aMac,
   191 								const TUid aAlgorithmUid,
   192 								const CKey& aKey,
   193 								const CCryptoParams* aAlgorithmParams);
   194 		
   195 		//virtual function from MPluginSelector
   196 		virtual void CreateHashL(CHash*& aHash,
   197 								TUid aAlgorithmUid,
   198 								const CCryptoParams* aAlgorithmParams);
   199 
   200 		//virtual function from MPluginSelector
   201 		virtual void CreateAsyncHashL(CAsyncHash*& aAsyncHash, 
   202 								TUid aAlgorithmUid,
   203 								const CCryptoParams* aAlgorithmParams);
   204 #endif				
   205 	private:
   206 		//Constructor
   207 		CLegacySelector();
   208 				
   209 		/**
   210 		Find an implemenation of an algorithmUid
   211 		@param aAlgorithmUid the alogorithm Uid
   212 		@param aImplementationId the implementation Uid
   213 		@param aDllIndex the index of the plugin dll
   214 		@return KErrNone if successful; otherwise, a system wide error code.
   215 		*/
   216 		TInt FindPlugin(TUid aAlgorithmUid, TUid& aImplementationId, TInt& aDllIndex);
   217 		TInt FindPlugin(TUid aAlgorithmUid, TUid& aImplementationId, TFileName& aDllName);
   218 	private:
   219 		/**
   220 		Array of the characteristics of an interface
   221 		*/
   222 		RPointerArray<CCharacteristicsAndPluginName> iCharacteristicsAndDllIndex;
   223 		
   224 		/**
   225 		The next characteristic index to try
   226 		*/
   227 		TInt iNextCharacteristic;
   228 		};
   229 	}
   230 
   231 #endif //__CRYPTOAPI_LEGACYSELECTOR_H__
   232 
   233 
   234 
   235 
   236 
   237