|
@@ -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
|