Skip to content

Latest commit

 

History

History
182 lines (124 loc) · 8.56 KB

中国电子口岸报文加签验证.md

File metadata and controls

182 lines (124 loc) · 8.56 KB

中国电子口岸报文加签验证

统一加签接口: http://localhost:8080/rpc/eport/signature

1 海关总署311 XML加签验证

入参:

image-20220215180751937

响应:

{
  "message": "操作成功",
  "success": true,
  "timestamp": "2022-02-15 17:53:27",
  "code": 200,
  "data": {
    "success": true,
    "certNo": "01691f7f",
    "x509Certificate": "MIIE+zCCBGSgAwIBAgIEAWkffzANBgkqhkiG9w0BAQUFADB8MQswCQYDVQQGEwJjbjEVMBMGA1UECh4MTi1W/XU1W1BT41y4MRUwEwYDVQQLHgyLwU5me6F0Bk4tX8MxDTALBgNVBAgeBFMXTqwxITAfBgNVBAMeGE4tVv11NVtQThpSoYvBTmZ7oXQGTi1fwzENMAsGA1UEBx4EUxdOrDAeFw0yMTA1MzEwMDAwMDBaFw0zMTA1MzEwMDAwMDBaMB4xDzANBgNVBAMeBoSLWSdOOjELMAkGA1UEEh4CADEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMtI8VNQW/F/tP4KvX6I8qV1IkthY596m59Cy1nWcYdq2MkJ9x7F35VekgJxbVumHTNJSBbOZs1hGTeuKaTLl3+xMhLQ+YQ4kfvJUwcbCIdPTewqrCyJAq1UKTTHjxgudwUahb9IviSzDo0j4PJtCommbd84EO7SxNiLw6Rpg9QnAgMBAAGjggLmMIIC4jALBgNVHQ8EBAMCBsAwCQYDVR0TBAIwADCBpwYDVR0jBIGfMIGcgBT5daN4RQtCaMIEU6vrw04+VHh0YKGBgKR+MHwxCzAJBgNVBAYTAmNuMRUwEwYDVQQKHgxOLVb9dTVbUFPjXLgxFTATBgNVBAseDIvBTmZ7oXQGTi1fwzENMAsGA1UECB4EUxdOrDEhMB8GA1UEAx4YTi1W/XU1W1BOGlKhi8FOZnuhdAZOLV/DMQ0wCwYDVQQHHgRTF06sggEAMB0GA1UdDgQWBBT1YEuTpXfAwy4GwPY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u5eC6+h0+Gttvo7baQT11w0I0xfDyBH7awuddcZyaLIU="
  }
}

自行生成用返回数据组装xml, 311推单, xml预览:

image-20220215181303331

省略发请求直接看返回:

image-20220215181519216

查询验签是否通过:

image-20220215181718468

回执单查询:

http://36.101.208.230:8090/ceb312msg?dxpid=DXPENT0000458763&qryid=202202151758

响应:

[
  {
    org_id=1,
    instm=1644919105000,
    re_order_guid=CEB311_HNZB_FXJK_20220215175237_0013,
    returnstatus=2,
    ebpcode=46121601BC,
    returntime2=20220215175825,
    ebccode=46121601BC,
    trans_dxpid=DXPENT0000458763,
    returninfo=新增申报成功
  [
    CEB311_HNZB_FXJK_20220215175237_0014
  ],
  returntime=1644919100000,
  orderno=20220215148803180891992064
  }
]

2 海关总署621 XML加签验证

http://localhost:8080/rpc/eport/signature

image-20220215183948685

{
  "message": "操作成功",
  "success": true,
  "timestamp": "2022-02-15 19:14:41",
  "code": 200,
  "data": {
    "success": true,
    "certNo": "01691f7f",
    "x509Certificate": "MIIE+zCCBGSgAwIBAgIEAWkffzANBgkqhkiG9w0BAQUFADB8MQswCQYDVQQGEwJj\nbjEVMBMGA1UECh4MTi1W/XU1W1BT41y4MRUwEwYDVQQLHgyLwU5me6F0Bk4tX8Mx\nDTALBgNVBAgeBFMXTqwxITAfBgNVBAMeGE4tVv11NVtQThpSoYvBTmZ7oXQGTi1f\nwzENMAsGA1UEBx4EUxdOrDAeFw0yMTA1MzEwMDAwMDBaFw0zMTA1MzEwMDAwMDBa\nMB4xDzANBgNVBAMeBoSLWSdOOjELMAkGA1UEEh4CADEwgZ8wDQYJKoZIhvcNAQEB\nBQADgY0AMIGJAoGBAMtI8VNQW/F/tP4KvX6I8qV1IkthY596m59Cy1nWcYdq2MkJ\n9x7F35VekgJxbVumHTNJSBbOZs1hGTeuKaTLl3+xMhLQ+YQ4kfvJUwcbCIdPTewq\nrCyJAq1UKTTHjxgudwUahb9IviSzDo0j4PJtCommbd84EO7SxNiLw6Rpg9QnAgMB\nAAGjggLm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1vhNjMU/qH7IkX79X3B1wHwiuLvMZPnRPNY0xO0uDc2lme8RDHDxC\nk7RhUupgDbgQIiEwITWYaqNP499wkQ8EK88wLRCiuybcFGTl5MXyOIpfZtaDnRcU\nu2Edyt07vcIEWgtJmR6TTEBehCE14v+fIKuAcFDPTg==\n",
    "digestValue": "5nkQYKEtVilTfyWeWDr8Q+WuFNM=",
    "signatureValue": "mclW30swezmNfgpftA0j6cJz0qoqEaHyu9Q/TD1605k76mYsEzre2i3XdTiyWfXw8RLmVlvS/LTThc64iUIr8Dd5AZqaOBOeD8wHZ2AJ9B6emX9c3P7KfWXz4VF1k47TQg8MjGGpOS/zE+s2pIJWGa8y6ku7s3Rwro92mZ1INag="
  }
}

image-20220215192458799

直接看推推单结果

image-20220215191938907

回执查询响应

image-20220215192525860

回执单查询:

http://36.101.208.230:8090/ceb622msg?dxpid=DXPENT0000458763&qryid=202202151758

3 海关179数据抓取验证

详见第4节

4 U-KEY加签signatureValueU-KEY无关验证

海关179数据抓取加签为例:

互联网+海关窗口

服务管理 -> 服务注册管理的证书编号: 01691fe9

加签海关179数据抓取ukey的证书编号: 01691f7f

步骤:

  • 在推送海关179数据前弄个断点把01691fe9签名的signatureValue替换成01691f7f加签返回的signatureValue的值,

image-20220217112041770

先看01691fe9 加签返回结果:Ocrba9PVqkNluFxjKdxVqbAMdqxq5B4EbmSqapdRL0WIblkG7cIeaOG/dMV3V2JoLAQuTtYDm7QNz9kfZGFgqFyHHVQWIRZbz7prchjI9rFXDGIRGafleX+gdlindZWE9p3ptROWcpKmBmVhg4aNBoVI0zETj8s25ewQQBpnrlM=

  • 使用01691f7f加签数据

访问项目: http://127.0.0.1:8080/

image-20220217121515713

01691f7f加签结果返回:

{
  "message": "操作成功",
  "success": true,
  "timestamp": "2022-02-17 12:15:52",
  "code": 200,
  "data": {
    "success": true,
    "certNo": "01691f7f",
    "signatureValue": "qFiqQB2BDLGrZWXVYh0ZXHYhfIWBvWrd7xM3tw78yW/eiwn0hgj+MdVHUsNc1RMgHhZoQihtVGrP5HZFcgtYmTBaxiHNoJ0gfS0sJBOOndyLV3WqOUn74HgRQXJ88pjjPw38SaTyTEsbLEGkDwfFvkbwD8W7/HHxx7bI/SUGJn8="
  }
}

01691fe9推送179数据给海关前替换java堆中01691fe9加签值为01691f7fsignatureValue值:

qFiqQB2BDLGrZWXVYh0ZXHYhfIWBvWrd7xM3tw78yW/eiwn0hgj+MdVHUsNc1RMgHhZoQihtVGrP5HZFcgtYmTBaxiHNoJ0gfS0sJBOOndyLV3WqOUn74HgRQXJ88pjjPw38SaTyTEsbLEGkDwfFvkbwD8W7/HHxx7bI/SUGJn8=

image-20220217122427291

提高警惕,重要的事情来了,我们直接看海关179数据抓取接口的返回信息:

{
  "code": "10000",
  "message": "上传成功",
  "total": 0,
  "serviceTime": 1645071876726
}

image-20220217123124100

到这里你应该相信你应该能明白我想表达什么了......

😇验签通过

以下图片来源于IDEADEBUG过程。