cryptoservices/filebasedcertificateandkeystores/test/tkeystore/t_addkey.cpp
changeset 8 35751d3474b7
parent 0 2c201484c85f
child 15 da2ae96f639b
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
    66 void CAddKey::ConstructL(const TTestActionSpec& aTestActionSpec)
    66 void CAddKey::ConstructL(const TTestActionSpec& aTestActionSpec)
    67 {
    67 {
    68 	CKeyStoreTestAction::ConstructL(aTestActionSpec);
    68 	CKeyStoreTestAction::ConstructL(aTestActionSpec);
    69 
    69 
    70 	SetKeySize(Input::ParseElement(aTestActionSpec.iActionBody, KKeySizeStart));
    70 	SetKeySize(Input::ParseElement(aTestActionSpec.iActionBody, KKeySizeStart));
    71 	SetStartDate(Input::ParseElement(aTestActionSpec.iActionBody, KKeyStartDateStart));
    71 	SetStartDateL(Input::ParseElement(aTestActionSpec.iActionBody, KKeyStartDateStart));
    72 	SetEndDate(Input::ParseElement(aTestActionSpec.iActionBody, KKeyEndDateStart));
    72 	SetEndDateL(Input::ParseElement(aTestActionSpec.iActionBody, KKeyEndDateStart));
    73 }
    73 }
    74 
    74 
    75 void CAddKey::SetKeySize(const TDesC8& aKeySize)
    75 void CAddKey::SetKeySize(const TDesC8& aKeySize)
    76 	{
    76 	{
    77 	TLex8 lex(aKeySize);
    77 	TLex8 lex(aKeySize);
    83 	switch (iState)
    83 	switch (iState)
    84 		{
    84 		{
    85 		case EAddKey:
    85 		case EAddKey:
    86 			{
    86 			{
    87 			CUnifiedKeyStore* keyStore = CSharedKeyStores::TheUnifiedKeyStores().operator[](iKeystore);
    87 			CUnifiedKeyStore* keyStore = CSharedKeyStores::TheUnifiedKeyStores().operator[](iKeystore);
    88 		
    88 			#ifdef SYMBIAN_AUTH_SERVER		
    89 			keyStore->CreateKey(0, iUsage, iSize, *iLabel, iAlgorithm,
    89 			if(iUseNewApi)
       
    90 				{
       
    91 				keyStore->CreateKey(0, iUsage, iSize, *iLabel, iAlgorithm,
       
    92 												iAccessType, iStartDate, iEndDate, *iAuthExpression, iFreshness, iKeyInfo, aStatus);
       
    93 				}
       
    94 			else
       
    95 			#endif // SYMBIAN_AUTH_SERVER
       
    96 				{
       
    97 				keyStore->CreateKey(0, iUsage, iSize, *iLabel, iAlgorithm,
    90 								iAccessType, iStartDate, iEndDate, iKeyInfo, aStatus);
    98 								iAccessType, iStartDate, iEndDate, iKeyInfo, aStatus);
    91 
    99 
       
   100 				}			
    92 			iState = EFinished;
   101 			iState = EFinished;
    93 			}
   102 			}
    94 			break;
   103 			break;
    95 
   104 
    96 		case EFinished:
   105 		case EFinished:
   181 		}
   190 		}
   182 	}
   191 	}
   183 }
   192 }
   184 
   193 
   185 
   194 
   186 void CAddKey::SetStartDate(const TDesC8& aData)
   195 void CAddKey::SetStartDateL(const TDesC8& aData)
   187 	{
   196 	{
   188     if (aData.Length() == 0)
   197     if (aData.Length() == 0)
   189 		return;
   198 		return;
   190 
   199 
   191 	HBufC* buf = HBufC::NewLC(aData.Length());
   200 	HBufC* buf = HBufC::NewLC(aData.Length());
   193 	ptr.Copy(aData);	
   202 	ptr.Copy(aData);	
   194 	User::LeaveIfError(iStartDate.Parse(*buf));
   203 	User::LeaveIfError(iStartDate.Parse(*buf));
   195 	CleanupStack::PopAndDestroy(buf);
   204 	CleanupStack::PopAndDestroy(buf);
   196 	}
   205 	}
   197 
   206 
   198 void CAddKey::SetEndDate(const TDesC8& aData)
   207 void CAddKey::SetEndDateL(const TDesC8& aData)
   199 	{
   208 	{
   200     if (aData.Length() == 0)
   209     if (aData.Length() == 0)
   201 		return;
   210 		return;
   202 
   211 
   203 	HBufC* buf = HBufC::NewLC(aData.Length());
   212 	HBufC* buf = HBufC::NewLC(aData.Length());