Sfoglia il codice sorgente

Z991239-4958 #comment 拆掉密钥加载的部分,因为上线有依赖kmc、主机

oilyang 1 anno fa
parent
commit
bb568c792d

+ 11 - 78
Module/mod_accessauth/AccessAuthFSM.cpp

@@ -302,41 +302,11 @@ struct UpdateWKTask : ITaskSp
 		CAccessAuthUpdateWKReq updateWKReq;
 		updateWKReq.terminalNo = si.strTerminalID.GetData();
 		auto tmkpair = m_entity->GenerateTmkToKMC();//first是加密的,seconde是没加密的
-		updateWKReq.encRandom = tmkpair.first;
-
-		PinPadService_ClientBase* pPinPad = new PinPadService_ClientBase(this->m_entity);
-		auto errRc = pPinPad->Connect();
-		if (errRc == Error_Succeed)
-		{
-			PinPadService_GetCheckCode_Req req = {};
-			PinPadService_GetCheckCode_Ans ans = {};
-
-			req.mSN.Init(1);
-			req.wSN.Init(1);
-			req.mSN[0] = 1;
-			req.wSN[0] = 0;
-			errRc = (*pPinPad)(EntityResource::getLink().upgradeLink())->GetCheckCode(req, ans, 10000);
-			if (errRc == Error_Succeed)
-			{
-				updateWKReq.tpkKeyCheck = ans.checkcode[0].GetData();
-				updateWKReq.keyIndex = ans.index[0].GetData();
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("Get keyChek && keyIndex suc.");
-			}
-			else
-			{
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("Get keyChek && keyIndex failed.");
-			}
-
-			pPinPad->GetFunction()->CloseSession();
-		}
-		else
-		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("connect to pinpad failed.error code:%d", errRc);
-		}
 
+		updateWKReq.encRandom = tmkpair.first;
 		CAccessAuthUpdateWKRet updateWKRet;
 		updateWKReq.m_url = m_fsm->GetmAccessAuthHost();
-		updateWKReq.m_url += "/api/v5/wkupdate";
+		updateWKReq.m_url += "/api/v3/wkupdate";
 		long beg = GetTickCount();
 		bool ret = client->Post(updateWKReq, updateWKRet);
 		long end = GetTickCount();
@@ -357,7 +327,7 @@ struct UpdateWKTask : ITaskSp
 
 
 			ErrorCodeEnum eLoadErr = m_entity->LoadKeysToPinPadACS(tmkpair.second, updateWKRet.tpk,
-				updateWKRet.edk, updateWKRet.keyIndex);
+				updateWKRet.edk, updateWKRet.index);
 			if (eLoadErr == Error_Succeed) {
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("LoadKeysToPinPadNew")
 					("UpdateWKTask LoadKeysToPinPadNew Success");
@@ -386,12 +356,9 @@ struct UpdateWKTask : ITaskSp
 #else
 		struct UpdateWKReq
 		{
-			string terminalNo;
-			string encRandom;
-			string tpkKeyCheck; //tpk密钥校验值
-			string edkKeyCheck; //edk密钥校验值
-			string keyIndex; //密钥序号
-			JSONCONVERT2OBJECT_MEMEBER_REGISTER(terminalNo, encRandom, tpkKeyCheck, edkKeyCheck, keyIndex)
+			std::string terminalNo;
+			std::string encRandom;
+			JSONCONVERT2OBJECT_MEMEBER_REGISTER(terminalNo, encRandom)
 		} updateWKReq;
 
 		struct UpdateWKAns
@@ -399,49 +366,17 @@ struct UpdateWKTask : ITaskSp
 			string tmk;
 			string tpk;
 			string edk;
-			string tpkKeyCheck; //密钥校验值
-			string edkKeyCheck; //edk密钥校验值
-			string keyIndex; //密钥序号
-			JSONCONVERT2OBJECT_MEMEBER_REGISTER(tmk, tpk, edk, tpkKeyCheck, edkKeyCheck, keyIndex)
+			string index;
+			JSONCONVERT2OBJECT_MEMEBER_REGISTER(tmk, tpk, edk, index)
 		} updateWKAns;
 
 		updateWKReq.terminalNo = si.strTerminalID.GetData();
 		auto tmkpair = m_entity->GenerateTmkToKMC();//first是加密的,seconde是没加密的
 		updateWKReq.encRandom = tmkpair.first;
 
-		PinPadService_ClientBase* pPinPad = new PinPadService_ClientBase(this->m_entity);
-		auto errRc = pPinPad->Connect();
-		if (errRc == Error_Succeed)
-		{
-			PinPadService_GetCheckCode_Req req = {};
-			PinPadService_GetCheckCode_Ans ans = {};
-
-			req.mSN.Init(1);
-			req.wSN.Init(1);
-			req.mSN[0] = 1;
-			req.wSN[0] = 0;
-			errRc = (*pPinPad)(EntityResource::getLink().upgradeLink())->GetCheckCode(req, ans, 10000);
-			if (errRc == Error_Succeed)
-			{
-				updateWKReq.tpkKeyCheck = ans.checkcode[0].GetData();
-				updateWKReq.keyIndex = ans.index[0].GetData();
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("Get keyChek && keyIndex suc.");
-			}
-			else
-			{
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("Get keyChek && keyIndex failed.");
-			}
-
-			pPinPad->GetFunction()->CloseSession();
-		}
-		else
-		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("connect to pinpad failed.error code:%d", errRc);
-		}
-
 		HttpClientResponseResult result;
 		HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData());
-		config.SetChildUri("/api/v5/wkupdate");
+		config.SetChildUri("/api/v3/wkupdate");
 
 		SP::Module::Restful::FulfillRequestJsonBody(&config, updateWKReq);
 
@@ -466,11 +401,9 @@ struct UpdateWKTask : ITaskSp
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tmk=%s %d", updateWKAns.tmk.c_str(), updateWKAns.tmk.size());
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tpk=%s %d", updateWKAns.tpk.c_str(), updateWKAns.tpk.size());
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("edk=%s %d", updateWKAns.edk.c_str(), updateWKAns.edk.size());
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tpkKeyCheck=%s %d", updateWKAns.tpkKeyCheck.c_str(), updateWKAns.tpkKeyCheck.size());
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("edkKeyCheck=%s %d", updateWKAns.edkKeyCheck.c_str(), updateWKAns.edkKeyCheck.size());
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("index=%s %d", updateWKAns.keyIndex.c_str(), updateWKAns.keyIndex.size());
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("index=%s %d", updateWKAns.index.c_str(), updateWKAns.index.size());
 
-			DWORD rc = m_entity->LoadKeysToPinPadACS(tmkpair.second, updateWKAns.tpk, updateWKAns.edk, updateWKAns.keyIndex);
+			DWORD rc = m_entity->LoadKeysToPinPadACS(tmkpair.second, updateWKAns.tpk, updateWKAns.edk, updateWKAns.index);
 			if (rc == Error_Succeed) {
 				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew Success");
 				return;

+ 6 - 33
Module/mod_accessauth/AccessAuthFSM.h

@@ -67,16 +67,10 @@ typedef struct CSessionkeySynRet : CHTTPRet {
 typedef struct CAccessAuthUpdateWKReq : CHTTPReq {
 	string terminalNo;
 	string encRandom;
-	string tpkKeyCheck; //tpk密钥校验值
-	string edkKeyCheck; //edk密钥校验值
-	string keyIndex; //密钥序号
 	string ToJson() {
 		Json::Value value;
 		value[REFLECTION(terminalNo)] = terminalNo;
 		value[REFLECTION(encRandom)] = encRandom;
-		value[REFLECTION(tpkKeyCheck)] = tpkKeyCheck;
-		value[REFLECTION(edkKeyCheck)] = edkKeyCheck;
-		value[REFLECTION(keyIndex)] = keyIndex;
 		Json::FastWriter writer;
 		string strData = writer.write(value);
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CAccessAuthUpdateWKReq")
@@ -89,9 +83,7 @@ typedef struct CAccessAuthUpdateWKReq : CHTTPReq {
 typedef struct CAccessAuthUpdateWKRet : CHTTPRet {
 	string tpk;
 	string edk;
-	string tpkKeyCheck; //密钥校验值
-	string edkKeyCheck; //edk密钥校验值
-	string keyIndex; //密钥序号
+	string index;
 
 	bool Parse(string strData) {
 		Json::Value root;
@@ -100,9 +92,7 @@ typedef struct CAccessAuthUpdateWKRet : CHTTPRet {
 
 		tpk = root["data"][REFLECTION(tpk)].asString();
 		edk = root["data"][REFLECTION(edk)].asString();
-		tpkKeyCheck = root["data"][REFLECTION(tpkKeyCheck)].asString();
-		edkKeyCheck = root["data"][REFLECTION(edkKeyCheck)].asString();
-		keyIndex = root["data"][REFLECTION(keyIndex)].asString();
+		index = root["data"][REFLECTION(index)].asString();
 
 		return true;
 	}
@@ -247,9 +237,6 @@ typedef struct CInitlizerMKReq : CHTTPReq {
 	string auth;//预留鉴权
 	int loginWay;//1表示错误页发起,需要传入登录密码;0表示用户桌面发起,不需要传入登录密码
 	string encRandom; //tmk pk加密的随机密钥
-	string tpkKeyCheck; //密钥校验值
-	string edkKeyCheck; //密钥校验值
-	string keyIndex; //密钥序号
 
 	string ToJson() {
 #ifdef RVC_OS_WIN
@@ -275,9 +262,6 @@ typedef struct CInitlizerMKReq : CHTTPReq {
 		value[REFLECTION(auth)] = auth;
 		value[REFLECTION(loginWay)] = loginWay;
 		value[REFLECTION(encRandom)] = encRandom;
-		value[REFLECTION(tpkKeyCheck)] = tpkKeyCheck;
-		value[REFLECTION(edkKeyCheck)] = edkKeyCheck;
-		value[REFLECTION(keyIndex)] = keyIndex;
 		Json::FastWriter writer;
 		string strData = writer.write(value);
 
@@ -307,9 +291,6 @@ typedef struct CInitlizerMKReq : CHTTPReq {
 		rvcJson.AddStringToObject(REFLECTION(auth), (char*)auth.c_str());
 		rvcJson.AddNumberToObject(REFLECTION(loginWay), loginWay);
 		rvcJson.AddStringToObject(REFLECTION(encRandom), (char*)encRandom.c_str());
-		rvcJson.AddStringToObject(REFLECTION(tpkKeyCheck), (char*)tpkKeyCheck.c_str());
-		rvcJson.AddStringToObject(REFLECTION(edkKeyCheck), (char*)edkKeyCheck.c_str());
-		rvcJson.AddStringToObject(REFLECTION(keyIndex), (char*)keyIndex.c_str());
 		string ret;
 		char* tmp = rvcJson.GetJsonStr();
 		ret.assign(tmp);
@@ -325,9 +306,7 @@ typedef struct CInitlizerMKRet : CHTTPRet {
 #ifdef RVC_OS_WIN
 	string tpk;
 	string edk;
-	string tpkKeyCheck;
-	string edkKeyCheck;
-	string keyIndex;
+	string index;
 
 	bool Parse(string strData) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CInitlizerMKRet")("ret=%s at CInitlizerMKRet", strData.c_str());
@@ -337,9 +316,7 @@ typedef struct CInitlizerMKRet : CHTTPRet {
 		reader.parse(strData, root, false);
 		tpk = root["data"][REFLECTION(tpk)].asString();
 		edk = root["data"][REFLECTION(edk)].asString();
-		tpkKeyCheck = root["data"][REFLECTION(tpkKeyCheck)].asString();
-		edkKeyCheck = root["data"][REFLECTION(edkKeyCheck)].asString();
-		keyIndex = root["data"][REFLECTION(keyIndex)].asString();
+		index = root["data"][REFLECTION(index)].asString();
 		return true;
 	}
 #else
@@ -347,9 +324,7 @@ typedef struct CInitlizerMKRet : CHTTPRet {
 		string TMK;
 		string TPK;
 		string EDK;
-		string tpkKeyCheck;
-		string edkKeyCheck;
-		string keyIndex;
+		string index;
 		string reserved;
 	} data;
 	bool Parse(string strData) {
@@ -361,9 +336,7 @@ typedef struct CInitlizerMKRet : CHTTPRet {
 		data.TMK = retJson->GetStringValue(REFLECTION(tmk));
 		data.TPK = retJson->GetStringValue(REFLECTION(tpk));
 		data.EDK = retJson->GetStringValue(REFLECTION(edk));
-		data.tpkKeyCheck = retJson->GetStringValue(REFLECTION(tpkKeyCheck));
-		data.edkKeyCheck = retJson->GetStringValue(REFLECTION(edkKeyCheck));
-		data.keyIndex = retJson->GetStringValue(REFLECTION(keyIndex));
+		data.index = retJson->GetStringValue(REFLECTION(index));
 		rvcJson.Destory();
 		retJson->Destory();
 		delete retJson;

+ 17 - 53
Module/mod_accessauth/mod_AccessAuth.cpp

@@ -53,7 +53,7 @@ struct InitializerInitMKTask : ITaskSp
 		auto tmkpair = m_entity->GenerateTmkToKMC();
 		initMKReq.encRandom = tmkpair.first;
 		initMKReq.m_url = m_entity->GetInitUrl();
-		initMKReq.m_url += "/api/v5/initmk";
+		initMKReq.m_url += "/api/v3/initmk";
 		long beg = GetTickCount();
 		bool ret = client->Post(initMKReq, initMKRet);
 		long end = GetTickCount();
@@ -67,7 +67,7 @@ struct InitializerInitMKTask : ITaskSp
 				return;
 			}
 			if (m_entity->HasPinPad()) {
-				if (m_entity->LoadKeysToPinPadACS(tmkpair.second, initMKRet.tpk, initMKRet.edk, initMKRet.keyIndex) == Error_Succeed)
+				if (m_entity->LoadKeysToPinPadACS(tmkpair.second, initMKRet.tpk, initMKRet.edk, initMKRet.index) == Error_Succeed)
 					m_entity->EndInitMK(Error_Succeed, "");
 				else
 					m_entity->EndInitMK(ERR_INITIALIZER_INIT_EXCEPTION, "加载秘钥到密码键盘失败,请检查密码键盘连接状态,多次失败请联系厂商排查。");//,待完善细化错误码oiltest
@@ -108,13 +108,10 @@ struct InitializerInitMKTask : ITaskSp
 			string auth;//预留鉴权
 			int loginWay;//1表示错误页发起,需要传入登录密码;0表示用户桌面发起,不需要传入登录密码
 			string encRandom; //tmk pk加密的随机密钥
-			string tpkKeyCheck; //密钥校验值
-			string edkKeyCheck; //密钥校验值
-			string keyIndex; //密钥序号
 
 			JSONCONVERT2OBJECT_MEMEBER_REGISTER(enrolAddr, enrolGPS, installVersion, ip, machineModel, machineType,
 				padDeviceID, site, terminalNo, factory, modal, type, version, terminalCharacter, pinPadID, publicKey,
-				user, password, auth, loginWay, encRandom, tpkKeyCheck, edkKeyCheck, keyIndex)
+				user, password, auth, loginWay, encRandom)
 
 		} instanceReq;
 
@@ -138,27 +135,23 @@ struct InitializerInitMKTask : ITaskSp
 		instanceReq.password = initMKReq.password;
 		instanceReq.auth = initMKReq.auth;
 		instanceReq.loginWay = initMKReq.loginWay;
+
 		instanceReq.encRandom = tmkpair.first;
-		instanceReq.tpkKeyCheck = initMKReq.tpkKeyCheck;
-		instanceReq.edkKeyCheck = initMKReq.edkKeyCheck;
-		instanceReq.keyIndex = initMKReq.keyIndex;
 
 		struct InstanceAnsJson
 		{
 			string TMK;
 			string TPK;
 			string EDK;
-			string tpkKeyCheck;
-			string edkKeyCheck;
-			string keyIndex;
+			string index;
 			string reserved;
-			JSONCONVERT2OBJECT_MEMEBER_REGISTER(TMK, TPK, EDK, tpkKeyCheck, edkKeyCheck, keyIndex)
-				JSONCONVERT2OBJECT_MEMEBER_RENAME_REGISTER("tmk", "tpk", "edk", "tpkKeyCheck", "edkKeyCheck", "keyIndex")
+			JSONCONVERT2OBJECT_MEMEBER_REGISTER(TMK, TPK, EDK, index)
+				JSONCONVERT2OBJECT_MEMEBER_RENAME_REGISTER("tmk", "tpk", "edk", "index")
 		} instanceAns;
 
 		HttpClientResponseResult result;
 		HttpClientRequestConfig config(HttpRequestMethod::POST, m_entity->GetInitUrl().GetData());
-		config.SetChildUri("/api/v5/initmk");
+		config.SetChildUri("/api/v3/initmk");
 		SP::Module::Restful::FulfillRequestJsonBody(&config, instanceReq);
 
 		std::string test;
@@ -181,7 +174,7 @@ struct InitializerInitMKTask : ITaskSp
 				if (m_entity->HasPinPad()) {
 					const bool testResult = SP::Module::Restful::ExtractDataFromDebranchResponse(result.content, instanceAns);
 					Dbg("ExtractDataFromDebranchResponse returned: %d", testResult);
-					if (m_entity->LoadKeysToPinPadACS(tmkpair.second, instanceAns.TPK, instanceAns.EDK, instanceAns.keyIndex) == Error_Succeed) {
+					if (m_entity->LoadKeysToPinPadACS(tmkpair.second, instanceAns.TPK, instanceAns.EDK, instanceAns.index) == Error_Succeed) {
 						m_entity->EndInitMK(Error_Succeed, "");
 					}
 					else {
@@ -397,7 +390,7 @@ DWORD CAccessAuthEntity::SaveSM2KeyPair(const CBlob &pubKey, const CBlob &priKey
 		req.pub_key = pubKey;
 		req.pri_key = priKey;
 		TokenService_SetKeyPair_Ans ans;
-		rc = pTokenServiceClient->SetKeyPair(req, ans, 3000);
+		rc = (*pTokenServiceClient)(EntityResource::getLink().upgradeLink())->SetKeyPair(req, ans, 3000);
 		pTokenServiceClient->GetFunction()->CloseSession();
 		if (rc != Error_Succeed)
 		{
@@ -440,8 +433,9 @@ ErrorCodeEnum CAccessAuthEntity::SaveTokenAndSharedSK(const CBlob &token, const
 	{
 		TokenService_SetToken_Req req = {};
 		req.token = token;
-		TokenService_SetToken_Ans ans;
-		rc = pTokenServiceClient->SetToken(req, ans, 5000);
+		TokenService_SetToken_Ans ans; 
+		EntityResource::setLink(EntityResource::getLink().upgradeLink());
+		rc = (*pTokenServiceClient)(EntityResource::getLink())->SetToken(req, ans, 5000);
 		if (rc == Error_Succeed)
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("SetToken")
 				("save token succ, token: [%s]", ByteArrayToHexStr((BYTE*)token.m_pData, token.m_iLength).c_str());
@@ -459,7 +453,7 @@ ErrorCodeEnum CAccessAuthEntity::SaveTokenAndSharedSK(const CBlob &token, const
 		TokenService_SetSharedSK_Req req2 = {};
 		req2.ssk = sharedSK;
 		TokenService_SetSharedSK_Ans ans2 = {};
-		rc = pTokenServiceClient->SetSharedSK(req2, ans2, 5000);
+		rc = (*pTokenServiceClient)(EntityResource::getLink().upgradeLink())->SetSharedSK(req2, ans2, 5000);
 		if (rc == Error_Succeed)
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("SetSharedSK")
 				("save shared session key succ");
@@ -560,7 +554,7 @@ int CAccessAuthEntity::GetPinPadCapability()
 		PinPadService_QueryFunc_Req req;
 		PinPadService_QueryFunc_Ans ans;
 
-		rc = pPinPad->QueryFunc(req, ans, 3000);
+		rc = (*pPinPad)(EntityResource::getLink().upgradeLink())->QueryFunc(req,ans,3000);
 		if (rc == Error_Succeed)
 		{
 			nCapability = ans.encryptkey;
@@ -1110,7 +1104,7 @@ int CAccessAuthEntity::GetPinPadIDAndDeviceID(CSimpleStringA &strPinPadID, CSimp
 		PinPadService_GetDevInfo_Req req = {};
 		PinPadService_GetDevInfo_Ans ans = {};
 
-		rc = pPinPadClient->GetDevInfo(req, ans, 3000);
+		auto rc = (*pPinPadClient)(EntityResource::getLink().upgradeLink())->GetDevInfo(req, ans, 3000);
 		if (rc == Error_Succeed)
 		{
 			if (ans.state == DEVICE_STATUS_NORMAL)
@@ -1604,36 +1598,6 @@ bool CAccessAuthEntity::SendInitMKReqACS(CInitlizerMKReq& initMKReq)
 		initMKReq.loginWay = 0;
 	}
 
-	PinPadService_ClientBase* pPinPad = new PinPadService_ClientBase(this);
-	auto errRc = pPinPad->Connect();
-	if (errRc == Error_Succeed)
-	{
-		PinPadService_GetCheckCode_Req req = {};
-		PinPadService_GetCheckCode_Ans ans = {};
-
-		req.mSN.Init(1);
-		req.wSN.Init(1);
-		req.mSN[0] = 1;
-		req.wSN[0] = 0;
-		errRc = (*pPinPad)(EntityResource::getLink().upgradeLink())->GetCheckCode(req, ans, 10000);
-		if (errRc == Error_Succeed)
-		{
-			initMKReq.tpkKeyCheck = ans.checkcode[0].GetData();
-			initMKReq.keyIndex = ans.index[0].GetData();
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("SendInitMKReqACS")("Get keyChek && keyIndex suc.");
-		}
-		else
-		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("SendInitMKReqACS")("Get keyChek && keyIndex failed.");
-		}
-
-		pPinPad->GetFunction()->CloseSession();
-	}
-	else
-	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("QueryCheckCode")("connect to pinpad failed.error code:%d", errRc);
-	}
-
 	return true;
 }
 
@@ -1719,7 +1683,7 @@ ErrorCodeEnum CAccessAuthEntity::LoadKeysToPinPadACS(string TMK, string TPK, str
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("LoadKeysToPinPadACS")("req.reserved3=%s", req.reserved3.GetData());
 
 		PinPadService_LoadKeysSM_Ans ans = {};
-		rc = pPinPad->LoadKeysSM(req, ans, 30000);
+		rc = (*pPinPad)(EntityResource::getLink().upgradeLink())->LoadKeysSM(req, ans, 30000);
 		if (rc == Error_Succeed)
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("LoadKeysToPinPadACS")("load sm key to pinpad succ");
 		else