crypto/weakcryptospi/test/tplugins/inc/pluginentry.h
changeset 8 35751d3474b7
child 43 2f10d260163b
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     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 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22  @released
       
    23 */
       
    24 
       
    25 #ifndef __PLUGINENTRY_H__
       
    26 #define __PLUGINENTRY_H__
       
    27 
       
    28 #include <cryptospi/cryptoparams.h>
       
    29 #include <e32cmn.h>
       
    30 #include <cryptospi/cryptospidef.h>
       
    31 #include "keys.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"
       
    40 
       
    41 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
       
    42 #include <cryptospi/macplugin.h>
       
    43 #endif
       
    44 
       
    45 using namespace CryptoSpi;
       
    46 
       
    47 class CCryptoPluginEntry
       
    48 	{
       
    49 public:
       
    50 
       
    51 	/**
       
    52 	Enumerates the set of plug-ins supported by the module for a given interface
       
    53 	e.g. all of the hash plug-ins.
       
    54 
       
    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.
       
    60 	*/
       
    61 	IMPORT_C static const TCharacteristics** Enumerate(TUid aInterface, TInt& aNumPlugins);
       
    62 
       
    63 	/**
       
    64     Retrieves the extended characteristics about a given implementation of an
       
    65     algorithm within the current plug-in DLL.
       
    66 
       
    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.
       
    70 	*/
       
    71 	IMPORT_C static void GetExtendedCharacteristicsL(TUid aImplementationUid, CExtendedCharacteristics*&);
       
    72 
       
    73 	/**
       
    74 	Creates a new instance of an asymmetric cipher
       
    75 
       
    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.
       
    83 	*/
       
    84 	IMPORT_C static void CreateAsymmetricCipherL(MAsymmetricCipher*& aPlugin,
       
    85 												TUid aImplementationId,
       
    86 												const CKey& aKey,
       
    87 												TUid aCryptoMode,
       
    88 												TUid aPaddingMode,
       
    89 												const CCryptoParams* aAlgorithmParams);
       
    90 
       
    91 	/**
       
    92 	Creates a new instance of an asymmetric signer.
       
    93 
       
    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.
       
   101 	*/
       
   102 	IMPORT_C static void CreateAsymmetricSignerL(MSigner*& aPlugin,
       
   103 												TUid aImplementationId,
       
   104 												const CKey& aKey,
       
   105 												TUid aPaddingMode,
       
   106 												const CCryptoParams* aAlgorithmParams);
       
   107 
       
   108 	/**
       
   109 	Creates a new instance of an asymmetric verifier.
       
   110 
       
   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.
       
   118 	*/
       
   119 	IMPORT_C static void CreateAsymmetricVerifierL(MVerifier*& aPlugin,
       
   120 												TUid aImplementationId,
       
   121 												const CKey& aKey,
       
   122 												TUid aPaddingMode,
       
   123 												const CCryptoParams* aAlgorithmParams);
       
   124 
       
   125 
       
   126 									
       
   127 	/**
       
   128 	Creates a new instance of a Hash object.
       
   129 
       
   130 	@param aPlugin A reference to a pointer that should be set to point to 
       
   131 	the new hash object.
       
   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.
       
   136 	*/
       
   137 	IMPORT_C static void CreateHashL(MHash*& aPlugin,
       
   138 							TUid aImplementationId,
       
   139 							TUid aOperationMode,
       
   140 							const CKey* aKey,
       
   141 							const CCryptoParams* aAlgorithmParams);
       
   142 
       
   143 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
       
   144 	/**
       
   145 	 * Creates a new instance of a Hash object.
       
   146 	 *
       
   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.
       
   153 	 */
       
   154 	IMPORT_C static void CreateHashL(MHash*& aPlugin,
       
   155 									 TUid aImplementationId,
       
   156 									 const CCryptoParams* aAlgorithmParams);
       
   157 #endif
       
   158 
       
   159 	/**
       
   160 	Creates a new instance of a Random object.
       
   161 
       
   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.
       
   167 	*/
       
   168 	IMPORT_C static void CreateRandomL(MRandom*& aPlugin,
       
   169 									TUid aImplementationId,
       
   170 									const CCryptoParams* aAlgorithmParams);
       
   171 
       
   172 
       
   173 	/**
       
   174 	Creates a new instance of a key agreement system.
       
   175 
       
   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.		   
       
   184 	*/
       
   185 	IMPORT_C static void CreateKeyAgreementL(MKeyAgreement*& aPlugin,
       
   186 											TUid aImplementationId,
       
   187 											const CKey& aPrivateKey,
       
   188 											const CCryptoParams* aAlgorithmParams);
       
   189 
       
   190 	/**
       
   191 	Creates a new instance of an asymmetric key pair generator.
       
   192 
       
   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.
       
   199 	*/
       
   200 	IMPORT_C static void CreateKeyPairGeneratorL(MKeyPairGenerator*& aPlugin,
       
   201 												TUid aImplementationId,
       
   202 												const CCryptoParams* aAlgorithmParams);
       
   203 									
       
   204 	/**
       
   205 	Creates a new instance of a symmetric cipher
       
   206 
       
   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.
       
   217 	*/
       
   218 	IMPORT_C static void CreateSymmetricCipherL(MSymmetricCipher*& aPlugin,
       
   219 											TUid aImplementationId,
       
   220 											const CKey& aKey,
       
   221 											TUid aCryptoMode,
       
   222 											TUid aOperationMode,
       
   223 											TUid aPadding,
       
   224 											const CCryptoParams* aAlgorithmParams);
       
   225 
       
   226 #ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
       
   227 	/**
       
   228 	 * Create a CMac instance (if implementation is software based)
       
   229 	 *
       
   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.
       
   237 	 */
       
   238 	IMPORT_C static void CreateMacL(MMac*& aPlugin,
       
   239 									const TUid aImplementationId,
       
   240 									const CKey& aKey,
       
   241 									const CCryptoParams* aAlgorithmParams);
       
   242 #endif
       
   243 	
       
   244 	
       
   245 	/**
       
   246 	Creates a new instance of a Random object.
       
   247 
       
   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.
       
   253 	
       
   254 	IMPORT_C static void CreateAsyncRandomL(MAsyncRandom*& aPlugin,
       
   255 									TUid aImplementationId,
       
   256 									const CCryptoParams* aAlgorithmParams);
       
   257 									
       
   258 	*/										
       
   259 	/**
       
   260 	Creates a new instance of a Hash object.
       
   261 
       
   262 	@param aPlugin A reference to a pointer that should be set to point to 
       
   263 	the new hash object.
       
   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.
       
   268 	
       
   269 	IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin,
       
   270 							TUid aImplementationId,
       
   271 							const CCryptoParams* aAlgorithmParams);
       
   272 
       
   273 	*/
       
   274 
       
   275 
       
   276 	/**
       
   277 	Creates a new instance of a symmetric cipher
       
   278 
       
   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.
       
   286 
       
   287 	IMPORT_C static void CreateAsyncSymmetricCipherL(MAsyncSymmetricCipher*& aPlugin,
       
   288 											TUid aImplementationId,
       
   289 											const CKey& aKey,
       
   290 											TUid aMode,
       
   291 											TUid aPadding,
       
   292 											const CCryptoParams* aAlgorithmParams);
       
   293 
       
   294 	*/
       
   295 	/**
       
   296 	Creates a new instance of an asymmetric cipher
       
   297 
       
   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.
       
   305 	
       
   306 	IMPORT_C static void CreateAsyncAsymmetricCipherL(MAsyncAsymmetricCipher*& aPlugin,
       
   307 												TUid aImplementationId,
       
   308 												const CKey& aKey,
       
   309 												const CCryptoParams* aAlgorithmParams);
       
   310 
       
   311 
       
   312 
       
   313 */
       
   314 	/**
       
   315 	Creates a new instance of an asymmetric signer.
       
   316 
       
   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.
       
   324 	
       
   325 	IMPORT_C static void CreateAsyncAsymmetricSignerL(MAsyncSigner*& aPlugin,
       
   326 												TUid aImplementationId,
       
   327 												const CKey& aKey,
       
   328 												const CCryptoParams* aAlgorithmParams);
       
   329 	*/
       
   330 	/**
       
   331 	Creates a new instance of an asymmetric verifier.
       
   332 
       
   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.
       
   340 
       
   341 	IMPORT_C static void CreateAsyncAsymmetricVerifierL(MAsyncVerifier*& aPlugin,
       
   342 												TUid aImplementationId,
       
   343 												const CKey& aKey,
       
   344 												const CCryptoParams* aAlgorithmParams);
       
   345 
       
   346 
       
   347 	*/
       
   348 	/**
       
   349 	Creates a new instance of a key agreement system.
       
   350 
       
   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.		   
       
   359 
       
   360 	IMPORT_C static void CreateAsyncKeyAgreementL(MAsyncKeyAgreement*& aPlugin,
       
   361 											TUid aImplementationId,
       
   362 											const CKey& aPrivateKey,
       
   363 											const CCryptoParams* aAlgorithmParams);
       
   364 	*/
       
   365 	/**
       
   366 	Creates a new instance of an asymmetric key pair generator.
       
   367 
       
   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.
       
   374 	
       
   375 	
       
   376 	IMPORT_C static void CreateAsyncKeyPairGeneratorL(MAsyncKeyPairGenerator*& aPlugin,
       
   377 												TUid aImplementationId,
       
   378 												const CCryptoParams* aAlgorithmParams);
       
   379 	*/
       
   380 	};		
       
   381 
       
   382 #endif // __PLUGINENTRY_H__