sydapi/DProto/69.xml
2021-06-29 11:32:24 +08:00

196 lines
6.2 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>69</hex>
</command>
<data extend="data">
<alg len="1" cn="算法标识">
<options>
<option cn="RSA">
<hex>0</hex>
</option>
<option cn="SM2">
<hex>1</hex>
</option>
</options>
</alg>
<fillKey len="1" cn="填充标识" :if="0 == $packet.data.alg$option">
<options>
<option cn="数据长度必须等于密钥长度(DER对应的数据长度)">
<hex>0</hex>
</option>
<option cn="PKCS#1 v1.5 填充方式">
<hex>1</hex>
</option>
</options>
</fillKey>
<privateKeyTag len="27" cn="私钥标记">
数字为存储私钥的索引,除了
全 9 表示使用由命令中提供的密钥。
27 位的索引号16 位机构号+3 位密钥类型+8 位密钥
索引号。
</privateKeyTag>
<privateKeyLength :if="useLocalKey()" len="4" :value="privateKeyLen()" cn="私钥长度">
私钥密文的长度
可选项当私钥标记为全9时显示此域
</privateKeyLength>
<privateKey :if="useLocalKey()" cn="私钥">
LMK加密的私钥
可选项当私钥标记为全9时显示此域
</privateKey>
<dataLength len="4" :value="dataLen()" cn="长度">
公钥加密的密文长度
</dataLength>
<infoData cn="密文">
公钥加密的密文的DER编码
</infoData>
<DEK cn="DEK">
LMK对36-37下加密的DEK。
27位的索引号16位机构号+3位密钥类型+8位密钥索引号
</DEK>
<AlgorithmKey1 len="1" cn="算法标识">
取值P可选没有此选项默认为算法为SM4
</AlgorithmKey1>
<EncryAlgorithm1 len="1" :if="useAlgorithmKey1()" cn="加密算法">
<options>
<option cn="3DES">
<hex>0</hex>
</option>
<option cn="SM4">
<hex>1</hex>
</option>
</options>
</EncryAlgorithm1>
<AlgorithmKey2 len="1" cn="算法标识">
取值Q可选没有此选项默认为算法为ECB
</AlgorithmKey2>
<EncryAlgorithm2 len="1" :if="useAlgorithmKey2()" cn="加密算法">
<options>
<option cn="ECB">
<hex>0</hex>
</option>
<option cn="CBC">
<hex>1</hex>
</option>
</options>
</EncryAlgorithm2>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>6A</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="公钥不符合编码规则">
<hex>04</hex>
</option>
<option cn="无效的对称密钥类型">
<hex>05</hex>
</option>
<option cn="无效的加密标识">
<hex>06</hex>
</option>
<option cn="无效的附加模式标识">
<hex>07</hex>
</option>
<option cn="密钥奇偶校验错误">
<hex>10</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="DSP 错误">
DSP 错误;报告给管理员。
<hex>47</hex>
</option>
<option cn="密钥块长度错误">
<hex>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyLen len="4" cn="数据长度">
密文数据的字节长度
</keyLen>
<key :len="getKeyLen()" cn="密文数据">
密文数据(强填充)
</key>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function useLocalKey(){
if( "999999999999999999999999999".equals(new String($packet.data.privateKeyTag) ))
{
return true;
}else{
return false;
}
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function useAlgorithmKey1(){
if( "P".equals(new String($packet.data.AlgorithmKey1) ))
{
return true;
}else{
return false;
}
}
function useAlgorithmKey2(){
if( "Q".equals(new String($packet.data.AlgorithmKey2) ))
{
return true;
}else{
return false;
}
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLen') )
}
</script>
</packet>