smf/smfcredentialmgr/smfcredmgrclient/smfcredmgrclient_p.cpp
changeset 18 013a02bf2bb0
parent 14 a469c0e6e7fb
child 24 1cee9f1b95e0
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
    12  * Description:
    12  * Description:
    13  * This is the private implementation Class on Symbian OS for Credential Manager Client.
    13  * This is the private implementation Class on Symbian OS for Credential Manager Client.
    14  *  Derives from CAtive to support asynchronous requests.
    14  *  Derives from CAtive to support asynchronous requests.
    15  *
    15  *
    16  */
    16  */
       
    17 
    17 //  Include Files
    18 //  Include Files
    18 #include <smfcredmgrcommon.h>
    19 #include <smfcredmgrcommon.h>
    19 #include <smfcredmgrclientdatastruct.h>
    20 #include <smfcredmgrclientdatastruct.h>
    20 #include <smfutils.h>
    21 #include <smfutils.h>
    21 #include <securitydefs.h>
    22 #include <securitydefs.h>
    70 	}
    71 	}
    71 
    72 
    72 TBool CSmfCredMgrClientSymbian::AuthDataSetL(QString RegToken,
    73 TBool CSmfCredMgrClientSymbian::AuthDataSetL(QString RegToken,
    73 		QDateTime Validity, SmfAuthParams& AuthTokenSet)
    74 		QDateTime Validity, SmfAuthParams& AuthTokenSet)
    74 	{
    75 	{
       
    76 	RDebug::Printf("+In AuthDataSetL()");
    75 	CSmfFetchAuthTokenSet* fetchAuthTokenSetParams =
    77 	CSmfFetchAuthTokenSet* fetchAuthTokenSetParams =
    76 			new (ELeave) CSmfFetchAuthTokenSet;
    78 			new (ELeave) CSmfFetchAuthTokenSet;
    77 
    79 
    78 	CleanupStack::PushL(fetchAuthTokenSetParams);
    80 	CleanupStack::PushL(fetchAuthTokenSetParams);
    79 
    81 
   108 	RBuf8 dataBuf;
   110 	RBuf8 dataBuf;
   109 	CleanupClosePushL(dataBuf);
   111 	CleanupClosePushL(dataBuf);
   110 	dataBuf.Create(outputptr);
   112 	dataBuf.Create(outputptr);
   111 
   113 
   112 	fetchAuthTokenSetParams->InternalizeL(dataBuf);
   114 	fetchAuthTokenSetParams->InternalizeL(dataBuf);
       
   115 
       
   116 
       
   117 	CleanupStack::PopAndDestroy(&dataBuf);
       
   118 	CleanupStack::PopAndDestroy(retBuf);
       
   119 	CleanupStack::PopAndDestroy(&stream);
       
   120 	CleanupStack::PopAndDestroy(buf);
   113 
   121 
   114 	//return EFalse if count is 0
   122 	//return EFalse if count is 0
   115 	if (fetchAuthTokenSetParams->iAuthTokenArray.Count() == 0)
   123 	if (fetchAuthTokenSetParams->iAuthTokenArray.Count() == 0)
   116 		{
   124 		{
   117 		return EFalse;
   125 		return EFalse;
   118 		}
   126 		}
   119 
   127 
   120 	smfcredmgrclientutil::RArrayToSmfAuthParams(
   128 	smfcredmgrclientutil::RArrayToSmfAuthParams(
   121 			fetchAuthTokenSetParams->iAuthTokenArray, AuthTokenSet);
   129 			fetchAuthTokenSetParams->iAuthTokenArray, AuthTokenSet);
   122 
   130 
   123 	CleanupStack::PopAndDestroy(&dataBuf);
   131 
   124 	CleanupStack::PopAndDestroy(retBuf);
       
   125 	CleanupStack::PopAndDestroy(&stream);
       
   126 	CleanupStack::PopAndDestroy(buf);
       
   127 	CleanupStack::PopAndDestroy(fetchAuthTokenSetParams);
   132 	CleanupStack::PopAndDestroy(fetchAuthTokenSetParams);
   128 
   133 	RDebug::Printf("-In AuthDataSetL()");
   129 	return ETrue;
   134 	return ETrue;
   130 	}
   135 	}
   131 
   136 
   132 QString CSmfCredMgrClientSymbian::storeAuthDataL(SmfAuthParams Set,
   137 QString CSmfCredMgrClientSymbian::storeAuthDataL(SmfAuthParams Set,
   133 		QDateTime Validity, QList<QUrl> URLList, QStringList PluginList,
   138 		QDateTime Validity, QList<QUrl> URLList, QStringList PluginList,
   134 		QString AuthAppAID, bool Flag)
   139 		QString AuthAppAID, bool Flag)
   135 	{
   140 	{
   136 
   141 	RDebug::Printf("+In storeAuthDataL()");
   137 	CSmfStoreAuthParams* authenticationProcessData =
   142 	CSmfStoreAuthParams* authenticationProcessData =
   138 			new (ELeave) CSmfStoreAuthParams;
   143 			new (ELeave) CSmfStoreAuthParams;
   139 	CleanupStack::PushL(authenticationProcessData);
   144 	CleanupStack::PushL(authenticationProcessData);
   140 
   145 
   141 	//create space for iRegistrationToken
   146 	//create space for iRegistrationToken
   142 	authenticationProcessData->iRegistrationToken = HBufC::NewL(
   147 	authenticationProcessData->iRegistrationToken = HBufC::NewL(
   143 			KMaxRegistrationTokenLength);
   148 			KMaxRegistrationTokenLength);
   144 
   149 
   145 	TPtr8 regTokenPtr(
       
   146 			authenticationProcessData->iRegistrationToken->Des().Collapse());
       
   147 
   150 
   148 	//fill the input params
   151 	//fill the input params
   149 	smfcredmgrclientutil::SmfAuthParamstoRArray(Set,
   152 	smfcredmgrclientutil::SmfAuthParamstoRArray(Set,
   150 			authenticationProcessData->iAuthTokenArray);
   153 			authenticationProcessData->iAuthTokenArray);
   151 	authenticationProcessData->pluginIDEnabled = Flag;
   154 	authenticationProcessData->pluginIDEnabled = Flag;
   173 
   176 
   174 	TPtr8 bufPtr = buf->Ptr(0);
   177 	TPtr8 bufPtr = buf->Ptr(0);
   175 
   178 
   176 	TIpcArgs args;
   179 	TIpcArgs args;
   177 	args.Set(0, &bufPtr);
   180 	args.Set(0, &bufPtr);
   178 	args.Set(1, &regTokenPtr);
   181 
       
   182 	
       
   183 	// to get the data from server, we create a space.
       
   184 	HBufC8* retBuf = HBufC8::NewL(KMaxBufSize);
       
   185 	CleanupStack::PushL(retBuf);
       
   186 
       
   187 	TPtr8 outputptr = retBuf->Des();
       
   188 	args.Set(1, &outputptr);
       
   189 
   179 	iSession.RequestService(EStoreAuthData, args);
   190 	iSession.RequestService(EStoreAuthData, args);
   180 
   191 
   181 	TPtr wideRegToken = regTokenPtr.Expand();
   192 	//create buffer to read data received
       
   193 	RBuf8 dataBuf;
       
   194 	CleanupClosePushL(dataBuf);
       
   195 	dataBuf.Create(outputptr);
       
   196 
       
   197 	authenticationProcessData->InternalizeL(dataBuf);
       
   198 
       
   199 	TPtr regTokenPtr(
       
   200 			authenticationProcessData->iRegistrationToken->Des());
   182 
   201 
   183 	//convert and return
   202 	//convert and return
   184 	QString regString = qt_TDes2QString(wideRegToken);
   203 	QString regString = qt_TDes2QString( regTokenPtr );
   185 
   204 
       
   205 	CleanupStack::PopAndDestroy(&dataBuf);
       
   206 	CleanupStack::PopAndDestroy(retBuf);
   186 	CleanupStack::PopAndDestroy(&stream);
   207 	CleanupStack::PopAndDestroy(&stream);
   187 	CleanupStack::PopAndDestroy(buf);
   208 	CleanupStack::PopAndDestroy(buf);
   188 	CleanupStack::Pop();
   209 	CleanupStack::Pop();
   189 
   210 
   190 	return regString;
   211 	return regString;
   502 
   523 
   503 	CleanupStack::Pop(retBuf);
   524 	CleanupStack::Pop(retBuf);
   504 	CleanupStack::PopAndDestroy(buf);
   525 	CleanupStack::PopAndDestroy(buf);
   505 	CleanupStack::PopAndDestroy(storeRSAKeysparams);
   526 	CleanupStack::PopAndDestroy(storeRSAKeysparams);
   506 
   527 
       
   528 	RDebug::Printf("-In storeAuthDataL()");
       
   529 	
   507 	return (RetString);
   530 	return (RetString);
   508 
   531 
   509 	}
   532 	}
   510 
   533 
   511 void CSmfCredMgrClientSymbian::deleteRSAKey(QString KeyLabel)
   534 void CSmfCredMgrClientSymbian::deleteRSAKey(QString KeyLabel)