os/security/cryptoplugins/cryptospiplugins/test/h4drv/crypto_h4_plugin/pluginentry.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2007-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 #ifndef __PLUGINENTRY_H__
    25 #define __PLUGINENTRY_H__
    26 
    27 #include <cryptospi/cryptoparams.h>
    28 #include <e32cmn.h>
    29 #include <cryptospi/cryptospidef.h>
    30 #include "keys.h"
    31 #include <cryptospi/hashplugin.h>
    32 #include <cryptospi/randomplugin.h>
    33 #include "symmetriccipherplugin.h"
    34 #include "asymmetriccipherplugin.h"
    35 #include "signerplugin.h"
    36 #include "verifierplugin.h"
    37 #include "keypairgeneratorplugin.h"
    38 #include "keyagreementplugin.h"
    39 
    40 using namespace CryptoSpi;
    41 
    42 class CCryptoPluginEntry
    43 	{
    44 public:
    45 	
    46 	/**
    47 	   Enumerates the set of plug-ins supported by the module for a given interface
    48 	   e.g. all of the hash plug-ins.
    49 	   
    50 	   @param aInterface The UID of the plug-in interface type. If the UID is not recognised
    51 	   then the NULL pointer must be returned.
    52 	   @param aNumPlugins The number of plug-in characteristics objects in the result.
    53 	   @param A pointer to an array of characteristics objects. The SPI casts this to
    54 	   the expected sub-class of TCharacteristics for the specified interface UID.
    55 	*/
    56 	IMPORT_C static const TCharacteristics** Enumerate(TUid aInterface, TInt& aNumPlugins);
    57 
    58 	/**
    59 	   Retrieves the extended characteristics about a given implementation of an
    60 	   algorithm within the current plug-in DLL.
    61 
    62 	   @param aImplementationUid The UID of the implementation requested
    63 	   @return A pointer to the extended characteristics, allocated on the heap,
    64 	   which should be deleted once the caller has finished with it.
    65 	*/
    66 	IMPORT_C static void GetExtendedCharacteristicsL(TUid aImplementationUid, CExtendedCharacteristics*&);
    67 
    68 	/**
    69 	   Creates a new instance of an asymmetric cipher
    70 
    71 	   @param aPlugin A reference to a pointer that should be set to point to 
    72 	   the new asymmetric cipher object.
    73 	   @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate.
    74 	   @param aKey The encryption/decryption key.
    75 	   @param aAlgorithmParams The parameters that are specific to a particular 
    76 	   algorithm. This is for extendibility and will normally be null.
    77 	   @return KErrNone if successful; otherwise, a system wide error code.
    78 	*/
    79 	IMPORT_C static void CreateAsymmetricCipherL(MAsymmetricCipher*& aPlugin,
    80 												 TUid aImplementationId,
    81 												 const CKey& aKey,
    82 												 TUid aCryptoMode,
    83 												 TUid aPaddingMode,
    84 												 const CCryptoParams* aAlgorithmParams);
    85 
    86 	/**
    87 	   Creates a new instance of an asymmetric signer.
    88 
    89 	   @param aPlugin A reference to a pointer that should be set to point to 
    90 	   the new asymmetric signer object.
    91 	   @param aImplementationId The UID of the signer plug-in to instantiate.
    92 	   @param aKey The signing key.
    93 	   @param aAlgorithmParams The parameters that are specific to a particular 
    94 	   algorithm. This is for extendibility and will normally be null.
    95 	   @return KErrNone if successful; otherwise, a system wide error code.
    96 	*/
    97 	IMPORT_C static void CreateAsymmetricSignerL(MSigner*& aPlugin,
    98 												 TUid aImplementationId,
    99 												 const CKey& aKey,
   100 												 TUid aPaddingMode,
   101 												 const CCryptoParams* aAlgorithmParams);
   102 
   103 	/**
   104 	   Creates a new instance of an asymmetric verifier.
   105 
   106 	   @param aPlugin A reference to a pointer that should be set to point to 
   107 	   the new asymmetric verifier object.
   108 	   @param aImplementationId The UID of the verifier plug-in to instantiate.
   109 	   @param aKey The key to verify the signature with.
   110 	   @param aAlgorithmParams The parameters that are specific to a particular 
   111 	   algorithm. This is for extendibility and will normally be null.
   112 	   @return KErrNone if successful; otherwise, a system wide error code.
   113 	*/
   114 	IMPORT_C static void CreateAsymmetricVerifierL(MVerifier*& aPlugin,
   115 												   TUid aImplementationId,
   116 												   const CKey& aKey,
   117 												   TUid aPaddingMode,
   118 												   const CCryptoParams* aAlgorithmParams);
   119 
   120 
   121 										
   122 	/**
   123 	   Creates a new instance of a Hash object.
   124 
   125 	   @param aPlugin A reference to a pointer that should be set to point to 
   126 	   the new hash object.
   127 	   @param aImplementationId The UID of the hash plug-in to instantiate.
   128 	   @param aAlgorithmParams The parameters that are specific to a particular 
   129 	   algorithm. This is for extendibility and will normally be null.
   130 	   @return KErrNone if successful; otherwise, a system wide error code.
   131 	*/
   132 	IMPORT_C static void CreateHashL(MHash*& aPlugin,
   133 									 TUid aImplementationId,
   134 									 TUid aOperationMode,
   135 									 const CKey* aKey,
   136 									 const CCryptoParams* aAlgorithmParams);
   137 
   138 	/**
   139 	   Creates a new instance of a Random object.
   140 
   141 	   @param aPlugin A reference to a pointer that should be set to point to the new random object.
   142 	   @param aImplementationId The UID of the random plug-in to instantiate.
   143 	   @param aAlgorithmParams The parameters that are specific to a particular 
   144 	   algorithm. This is for extendibility and will normally be null.
   145 	   @return KErrNone if successful; otherwise, a system wide error code.
   146 	*/
   147 	IMPORT_C static void CreateRandomL(MRandom*& aPlugin,
   148 									   TUid aImplementationId,
   149 									   const CCryptoParams* aAlgorithmParams);
   150 
   151 
   152 	/**
   153 	   Creates a new instance of a key agreement system.
   154 
   155 	   @param aPlugin A reference to a pointer that should be set to point to 
   156 	   the new asymmetric key pair generator object.
   157 	   @param aImplementationId The UID of the key agreement plug-in to instantiate.
   158 	   @param aPrivateKey The private key to combine with the other parties public key
   159 	   during the agreement.
   160 	   @param aAlgorithmParams The parameters that are specific to a particular 
   161 	   algorithm. This is for extendibility and will normally be null.
   162 	   @return KErrNone if successful; otherwise, a system wide error code.		   
   163 	*/
   164 	IMPORT_C static void CreateKeyAgreementL(MKeyAgreement*& aPlugin,
   165 											 TUid aImplementationId,
   166 											 const CKey& aPrivateKey,
   167 											 const CCryptoParams* aAlgorithmParams);
   168 
   169 	/**
   170 	   Creates a new instance of an asymmetric key pair generator.
   171 
   172 	   @param aPlugin A reference to a pointer that should be set to point to 
   173 	   the new asymmetric key pair generator object.
   174 	   @param aImplementationId The UID of the verifier plug-in to instantiate.
   175 	   @param aAlgorithmParams The parameters that are specific to a particular 
   176 	   algorithm. This is for extendibility and will normally be null.
   177 	   @return KErrNone if successful; otherwise, a system wide error code.
   178 	*/
   179 	IMPORT_C static void CreateKeyPairGeneratorL(MKeyPairGenerator*& aPlugin,
   180 												 TUid aImplementationId,
   181 												 const CCryptoParams* aAlgorithmParams);
   182 										
   183 	/**
   184 	   Creates a new instance of a symmetric cipher
   185 
   186 	   @param aPlugin A reference to a pointer that should be set to point to 
   187 	   the new asymmetric object.
   188 	   @param aImplementationId The UID of the symmetric cipher plug-in to instantiate.
   189 	   @param aKey The encryption/decryption key.
   190 	   @param aCryptoMode Encrypt or Decrypt.
   191 	   @param aOperationMode the block cipher mode to use ECB, CBC, CTR etc
   192 	   @param aPadding the padding scheme to use.
   193 	   @param aAlgorithmParams The parameters that are specific to a particular 
   194 	   algorithm. This is for extendibility and will normally be null.
   195 	   @return KErrNone if successful; otherwise, a system wide error code.
   196 	*/
   197 	IMPORT_C static void CreateSymmetricCipherL(MSymmetricCipher*& aPlugin,
   198 												TUid aImplementationId,
   199 												const CKey& aKey,
   200 												TUid aCryptoMode,
   201 												TUid aOperationMode,
   202 												TUid aPadding,
   203 												const CCryptoParams* aAlgorithmParams);
   204 
   205 
   206 	/**
   207 	   Creates a new instance of a Random object.
   208 
   209 	   @param aPlugin A reference to a pointer that should be set to point to the new random object.
   210 	   @param aImplementationId The UID of the random plug-in to instantiate.
   211 	   @param aAlgorithmParams The parameters that are specific to a particular 
   212 	   algorithm. This is for extendibility and will normally be null.
   213 	   @return KErrNone if successful; otherwise, a system wide error code.
   214 		
   215 	   IMPORT_C static void CreateAsyncRandomL(MAsyncRandom*& aPlugin,
   216 	   TUid aImplementationId,
   217 	   const CCryptoParams* aAlgorithmParams);
   218 										
   219 	*/										
   220 	/**
   221 	   Creates a new instance of a Hash object.
   222 
   223 	   @param aPlugin A reference to a pointer that should be set to point to 
   224 	   the new hash object.
   225 	   @param aImplementationId The UID of the hash plug-in to instantiate.
   226 	   @param aAlgorithmParams The parameters that are specific to a particular 
   227 	   algorithm. This is for extendibility and will normally be null.
   228 	   @return KErrNone if successful; otherwise, a system wide error code.
   229 		
   230 	   IMPORT_C static void CreateAsyncHashL(MAsyncHash*& aPlugin,
   231 	   TUid aImplementationId,
   232 	   const CCryptoParams* aAlgorithmParams);
   233 
   234 	*/
   235 
   236 
   237 	/**
   238 	   Creates a new instance of a symmetric cipher
   239 
   240 	   @param aPlugin A reference to a pointer that should be set to point to 
   241 	   the new asymmetric object.
   242 	   @param aImplementationId The UID of the symmetric cipher plug-in to instantiate.
   243 	   @param aKey The encryption/decryption key.
   244 	   @param aAlgorithmParams The parameters that are specific to a particular 
   245 	   algorithm. This is for extendibility and will normally be null.
   246 	   @return KErrNone if successful; otherwise, a system wide error code.
   247 
   248 	   IMPORT_C static void CreateAsyncSymmetricCipherL(MAsyncSymmetricCipher*& aPlugin,
   249 	   TUid aImplementationId,
   250 	   const CKey& aKey,
   251 	   TUid aMode,
   252 	   TUid aPadding,
   253 	   const CCryptoParams* aAlgorithmParams);
   254 
   255 	*/
   256 	/**
   257 	   Creates a new instance of an asymmetric cipher
   258 
   259 	   @param aPlugin A reference to a pointer that should be set to point to 
   260 	   the new asymmetric cipher object.
   261 	   @param aImplementationId The UID of the asymmetric cipher plug-in to instantiate.
   262 	   @param aKey The encryption/decryption key.
   263 	   @param aAlgorithmParams The parameters that are specific to a particular 
   264 	   algorithm. This is for extendibility and will normally be null.
   265 	   @return KErrNone if successful; otherwise, a system wide error code.
   266 		
   267 	   IMPORT_C static void CreateAsyncAsymmetricCipherL(MAsyncAsymmetricCipher*& aPlugin,
   268 	   TUid aImplementationId,
   269 	   const CKey& aKey,
   270 	   const CCryptoParams* aAlgorithmParams);
   271 
   272 
   273 
   274 	*/
   275 	/**
   276 	   Creates a new instance of an asymmetric signer.
   277 
   278 	   @param aPlugin A reference to a pointer that should be set to point to 
   279 	   the new asymmetric signer object.
   280 	   @param aImplementationId The UID of the signer plug-in to instantiate.
   281 	   @param aKey The signing key.
   282 	   @param aAlgorithmParams The parameters that are specific to a particular 
   283 	   algorithm. This is for extendibility and will normally be null.
   284 	   @return KErrNone if successful; otherwise, a system wide error code.
   285 		
   286 	   IMPORT_C static void CreateAsyncAsymmetricSignerL(MAsyncSigner*& aPlugin,
   287 	   TUid aImplementationId,
   288 	   const CKey& aKey,
   289 	   const CCryptoParams* aAlgorithmParams);
   290 	*/
   291 	/**
   292 	   Creates a new instance of an asymmetric verifier.
   293 
   294 	   @param aPlugin A reference to a pointer that should be set to point to 
   295 	   the new asymmetric verifier object.
   296 	   @param aImplementationId The UID of the verifier plug-in to instantiate.
   297 	   @param aKey The key to verify the signature with.
   298 	   @param aAlgorithmParams The parameters that are specific to a particular 
   299 	   algorithm. This is for extendibility and will normally be null.
   300 	   @return KErrNone if successful; otherwise, a system wide error code.
   301 
   302 	   IMPORT_C static void CreateAsyncAsymmetricVerifierL(MAsyncVerifier*& aPlugin,
   303 	   TUid aImplementationId,
   304 	   const CKey& aKey,
   305 	   const CCryptoParams* aAlgorithmParams);
   306 
   307 
   308 	*/
   309 	/**
   310 	   Creates a new instance of a key agreement system.
   311 
   312 	   @param aPlugin A reference to a pointer that should be set to point to 
   313 	   the new asymmetric key pair generator object.
   314 	   @param aImplementationId The UID of the key agreement plug-in to instantiate.
   315 	   @param aKey The private key to combine with the other parties public key
   316 	   during the agreement.
   317 	   @param aAlgorithmParams The parameters that are specific to a particular 
   318 	   algorithm. This is for extendibility and will normally be null.
   319 	   @return KErrNone if successful; otherwise, a system wide error code.		   
   320 
   321 	   IMPORT_C static void CreateAsyncKeyAgreementL(MAsyncKeyAgreement*& aPlugin,
   322 	   TUid aImplementationId,
   323 	   const CKey& aPrivateKey,
   324 	   const CCryptoParams* aAlgorithmParams);
   325 	*/
   326 
   327 	/**
   328 	   Creates a new instance of an asymmetric key pair generator.
   329 
   330 	   @param aPlugin A reference to a pointer that should be set to point to 
   331 	   the new asymmetric key pair generator object.
   332 	   @param aImplementationId The UID of the verifier plug-in to instantiate.
   333 	   @param aAlgorithmParams The parameters that are specific to a particular 
   334 	   algorithm. This is for extendibility and will normally be null.
   335 	   @return KErrNone if successful; otherwise, a system wide error code.
   336 		
   337 		
   338 	   IMPORT_C static void CreateAsyncKeyPairGeneratorL(MAsyncKeyPairGenerator*& aPlugin,
   339 	   TUid aImplementationId,
   340 	   const CCryptoParams* aAlgorithmParams);
   341 	*/
   342 	};
   343 
   344 
   345 #endif // __PLUGINENTRY_H__