回调接口参数说明
<p>[TOC]</p>
<h4>回调接口参数说明</h4>
<p>该接口需要支持免登录请求,为确保通信安全,相关返回报文加密后返回,返回报文通过指定的秘钥进行解密,秘钥维护在档案系统应用注册的地方。</p>
<h5>接口说明</h5>
<ul>
<li>加密算法:DES</li>
<li>请求URL:需提供给泛微方实施用于系统配置, 必须是post接口。</li>
<li>报文格式:JSON</li>
<li>加密密钥:52d7b5cbd1924126b9871ce49eba1953(示例:档案系统应用接入提供)</li>
</ul>
<h5>返回说明</h5>
<ul>
<li>原始报文:
<pre><code>{
&quot;files&quot;: [
{
&quot;filename&quot;: &quot;CREA11111060.sip&quot;,
&quot;code&quot;: &quot;1&quot;,
&quot;message&quot;: &quot;成功&quot;
}],
&quot;taskid&quot;: &quot;123132&quot;
}</code></pre></li>
<li>加密报文:
<pre><code>2285d486bdcb724e316dd9ec3595b63be067bf03988e5617ef6bbed69866da410cac2dc94cd90db762a65cee45512e80ccbfd5ba00b2a31bcfa707a65b5f8c6a9b9b95acded1f0d54c83a06c7ae80db3987552f53caf1d7ccc981dc489f740ca</code></pre></li>
</ul>
<h5>回调接口解析示例</h5>
<pre><code>ServletInputStream inputStream = request.getInputStream();
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
byte[] b = new byte[1024*10];
int len;
while((len = inputStream.read(b)) != -1){
arrayOutputStream.write(b, 0, len);
}
String getParams = new String(arrayOutputStream.toByteArray(), StandardCharsets.UTF_8);
System.out.println(&quot;getParams&quot; + getParams);
String key = &quot;35e9e1a00b1a449d9375b40ba1641d3f&quot;;
if (key.length() &gt; 8) {
key = key.substring(0, 8);
}
// 数据解密
String encrypt = ArcDESUtil.decrypt(getParams, key);</code></pre>
<pre><code>/**
* 数据解密源码
*
* @param message
* @param key
* @return
* @throws Exception
*/
public static String decrypt(String message, String key) throws Exception {
byte[] bytesrc = convertHexString(message);
Cipher cipher = Cipher.getInstance(&quot;DES/CBC/PKCS5Padding&quot;);
DESKeySpec desKeySpec = new DESKeySpec(key.getBytes(charset));
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(&quot;DES&quot;);
SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
IvParameterSpec iv = new IvParameterSpec(key.getBytes(charset));
cipher.init(Cipher.DECRYPT_MODE, secretKey, iv);
byte[] retByte = cipher.doFinal(bytesrc);
return new String(retByte, charset);
}</code></pre>