os/security/crypto/weakcryptospi/test/tcryptospi/src/ruleselectcommonstep.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcryptospi/test/tcryptospi/src/ruleselectcommonstep.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1036 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007-2010 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 + @internalTechnology
    1.25 +*/
    1.26 +#include "ruleselectcommonstep.h"
    1.27 +#include "plugincharschecker.h"
    1.28 +#include <cryptospi/cryptosymmetriccipherapi.h>
    1.29 +#include <cryptospi/cryptoasymmetriccipherapi.h>
    1.30 +#include <cryptospi/cryptohashapi.h>
    1.31 +#include <cryptospi/cryptorandomapi.h>
    1.32 +#include <cryptospi/cryptosignatureapi.h>
    1.33 +#include <cryptospi/cryptokeyagreementapi.h>
    1.34 +#include <cryptospi/cryptokeypairgeneratorapi.h>
    1.35 +#include <cryptospi/keypair.h>
    1.36 +#include <cryptospi/keys.h>
    1.37 +
    1.38 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
    1.39 +#include <cryptospi/cryptomacapi.h>
    1.40 +#endif
    1.41 +
    1.42 +#include <cryptospi/cryptospistateapi.h>
    1.43 +#include <cryptospi/ruleselector.h>
    1.44 +
    1.45 +using namespace CryptoSpi;
    1.46 +
    1.47 +CRuleSelectCommonStep::~CRuleSelectCommonStep()
    1.48 +	{
    1.49 +	}
    1.50 +
    1.51 +CRuleSelectCommonStep::CRuleSelectCommonStep()
    1.52 +	{
    1.53 +	SetTestStepName(KRuleSelectCommonStep);
    1.54 +	}
    1.55 +
    1.56 +TVerdict CRuleSelectCommonStep::doTestStepPreambleL()
    1.57 +	{
    1.58 +	SetTestStepResult(EPass);
    1.59 +	return TestStepResult();
    1.60 +	}
    1.61 +
    1.62 +TVerdict CRuleSelectCommonStep::doTestStepL()
    1.63 +	{
    1.64 +	
    1.65 +	INFO_PRINTF1(_L("Rule Selection - Common Characteristics Selection"));
    1.66 +	INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
    1.67 +	
    1.68 +	if (TestStepResult()==EPass)
    1.69 +		{
    1.70 +		
    1.71 +		TInt err = 0;
    1.72 +
    1.73 +		//Create Default Selection Rules Object
    1.74 +		CSelectionRules* rules = CSelectionRules::NewL();
    1.75 +		CleanupStack::PushL(rules);
    1.76 +		
    1.77 +		//*************SELECTION RULE CREATION AND ADDITION**************
    1.78 +
    1.79 +		//Boolean to determine whether there are more rules to apply
    1.80 +		TBool moreRules;
    1.81 +		moreRules = ETrue;
    1.82 +		
    1.83 +		//Itterator representing the current rule. Appended to the end of each selection
    1.84 +		//rule INI parameter 
    1.85 +		TInt currentRule;
    1.86 +		currentRule = 1;
    1.87 +		
    1.88 +		//Total number of selection rules added to the CSelectionRules object
    1.89 +		TInt totalRules;
    1.90 +		totalRules = 0;
    1.91 +			
    1.92 +		TVariantPtrC interfaceScope;
    1.93 +		TVariantPtrC algorithmScope;
    1.94 +		TVariantPtrC charUid;
    1.95 +		TVariantPtrC compareOperator;
    1.96 +		TVariantPtrC charValue;
    1.97 +		TVariantPtrC charValueType;		
    1.98 +		TBool isOptional;
    1.99 +		
   1.100 +		
   1.101 +		//Whilst there are selection rules present in the INI file that have yet to be
   1.102 +		//added to the CSelectionRules object	
   1.103 +		while(moreRules)
   1.104 +			{
   1.105 +			INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
   1.106 +			
   1.107 +			//Constructs each of the parameter names required to extract the necessary 
   1.108 +			//selection rule data from the specified INI configuration file
   1.109 +			TBuf<KMaxConfigParamStringSize> interfaceScopeStr(KConfigInterfaceScopeBase);
   1.110 +			interfaceScopeStr.AppendNum(currentRule);
   1.111 +			INFO_PRINTF2(_L("interfaceScopeStr = %S"), &interfaceScopeStr);
   1.112 +			
   1.113 +			TBuf<KMaxConfigParamStringSize> algorithmScopeStr(KConfigAlgorithmScopeBase);
   1.114 +			algorithmScopeStr.AppendNum(currentRule);
   1.115 +			INFO_PRINTF2(_L("algorithmScopeStr = %S"), &algorithmScopeStr);
   1.116 +			
   1.117 +			TBuf<KMaxConfigParamStringSize> charUidStr(KConfigCharUidBase);
   1.118 +			charUidStr.AppendNum(currentRule);
   1.119 +			INFO_PRINTF2(_L("charUidStr = %S"), &charUidStr);
   1.120 +			
   1.121 +			TBuf<KMaxConfigParamStringSize> compareOperatorStr(KConfigCompareOperatorBase);
   1.122 +			compareOperatorStr.AppendNum(currentRule);
   1.123 +			INFO_PRINTF2(_L("compareOperatorStr = %S"), &compareOperatorStr);
   1.124 +			
   1.125 +			TBuf<KMaxConfigParamStringSize> charValueStr(KConfigCharValueBase);
   1.126 +			charValueStr.AppendNum(currentRule);
   1.127 +			INFO_PRINTF2(_L("charValueStr = %S"), &charValueStr);
   1.128 +			
   1.129 +			TBuf<KMaxConfigParamStringSize> charValueTypeStr(KConfigCharValueTypeBase);
   1.130 +			charValueTypeStr.AppendNum(currentRule);
   1.131 +			INFO_PRINTF2(_L("charValueTypeStr = %S"), &charValueTypeStr);
   1.132 +			
   1.133 +			TBuf<KMaxConfigParamStringSize> isOptionalStr(KConfigIsOptionalBase);
   1.134 +			isOptionalStr.AppendNum(currentRule);
   1.135 +			INFO_PRINTF2(_L("isOptionalStr = %S"), &isOptionalStr);
   1.136 +			
   1.137 +			
   1.138 +			//Extracts the parameter data for a single rule from the specified INI file 
   1.139 +			if(!GetStringFromConfig(ConfigSection(),interfaceScopeStr,interfaceScope) ||
   1.140 +				!GetStringFromConfig(ConfigSection(),algorithmScopeStr,algorithmScope) ||
   1.141 +				!GetStringFromConfig(ConfigSection(),charUidStr,charUid) ||
   1.142 +				!GetStringFromConfig(ConfigSection(),compareOperatorStr,compareOperator) ||
   1.143 +				!GetStringFromConfig(ConfigSection(),charValueTypeStr,charValueType) ||
   1.144 +				!GetBoolFromConfig(ConfigSection(),isOptionalStr,isOptional))
   1.145 +				{
   1.146 +				moreRules = EFalse;
   1.147 +				}
   1.148 +			else
   1.149 +				{
   1.150 +				
   1.151 +				//Creates a pointer to store the address of the newly created selection rule		
   1.152 +				CSelectionRuleContent* rule = NULL;
   1.153 +				
   1.154 +				//Creates a pointer to store the contents of the rule value parameter, so that
   1.155 +				//it can be passed in at construction of the selection rule.
   1.156 +				CCryptoParam* ruleValueParam = NULL;
   1.157 +				
   1.158 +				//Depending on the 'RuleValueType' parameter read in from the INI file, the 'RuleValue'
   1.159 +				//parameter will either be read in as an Integer,String or a Boolean.
   1.160 +				switch(charValueType)
   1.161 +					{
   1.162 +					case ERuleValueInteger:
   1.163 +						{
   1.164 +						TInt charValue;
   1.165 +						
   1.166 +						if(!GetIntFromConfig(ConfigSection(),charValueStr,charValue))
   1.167 +							{
   1.168 +							//Should the integer value be represented by a constant..
   1.169 +							TVariantPtrC strCharValue;
   1.170 +							
   1.171 +							if(!GetStringFromConfig(ConfigSection(),charValueStr,strCharValue))
   1.172 +								{
   1.173 +								ERR_PRINTF1(_L("** .INI Error: INTEGER Rule Value Not Initialised Correctly **"));
   1.174 +								SetTestStepResult(EFail);	
   1.175 +								}
   1.176 +							else
   1.177 +								{
   1.178 +								ruleValueParam = CCryptoIntParam::NewL(TInt(strCharValue),TUid(charUid));	
   1.179 +								}
   1.180 +							}
   1.181 +						else
   1.182 +							{		
   1.183 +							//The Integer Rule Value is encapsulated as a CCryptoIntParam object so that it can be passed in as 
   1.184 +							//a parameter when constructing the selection rule				
   1.185 +							ruleValueParam = CCryptoIntParam::NewL(charValue,charUid);											
   1.186 +							}
   1.187 +							
   1.188 +						break;	
   1.189 +						}
   1.190 +						
   1.191 +					case ERuleValueDes8:
   1.192 +						{		
   1.193 +						TPtrC charValue;
   1.194 +						
   1.195 +						if(!GetStringFromConfig(ConfigSection(),charValueStr,charValue))
   1.196 +							{
   1.197 +							ERR_PRINTF1(_L("** .INI Error: STRING Rule Value Not Initialised Correctly **"));
   1.198 +							SetTestStepResult(EFail);	
   1.199 +							}
   1.200 +						else
   1.201 +							{
   1.202 +							//Convert encryption key to an 8 Bit Descriptor
   1.203 +							HBufC8* charStr = HBufC8::NewLC(charValue.Length());
   1.204 +							TPtr8 charStrPtr = charStr->Des();
   1.205 +			
   1.206 +							charStrPtr.Copy(charValue);
   1.207 +							
   1.208 +							//The String Rule Value is encapsulated as a CCryptoDesC8Param object so that it can be passed in as 
   1.209 +							//a parameter when constructing the selection rule
   1.210 +							ruleValueParam = CCryptoDesC8Param::NewL(charStrPtr,charUid);
   1.211 +							
   1.212 +							CleanupStack::PopAndDestroy(charStr);
   1.213 +							}
   1.214 +							
   1.215 +						break;	
   1.216 +						}
   1.217 +						
   1.218 +					case ERuleValueDes16:
   1.219 +						{		
   1.220 +						TPtrC charValue;
   1.221 +						
   1.222 +						if(!GetStringFromConfig(ConfigSection(),charValueStr,charValue))
   1.223 +							{
   1.224 +							ERR_PRINTF1(_L("** .INI Error: STRING Rule Value Not Initialised Correctly **"));
   1.225 +							SetTestStepResult(EFail);	
   1.226 +							}
   1.227 +						else
   1.228 +							{						
   1.229 +							//The String Rule Value is encapsulated as a CCryptoDesC8Param object so that it can be passed in as 
   1.230 +							//a parameter when constructing the selection rule
   1.231 +							ruleValueParam = CCryptoDesC16Param::NewL(charValue,charUid);
   1.232 +							}
   1.233 +							
   1.234 +						break;	
   1.235 +						}
   1.236 +						
   1.237 +					case ERuleValueBoolean:
   1.238 +						{
   1.239 +						TBool charValue;
   1.240 +						
   1.241 +						if(!GetBoolFromConfig(ConfigSection(),charValueStr,charValue))
   1.242 +							{
   1.243 +							ERR_PRINTF1(_L("** .INI Error: BOOLEAN Rule Value Not Initialised Correctly **"));
   1.244 +							SetTestStepResult(EFail);	
   1.245 +							}
   1.246 +						else
   1.247 +							{
   1.248 +							//The Boolean Rule Value is encapsulated as a CCryptoInt8Param object so that it can be passed in as 
   1.249 +							//a parameter when constructing the selection rule
   1.250 +							ruleValueParam = CCryptoIntParam::NewL(charValue,charUid);
   1.251 +							}
   1.252 +							
   1.253 +						break;	
   1.254 +						}
   1.255 +						
   1.256 +					default:
   1.257 +						{
   1.258 +						ERR_PRINTF1(_L("** .INI Error: Rule Value Type Unknown **"));
   1.259 +						SetTestStepResult(EFail);
   1.260 +						break;	
   1.261 +						}	
   1.262 +					}
   1.263 +						
   1.264 +				
   1.265 +				if(TestStepResult() == EPass)
   1.266 +					{
   1.267 +					
   1.268 +					//Creates the CSelectionRuleContent object, passing in all the parameters read in
   1.269 +					//from the specified INI configuration file
   1.270 +							
   1.271 +					TRAP_LOG(err, rule = CSelectionRuleContent::NewL(interfaceScope,
   1.272 +																	algorithmScope,
   1.273 +																	ruleValueParam,
   1.274 +																	TRuleOperator((TInt)compareOperator),
   1.275 +																	isOptional));	
   1.276 +					if(err == KErrNone)
   1.277 +						{
   1.278 +						//Add the newly created selection rule to the CSelectionRules collection by
   1.279 +						//calling the 'AddSelectionRule' method and passing in the address of the rule
   1.280 +						TRAP_LOG(err,rules->AddSelectionRuleL(rule));
   1.281 +						
   1.282 +						if(err == KErrNone)
   1.283 +							{
   1.284 +							INFO_PRINTF2(_L("Rule %d Created, Added and Destoryed"), currentRule);
   1.285 +							
   1.286 +							currentRule++;
   1.287 +							totalRules++;						
   1.288 +							}
   1.289 +						else
   1.290 +							{
   1.291 +							ERR_PRINTF2(_L("RULE FAILURE: Failed to Add Selection Rule %d "), currentRule);
   1.292 +							moreRules = EFalse;
   1.293 +							SetTestStepResult(EFail);
   1.294 +							}
   1.295 +						}	
   1.296 +					else
   1.297 +						{
   1.298 +						ERR_PRINTF2(_L("RULE FAILURE: Failed to Create Selection Rule %d "), currentRule);
   1.299 +						moreRules = EFalse;	
   1.300 +						SetTestStepResult(EFail);
   1.301 +						}
   1.302 +					
   1.303 +						
   1.304 +					}
   1.305 +				else
   1.306 +					{
   1.307 +					moreRules = EFalse;	
   1.308 +					}
   1.309 +				}	
   1.310 +			}
   1.311 +			
   1.312 +		//If 1 or more selection rule objects were added successfully without error, the test step
   1.313 +		//can proceed to the next phase   
   1.314 +		if((TestStepResult() == EPass) && (totalRules > 0))
   1.315 +			{
   1.316 +			INFO_PRINTF2(_L("Successfully Added Selection Rules: %d"), totalRules);
   1.317 +			}
   1.318 +		else if((TestStepResult() == EFail) && (totalRules > 0))
   1.319 +			{
   1.320 +			ERR_PRINTF1(_L("** .INI Error: Errornous Selection Rule Data **"));
   1.321 +			SetTestStepResult(EFail);
   1.322 +			}
   1.323 +		else
   1.324 +			{
   1.325 +			ERR_PRINTF1(_L("** NO VALID SELECTION RULE DATA FOUND **"));	
   1.326 +			}
   1.327 +
   1.328 +		//**************************************************************		
   1.329 +		
   1.330 +		INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
   1.331 +		
   1.332 +		if(TestStepResult()==EPass)
   1.333 +			{	
   1.334 +			
   1.335 +			//Assume faliure, unless all is successful
   1.336 +			SetTestStepResult(EFail);
   1.337 +				
   1.338 +			//Create Rule Selector Object	
   1.339 +			CRuleSelector* ruleSelector = CRuleSelector::NewL(rules);
   1.340 +			CleanupStack::Pop(rules);
   1.341 +			CleanupStack::PushL(ruleSelector);
   1.342 +
   1.343 +			//Set the Selector Passing in a pointer to the Rule Selector and SPI State	
   1.344 +			CCryptoSpiStateApi::SetSelector(ruleSelector);
   1.345 +
   1.346 +			//Define a pointer of type CCryptoBase to store the address ofthe instantiated encryption object
   1.347 +			CCryptoBase* plugin = NULL;
   1.348 +
   1.349 +			TVariantPtrC interfaceType;
   1.350 +			
   1.351 +			//Extract the Encryption Type parameter from the specified INI file
   1.352 +			if(!GetStringFromConfig(ConfigSection(),KConfigInterfaceType,interfaceType))
   1.353 +				{
   1.354 +				ERR_PRINTF1(_L("** .INI Error: Encryption Type Data Not Located **"));
   1.355 +				SetTestStepResult(EFail);
   1.356 +				}
   1.357 +			else
   1.358 +				{
   1.359 +				//Depending on the Interface Type retrieved, the appropriate factory object
   1.360 +				//is created and assigned to the previously CCryptoBase plugin pointer
   1.361 +				switch(interfaceType) 
   1.362 +					{			
   1.363 +					case KAsymmetricCipherInterface:
   1.364 +						{
   1.365 +		
   1.366 +						TPtrC16 encryptKey;
   1.367 +						TVariantPtrC keyType;
   1.368 +						TVariantPtrC algorithmUid;
   1.369 +						TVariantPtrC cryptoMode;
   1.370 +						TVariantPtrC paddingMode;
   1.371 +						TVariantPtrC algorithmParams;
   1.372 +						
   1.373 +						//Each of the individual parameters required to create the Asymmetric Cipher object
   1.374 +						//are read in from the specified INI configuration file	
   1.375 +						if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
   1.376 +							!GetStringFromConfig(ConfigSection(),KConfigCryptoMode,cryptoMode) ||
   1.377 +							!GetStringFromConfig(ConfigSection(),KConfigPaddingMode,paddingMode) ||
   1.378 +							!GetStringFromConfig(ConfigSection(),KConfigAlgorithmParams,algorithmParams))
   1.379 +							{
   1.380 +							ERR_PRINTF1(_L("** .INI Error: Asymmetric Cipher Arguments Not Located **"));
   1.381 +							SetTestStepResult(EFail);
   1.382 +							}
   1.383 +						else
   1.384 +							{
   1.385 +								
   1.386 +							//********** Rule Selector Unselcted to Create Key Pair ************
   1.387 +							CCryptoSpiStateApi::UnsetSelector();
   1.388 +							
   1.389 +							CCryptoParams* keyParams = CCryptoParams::NewLC(); 
   1.390 +							
   1.391 +							//Create Key Pair and Key Pair Generator Objects
   1.392 +				   			CKeyPair* keyPair = NULL;
   1.393 +							CKeyPairGenerator * keypairImpl = NULL;
   1.394 +							
   1.395 +							INFO_PRINTF1(_L("Generating RSA keys"));
   1.396 +							
   1.397 +							// create an RSA key pair
   1.398 +							keyParams->AddL(KKeyExponent, KRsaKeyParameterEUid);
   1.399 +							keyParams->AddL(KRsaPrivateKeyStandard, KRsaKeyTypeUid);
   1.400 +
   1.401 +							// create a key pair generator implementation interface
   1.402 +							TRAP_LOG(err,CKeyPairGeneratorFactory::CreateKeyPairGeneratorL(
   1.403 +															keypairImpl, 
   1.404 +															KRSAKeyPairGeneratorUid, 
   1.405 +															keyParams));
   1.406 +															
   1.407 +							CleanupStack::PushL(keypairImpl);
   1.408 +
   1.409 +							// Create a Key Pair	
   1.410 +							TRAP_LOG(err,keypairImpl->GenerateKeyPairL(1024, *keyParams, keyPair));
   1.411 +							
   1.412 +							CleanupStack::PushL(keyPair);
   1.413 +							
   1.414 +							CCryptoSpiStateApi::SetSelector(ruleSelector);
   1.415 +							//******************************************************************
   1.416 +							
   1.417 +							CAsymmetricCipher* asymmetricCipherImpl;	
   1.418 +								
   1.419 +							TRAP_LOG(err,CAsymmetricCipherFactory::CreateAsymmetricCipherL(asymmetricCipherImpl,
   1.420 +																							algorithmUid,
   1.421 +																							keyPair->PublicKey(),
   1.422 +																							cryptoMode,
   1.423 +																							paddingMode,
   1.424 +																							NULL));
   1.425 +							
   1.426 +							if(asymmetricCipherImpl && (err == KErrNone))
   1.427 +								{
   1.428 +								plugin = static_cast<CCryptoBase*>(asymmetricCipherImpl);
   1.429 +								
   1.430 +								INFO_PRINTF1(_L("** Successfully Loaded Asymmetric Cipher Object **"));
   1.431 +								SetTestStepResult(EPass);	
   1.432 +								}
   1.433 +							else
   1.434 +								{
   1.435 +								ERR_PRINTF2(_L("** Error: Loading Asymmetric Cipher Object - %d **"), err);
   1.436 +								SetTestStepResult(EFail);
   1.437 +								}
   1.438 +								
   1.439 +							CleanupStack::PopAndDestroy(3,keyParams);	
   1.440 +							} 
   1.441 +							
   1.442 +						break;
   1.443 +						}
   1.444 +							
   1.445 +					case KSymmetricCipherInterface:
   1.446 +						{
   1.447 +						
   1.448 +						TPtrC16 encryptKey;
   1.449 +						TVariantPtrC keyType;
   1.450 +						TVariantPtrC algorithmUid;
   1.451 +						TVariantPtrC cryptoMode;
   1.452 +						TVariantPtrC operationMode;
   1.453 +						TVariantPtrC paddingMode;
   1.454 +						TVariantPtrC algorithmParams;
   1.455 +						
   1.456 +						//Each of the individual parameters required to create the Symmetric Cipher object
   1.457 +						//are read in from the specified INI configuration file
   1.458 +						if(!GetStringFromConfig(ConfigSection(),KConfigEncryptKey,encryptKey) || 
   1.459 +							!GetStringFromConfig(ConfigSection(),KConfigEncryptKeyType,keyType) ||
   1.460 +							!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
   1.461 +							!GetStringFromConfig(ConfigSection(),KConfigCryptoMode,cryptoMode) ||
   1.462 +							!GetStringFromConfig(ConfigSection(),KConfigOperationMode,operationMode) ||
   1.463 +							!GetStringFromConfig(ConfigSection(),KConfigPaddingMode,paddingMode) ||
   1.464 +							!GetStringFromConfig(ConfigSection(),KConfigAlgorithmParams,algorithmParams))
   1.465 +							{
   1.466 +							ERR_PRINTF1(_L("** .INI Error: Symmetric Cipher Arguments Not Located **"));
   1.467 +							SetTestStepResult(EFail);
   1.468 +							}
   1.469 +						else
   1.470 +							{
   1.471 +							//Convert encryption key to an 8 Bit Descriptor
   1.472 +							HBufC8* keyStr = HBufC8::NewLC(encryptKey.Length());
   1.473 +							TPtr8 keyStrPtr = keyStr->Des();
   1.474 +			
   1.475 +							keyStrPtr.Copy(encryptKey);
   1.476 +							
   1.477 +							//Create an new CryptoParams object to encapsulate the key type and secret key string
   1.478 +							CCryptoParams* keyParams = CCryptoParams::NewL();
   1.479 +							CleanupStack::PushL(keyParams);
   1.480 +							keyParams->AddL(*keyStr,keyType);
   1.481 +			
   1.482 +							//Create Key Object
   1.483 +							TKeyProperty keyProperty;
   1.484 +							CKey* key=CKey::NewL(keyProperty,*keyParams);
   1.485 +							CleanupStack::PushL(key);
   1.486 +							
   1.487 +							CSymmetricCipher* symmetricCipherImpl = NULL;	
   1.488 +								
   1.489 +							TRAP_LOG(err,CSymmetricCipherFactory::CreateSymmetricCipherL(symmetricCipherImpl,
   1.490 +																						algorithmUid,
   1.491 +																						*key,
   1.492 +																						cryptoMode,
   1.493 +																						operationMode,
   1.494 +																						paddingMode,
   1.495 +																						NULL));
   1.496 +							
   1.497 +							
   1.498 +							if(symmetricCipherImpl && (err == KErrNone))
   1.499 +								{
   1.500 +								
   1.501 +								plugin = static_cast<CCryptoBase*>(symmetricCipherImpl);
   1.502 +								
   1.503 +								INFO_PRINTF1(_L("** Successfully Loaded Symmetric Cipher Object **"));
   1.504 +								SetTestStepResult(EPass);	
   1.505 +								}
   1.506 +							else
   1.507 +								{
   1.508 +								ERR_PRINTF2(_L("** Error: Loading Symmetric Cipher Object - %d **"), err);
   1.509 +								SetTestStepResult(EFail);
   1.510 +								} 
   1.511 +									
   1.512 +							CleanupStack::PopAndDestroy(3,keyStr);
   1.513 +							} 
   1.514 +							
   1.515 +						break;
   1.516 +						}
   1.517 +						
   1.518 +					case KHashInterface:
   1.519 +						{
   1.520 +						TVariantPtrC algorithmUid;
   1.521 +						TVariantPtrC operationMode;
   1.522 +						TVariantPtrC algorithmParams;
   1.523 +						
   1.524 +						//Each of the individual parameters required to create the Hash object
   1.525 +						//are read in from the specified INI configuration file	
   1.526 +						if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
   1.527 +#ifndef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT							
   1.528 +							!GetStringFromConfig(ConfigSection(),KConfigOperationMode,operationMode) ||
   1.529 +#endif							
   1.530 +							!GetStringFromConfig(ConfigSection(),KConfigAlgorithmParams,algorithmParams))
   1.531 +							{
   1.532 +							ERR_PRINTF1(_L("** .INI Error: Hash Arguments Not Located **"));
   1.533 +							SetTestStepResult(EFail);
   1.534 +							}
   1.535 +						else
   1.536 +							{
   1.537 +							CHash* hashImpl = NULL;
   1.538 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT							
   1.539 +							if (GetStringFromConfig(ConfigSection(),KConfigOperationMode,operationMode))
   1.540 +								{
   1.541 +								TRAP_LOG(err,CHashFactory::CreateHashL(hashImpl,
   1.542 +																	algorithmUid,
   1.543 +																	operationMode,
   1.544 +																	NULL,
   1.545 +																	NULL));
   1.546 +								}
   1.547 +							else
   1.548 +								{
   1.549 +								TRAP_LOG(err,CHashFactory::CreateHashL(hashImpl,
   1.550 +																	algorithmUid,
   1.551 +																	NULL));								
   1.552 +								}
   1.553 +#else
   1.554 +							TRAP_LOG(err,CHashFactory::CreateHashL(hashImpl,
   1.555 +																	algorithmUid,
   1.556 +																	operationMode,
   1.557 +																	NULL,
   1.558 +																	NULL));
   1.559 +#endif							
   1.560 +
   1.561 +							if(hashImpl && (err == KErrNone))
   1.562 +								{
   1.563 +								plugin = static_cast<CCryptoBase*>(hashImpl);
   1.564 +								
   1.565 +								INFO_PRINTF1(_L("** Successfully Loaded Hash Object **"));
   1.566 +								SetTestStepResult(EPass);	
   1.567 +								}
   1.568 +							else
   1.569 +								{
   1.570 +								ERR_PRINTF2(_L("** Error: Loading Hash Object - %d **"), err);
   1.571 +								SetTestStepResult(EFail);
   1.572 +								}	
   1.573 +							}
   1.574 +							
   1.575 +						break;
   1.576 +						}
   1.577 +
   1.578 +#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT							
   1.579 +					case KMacInterface:
   1.580 +						{
   1.581 +						TVariantPtrC algorithmUid;
   1.582 +						TPtrC encryptKey;
   1.583 +						TVariantPtrC keyType;
   1.584 +						
   1.585 +						//Each of the individual parameters required to create the Mac object
   1.586 +						//are read in from the specified INI configuration file	
   1.587 +						if (!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
   1.588 +							!GetStringFromConfig(ConfigSection(),KConfigEncryptKey,encryptKey) ||
   1.589 +							!GetStringFromConfig(ConfigSection(),KConfigEncryptKeyType,keyType))
   1.590 +							{
   1.591 +							ERR_PRINTF1(_L("** .INI Error: Mac Arguments Not Located **"));
   1.592 +							SetTestStepResult(EFail);
   1.593 +							}
   1.594 +						else
   1.595 +							{
   1.596 +							CMac* macImpl = NULL;
   1.597 +							
   1.598 +							//Convert encryption key to an 8 Bit Descriptor
   1.599 +							HBufC8* keyStr = HBufC8::NewLC(encryptKey.Length());
   1.600 +							TPtr8 keyStrPtr = keyStr->Des();
   1.601 +							
   1.602 +							keyStrPtr.Copy(encryptKey);
   1.603 +											
   1.604 +							//Create an new CryptoParams object to encapsulate the key type and secret key string
   1.605 +							CCryptoParams* keyParams = CCryptoParams::NewL();
   1.606 +							CleanupStack::PushL(keyParams);
   1.607 +							keyParams->AddL(*keyStr,keyType);
   1.608 +							
   1.609 +							//Create Key Object
   1.610 +							TKeyProperty keyProperty;
   1.611 +							CKey* key=CKey::NewL(keyProperty,*keyParams);
   1.612 +							CleanupStack::PushL(key);
   1.613 +									
   1.614 +							TRAP_LOG(err,CMacFactory::CreateMacL(macImpl,
   1.615 +																algorithmUid,
   1.616 +																*key,
   1.617 +																NULL));
   1.618 +							
   1.619 +							if(macImpl && (err == KErrNone))
   1.620 +								{
   1.621 +								plugin = static_cast<CCryptoBase*>(macImpl);
   1.622 +								
   1.623 +								INFO_PRINTF1(_L("** Successfully Loaded Mac Object **"));
   1.624 +								SetTestStepResult(EPass);	
   1.625 +								}
   1.626 +							else
   1.627 +								{
   1.628 +								delete macImpl;
   1.629 +								ERR_PRINTF2(_L("** Error: Loading Mac Object - %d **"), err);
   1.630 +								SetTestStepResult(EFail);
   1.631 +								}
   1.632 +							
   1.633 +							CleanupStack::PopAndDestroy(3,keyStr);
   1.634 +							}
   1.635 +						
   1.636 +						break;
   1.637 +						}
   1.638 +#endif							
   1.639 +						
   1.640 +					case KRandomInterface:
   1.641 +						{
   1.642 +						
   1.643 +						TVariantPtrC algorithmUid;
   1.644 +						TVariantPtrC algorithmParams;
   1.645 +						
   1.646 +						//Each of the individual parameters required to create the Random object
   1.647 +						//are read in from the specified INI configuration file
   1.648 +						if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
   1.649 +							!GetStringFromConfig(ConfigSection(),KConfigAlgorithmParams,algorithmParams))
   1.650 +							{
   1.651 +							ERR_PRINTF1(_L("** .INI Error: Random Arguments Not Located **"));
   1.652 +							SetTestStepResult(EFail);
   1.653 +							}
   1.654 +						else
   1.655 +							{
   1.656 +							CryptoSpi::CRandom* randomImpl = NULL;
   1.657 +							
   1.658 +							TRAP_LOG(err,CRandomFactory::CreateRandomL(randomImpl,
   1.659 +																		algorithmUid,
   1.660 +																		NULL));
   1.661 +
   1.662 +							if(randomImpl && (err == KErrNone))
   1.663 +								{
   1.664 +								plugin = static_cast<CCryptoBase*>(randomImpl);
   1.665 +								
   1.666 +								INFO_PRINTF1(_L("** Successfully Loaded Random Object **"));
   1.667 +								SetTestStepResult(EPass);	
   1.668 +								}
   1.669 +							else
   1.670 +								{
   1.671 +								ERR_PRINTF2(_L("** Error: Loading Random Object - %d **"), err);
   1.672 +								SetTestStepResult(EFail);
   1.673 +								}
   1.674 +								
   1.675 +							} 
   1.676 +							
   1.677 +						break;	
   1.678 +						}
   1.679 +						
   1.680 +					case KSignerInterface:
   1.681 +						{
   1.682 +						TVariantPtrC algorithmUid;
   1.683 +						TVariantPtrC paddingMode;
   1.684 +						TVariantPtrC algorithmParams;
   1.685 +						
   1.686 +						//Each of the individual parameters required to create the Signer object
   1.687 +						//are read in from the specified INI configuration file
   1.688 +						if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
   1.689 +							!GetStringFromConfig(ConfigSection(),KConfigPaddingMode,paddingMode) ||
   1.690 +							!GetStringFromConfig(ConfigSection(),KConfigAlgorithmParams,algorithmParams))
   1.691 +							{
   1.692 +							ERR_PRINTF1(_L("** .INI Error: Signer Arguments Not Located **"));
   1.693 +							SetTestStepResult(EFail);
   1.694 +							}
   1.695 +						else
   1.696 +							{
   1.697 +							
   1.698 +							//********** Rule Selector Unselected to Create Key Pair ************
   1.699 +							CCryptoSpiStateApi::UnsetSelector();
   1.700 +							
   1.701 +							CCryptoParams* keyParams = CCryptoParams::NewLC(); 
   1.702 +							
   1.703 +							//Create Key Pair and Key Pair Generator Objects
   1.704 +				   			CKeyPair* keyPair = NULL;
   1.705 +							CKeyPairGenerator * keypairImpl = NULL;
   1.706 +							
   1.707 +							INFO_PRINTF1(_L("Generating RSA keys"));
   1.708 +							
   1.709 +							// create an RSA key pair
   1.710 +							keyParams->AddL(KKeyExponent, KRsaKeyParameterEUid);
   1.711 +							keyParams->AddL(KRsaPrivateKeyStandard, KRsaKeyTypeUid);
   1.712 +
   1.713 +							// create a key pair generator implementation interface
   1.714 +							TRAP_LOG(err,CKeyPairGeneratorFactory::CreateKeyPairGeneratorL(keypairImpl, 
   1.715 +																							KRSAKeyPairGeneratorUid, 
   1.716 +																							keyParams));
   1.717 +															
   1.718 +							CleanupStack::PushL(keypairImpl);
   1.719 +
   1.720 +							// Create a Key Pair	
   1.721 +							TRAP_LOG(err,keypairImpl->GenerateKeyPairL(1024, *keyParams, keyPair));
   1.722 +							
   1.723 +							CleanupStack::PushL(keyPair);
   1.724 +							
   1.725 +							CCryptoSpiStateApi::SetSelector(ruleSelector);
   1.726 +							//******************************************************************
   1.727 +							
   1.728 +							CSigner* signerImpl = NULL;	
   1.729 +							
   1.730 +						    TRAP_LOG(err,CSignatureFactory::CreateSignerL(signerImpl,
   1.731 +																	   		algorithmUid,
   1.732 +																	   		keyPair->PrivateKey(),
   1.733 +																	   		paddingMode,
   1.734 +																	   		NULL));
   1.735 +																	   
   1.736 +							if(signerImpl && (err == KErrNone))
   1.737 +								{
   1.738 +								plugin = static_cast<CCryptoBase*>(signerImpl);
   1.739 +								
   1.740 +								INFO_PRINTF1(_L("** Successfully Loaded Signer Object **"));
   1.741 +								SetTestStepResult(EPass);	
   1.742 +								}
   1.743 +							else
   1.744 +								{
   1.745 +								ERR_PRINTF2(_L("** Error: Loading Signer Object - %d **"), err);
   1.746 +								SetTestStepResult(EFail);
   1.747 +								}
   1.748 +							
   1.749 +							CleanupStack::PopAndDestroy(3,keyParams);	
   1.750 +							}
   1.751 +							
   1.752 +						break;
   1.753 +						}
   1.754 +						
   1.755 +					case KVerifierInterface:
   1.756 +						{
   1.757 +						TVariantPtrC algorithmUid;
   1.758 +						TVariantPtrC paddingMode;
   1.759 +						TVariantPtrC algorithmParams;
   1.760 +						
   1.761 +						//Each of the individual parameters required to create the Verifier object
   1.762 +						//are read in from the specified INI configuration file
   1.763 +						if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
   1.764 +							!GetStringFromConfig(ConfigSection(),KConfigPaddingMode,paddingMode) ||
   1.765 +							!GetStringFromConfig(ConfigSection(),KConfigAlgorithmParams,algorithmParams))
   1.766 +							{
   1.767 +							ERR_PRINTF1(_L("** .INI Error: Verifier Arguments Not Located **"));
   1.768 +							SetTestStepResult(EFail);
   1.769 +							}
   1.770 +						else
   1.771 +							{
   1.772 +							
   1.773 +							//********** Rule Selector Unselected to Create Key Pair ************
   1.774 +							CCryptoSpiStateApi::UnsetSelector();
   1.775 +							
   1.776 +							CCryptoParams* keyParams = CCryptoParams::NewLC(); 
   1.777 +							
   1.778 +							//Create Key Pair and Key Pair Generator Objects
   1.779 +				   			CKeyPair* keyPair = NULL;
   1.780 +							CKeyPairGenerator * keypairImpl = NULL;
   1.781 +							
   1.782 +							INFO_PRINTF1(_L("Generating RSA keys"));
   1.783 +							
   1.784 +							// create an RSA key pair
   1.785 +							keyParams->AddL(KKeyExponent, KRsaKeyParameterEUid);
   1.786 +							keyParams->AddL(KRsaPrivateKeyStandard, KRsaKeyTypeUid);
   1.787 +
   1.788 +							// create a key pair generator implementation interface
   1.789 +							TRAP_LOG(err,CKeyPairGeneratorFactory::CreateKeyPairGeneratorL(keypairImpl, 
   1.790 +																							KRSAKeyPairGeneratorUid, 
   1.791 +																							keyParams));
   1.792 +															
   1.793 +							CleanupStack::PushL(keypairImpl);
   1.794 +
   1.795 +							// Create a Key Pair	
   1.796 +							TRAP_LOG(err,keypairImpl->GenerateKeyPairL(1024, *keyParams, keyPair));
   1.797 +							
   1.798 +							CleanupStack::PushL(keyPair);
   1.799 +							
   1.800 +							CCryptoSpiStateApi::SetSelector(ruleSelector);
   1.801 +							//******************************************************************
   1.802 +							
   1.803 +							CVerifier* verifierImpl = NULL;	
   1.804 +							
   1.805 +						    TRAP_LOG(err,CSignatureFactory::CreateVerifierL(verifierImpl,
   1.806 +																	   		algorithmUid,
   1.807 +																	   		keyPair->PublicKey(),
   1.808 +																	   		paddingMode,
   1.809 +																	   		NULL));
   1.810 +																	   
   1.811 +							if(verifierImpl && (err == KErrNone))
   1.812 +								{
   1.813 +								plugin = static_cast<CCryptoBase*>(verifierImpl);
   1.814 +								
   1.815 +								INFO_PRINTF1(_L("** Successfully Loaded Verifier Object **"));
   1.816 +								SetTestStepResult(EPass);	
   1.817 +								}
   1.818 +							else
   1.819 +								{
   1.820 +								ERR_PRINTF2(_L("** Error: Loading Verifier Object - %d **"), err);
   1.821 +								SetTestStepResult(EFail);
   1.822 +								}
   1.823 +							
   1.824 +							CleanupStack::PopAndDestroy(3,keyParams);
   1.825 +							}
   1.826 +							
   1.827 +						break;
   1.828 +						}
   1.829 +						
   1.830 +					case KKeypairGeneratorInterface:
   1.831 +						{
   1.832 +						TVariantPtrC algorithmUid;
   1.833 +						TVariantPtrC algorithmParams;
   1.834 +						
   1.835 +						//Each of the individual parameters required to create the Key Pair Generator object
   1.836 +						//are read in from the specified INI configuration file
   1.837 +						if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
   1.838 +							!GetStringFromConfig(ConfigSection(),KConfigAlgorithmParams,algorithmParams))
   1.839 +							{
   1.840 +							ERR_PRINTF1(_L("** .INI Error: Key Pair Generator Arguments Not Located **"));
   1.841 +							SetTestStepResult(EFail);
   1.842 +							}
   1.843 +						else
   1.844 +							{
   1.845 +						
   1.846 +							CCryptoParams* keyParams = CCryptoParams::NewLC(); 
   1.847 +								
   1.848 +							//Create Key Pair and Key Pair Generator Objects
   1.849 +							CKeyPairGenerator * keypairImpl = NULL;
   1.850 +							
   1.851 +							INFO_PRINTF1(_L("Generating RSA keys"));
   1.852 +							
   1.853 +							// create an RSA key pair
   1.854 +							keyParams->AddL(KKeyExponent, KRsaKeyParameterEUid);
   1.855 +							keyParams->AddL(KRsaPrivateKeyStandard, KRsaKeyTypeUid);
   1.856 +
   1.857 +							// create a key pair generator implementation interface
   1.858 +							TRAP_LOG(err,CKeyPairGeneratorFactory::CreateKeyPairGeneratorL(keypairImpl, 
   1.859 +																							algorithmUid, 
   1.860 +																							keyParams));
   1.861 +																							
   1.862 +							if(keypairImpl && (err == KErrNone))
   1.863 +								{
   1.864 +								plugin = static_cast<CCryptoBase*>(keypairImpl);
   1.865 +								
   1.866 +								INFO_PRINTF1(_L("** Successfully Loaded Key Pair Generator Object **"));
   1.867 +								SetTestStepResult(EPass);	
   1.868 +								}
   1.869 +							else
   1.870 +								{
   1.871 +								ERR_PRINTF2(_L("** Error: Loading Key Pair Generator Object - %d **"), err);
   1.872 +								SetTestStepResult(EFail);
   1.873 +								}
   1.874 +								
   1.875 +							CleanupStack::PopAndDestroy(keyParams);
   1.876 +							}
   1.877 +						
   1.878 +						break;
   1.879 +						}
   1.880 +						
   1.881 +					case KKeyAgreementInterface:
   1.882 +						{
   1.883 +						TVariantPtrC algorithmUid;
   1.884 +						TVariantPtrC algorithmParams;
   1.885 +						
   1.886 +						//Each of the individual parameters required to create the Key Agreement object
   1.887 +						//are read in from the specified INI configuration file
   1.888 +						if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
   1.889 +							!GetStringFromConfig(ConfigSection(),KConfigAlgorithmParams,algorithmParams))
   1.890 +							{
   1.891 +							ERR_PRINTF1(_L("** .INI Error: Key Agreement Arguments Not Located **"));
   1.892 +							SetTestStepResult(EFail);
   1.893 +							}
   1.894 +						else
   1.895 +							{
   1.896 +							//********** Rule Selector Unselected to Create Key Pair ************
   1.897 +							CCryptoSpiStateApi::UnsetSelector();
   1.898 +	 		 
   1.899 +							RInteger DH_N = RInteger::NewPrimeL(64);
   1.900 +							CleanupClosePushL(DH_N);
   1.901 +							
   1.902 +							RInteger DH_N_MinusOne = RInteger::NewL(DH_N);
   1.903 +							CleanupClosePushL(DH_N_MinusOne);
   1.904 +							DH_N_MinusOne-=1;
   1.905 +							
   1.906 +							RInteger DH_G = RInteger::NewRandomL(TInteger::Two(), DH_N_MinusOne);	
   1.907 +							CleanupClosePushL(DH_G);
   1.908 +							
   1.909 +							CCryptoParams* keyParams = CCryptoParams::NewLC(); 
   1.910 +										
   1.911 +							TRAP_LOG(err,keyParams->AddL(DH_N, KDhKeyParameterNUid));
   1.912 +							TRAP_LOG(err,keyParams->AddL(DH_G, KDhKeyParameterGUid));
   1.913 +							
   1.914 +							//Create Key Pair and Key Pair Generator Objects
   1.915 +				   			CKeyPair* keyPair = NULL;
   1.916 +							CKeyPairGenerator * keypairImpl = NULL;
   1.917 +							
   1.918 +							INFO_PRINTF1(_L("Generating Key Pair..."));
   1.919 +							
   1.920 +							// create a key pair generator implementation interface
   1.921 +							TRAP_LOG(err,CKeyPairGeneratorFactory::CreateKeyPairGeneratorL(keypairImpl, 
   1.922 +																							KDHKeyPairGeneratorUid, 
   1.923 +																							keyParams));								
   1.924 +							CleanupStack::PushL(keypairImpl);
   1.925 +
   1.926 +							// Create a Key Pair	
   1.927 +							TRAP_LOG(err,keypairImpl->GenerateKeyPairL(NULL, *keyParams, keyPair));
   1.928 +							
   1.929 +							CleanupStack::PushL(keyPair);
   1.930 +							
   1.931 +							CCryptoSpiStateApi::SetSelector(ruleSelector);
   1.932 +							//******************************************************************
   1.933 +							
   1.934 +							CKeyAgreement* keyAgreementImpl = NULL;	
   1.935 +								
   1.936 +							TRAP_LOG(err,CKeyAgreementFactory::CreateKeyAgreementL(keyAgreementImpl,
   1.937 +																				algorithmUid,
   1.938 +																				keyPair->PrivateKey(),
   1.939 +																				keyParams));
   1.940 +																				
   1.941 +							if(keyAgreementImpl && (err == KErrNone))
   1.942 +								{
   1.943 +								plugin = static_cast<CCryptoBase*>(keyAgreementImpl);
   1.944 +								
   1.945 +								INFO_PRINTF1(_L("** Successfully Loaded Key Agreement Object **"));
   1.946 +								SetTestStepResult(EPass);	
   1.947 +								}
   1.948 +							else
   1.949 +								{
   1.950 +								ERR_PRINTF2(_L("** Error: Loading Key Agreement Object - %d **"), err);
   1.951 +								SetTestStepResult(EFail);
   1.952 +								}
   1.953 +								
   1.954 +							CleanupStack::PopAndDestroy(6,&DH_N);
   1.955 +							}
   1.956 +							
   1.957 +						break;
   1.958 +						}
   1.959 +						
   1.960 +					default:
   1.961 +						{
   1.962 +						ERR_PRINTF1(_L("** .INI Error: Interface Type Unknown **"));
   1.963 +						SetTestStepResult(EFail);
   1.964 +						break;	
   1.965 +						}
   1.966 +						
   1.967 +					}
   1.968 +				}		
   1.969 +				
   1.970 +			if(TestStepResult()==EPass)
   1.971 +				{
   1.972 +				//Push the selected implementation onto the Cleanup Stack
   1.973 +				CleanupStack::PushL(plugin);	
   1.974 +				
   1.975 +				//Assume faliure, unless all is successful
   1.976 +				SetTestStepResult(EFail);
   1.977 +				
   1.978 +				//Define a pointer of type TCharacteristics in order to store the appropriate
   1.979 +				//encryption object's characterisctics
   1.980 +				const TCharacteristics* characteristics(NULL);
   1.981 +					
   1.982 +				//Retrieve the characteristics for the symmetric cipher implementation object
   1.983 +				TRAP_LOG(err, plugin->GetCharacteristicsL(characteristics));
   1.984 +				
   1.985 +				TVariantPtrC exAlgorithmUid;
   1.986 +				TVariantPtrC exImplementationUid;
   1.987 +						
   1.988 +				if(!GetStringFromConfig(ConfigSection(),KConfigExAlgorithmUid,exAlgorithmUid) ||
   1.989 +					!GetStringFromConfig(ConfigSection(),KConfigExImplementationUid,exImplementationUid))
   1.990 +					{
   1.991 +					ERR_PRINTF1(_L("** .INI Error: Expected Algorithm Arguments Not Located **"));
   1.992 +					SetTestStepResult(EFail);
   1.993 +					}
   1.994 +				else
   1.995 +					{
   1.996 +					INFO_PRINTF1(_L("Checking Plug-in Selection..."));
   1.997 +					
   1.998 +					CPluginCharsChecker* pluginCheck = CPluginCharsChecker::NewLC();
   1.999 +					
  1.1000 +					TPtrC errorMessage;
  1.1001 +					
  1.1002 +					//Perform plug-in Check
  1.1003 +					if(pluginCheck->checkSelectedPlugin(characteristics,
  1.1004 +													exAlgorithmUid,
  1.1005 +													exImplementationUid,
  1.1006 +													errorMessage))
  1.1007 +						{
  1.1008 +						INFO_PRINTF1(_L("** PASS: Correct Plugin Implementation Selected **"));
  1.1009 +						SetTestStepResult(EPass);	
  1.1010 +						}
  1.1011 +					else
  1.1012 +						{
  1.1013 +						ERR_PRINTF2(_L("** FAIL: Wrong Plugin Implementation Selected - %S **"),&errorMessage);	
  1.1014 +						}
  1.1015 +					
  1.1016 +					CleanupStack::PopAndDestroy(pluginCheck);
  1.1017 +					}
  1.1018 +					
  1.1019 +				CleanupStack::PopAndDestroy(plugin);
  1.1020 +				}
  1.1021 +			
  1.1022 +			//Unselect Rule Selector	
  1.1023 +			CCryptoSpiStateApi::UnsetSelector();
  1.1024 +			
  1.1025 +			//Pop and Destroy Rule Selector from the Cleanup Stack	
  1.1026 +			CleanupStack::PopAndDestroy(ruleSelector);	
  1.1027 +			}	
  1.1028 +		}
  1.1029 +		
  1.1030 +	INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());		
  1.1031 +	return TestStepResult();
  1.1032 +	}
  1.1033 +
  1.1034 +
  1.1035 +TVerdict CRuleSelectCommonStep::doTestStepPostambleL()
  1.1036 +	{
  1.1037 +	return TestStepResult();
  1.1038 +	}
  1.1039 +