sydapi/DProto/MS.xml
2021-08-18 10:32:12 +08:00

184 lines
5.8 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>MS</hex>
</command>
<data extend="data">
<block len="1" cn="消息块号">
<options>
<option cn="仅一块">
<hex>0</hex>
</option>
<option cn="第一块">
<hex>1</hex>
</option>
<option cn="中间块">
<hex>2</hex>
</option>
<option cn="最后块">
<hex>3</hex>
</option>
</options>
</block>
<keyType len="1" cn="密钥类型">
<options>
<option cn="TAK">
<hex>0</hex>
</option>
<option cn="ZAK">
<hex>1</hex>
</option>
</options>
</keyType>
<mode len="1" cn="密钥长度">
<options>
<option cn="单倍长度DES密钥.Ansi X9.9">
<hex>0</hex>
</option>
<option cn="双倍长度DES密钥,Ansi X9.19">
<hex>1</hex>
</option>
<option cn=" SM4-CBC,弱填充0x00银联">
<hex>2</hex>
</option>
<option cn="3DES-CBC, ,弱填充0x00银联">
<hex>3</hex>
</option>
</options>
</mode>
<dataType len="1" cn="消息类型">
<options>
<option cn="二进制">
<hex>0</hex>
</option>
<option cn="十六进制">
<hex>1</hex>
</option>
</options>
</dataType>
<key cn="密钥">
</key>
<iv cn="IV" :if="2 == $packet.data.block$option || 3 == $packet.data.block$option">
当消息块号为2或3时显示
</iv>
<msgLen len="4" format="X" :value="calcMSGLen()" cn="消息长度">
将要作 MAC的消息长度若消息类型为二进制则为
随后域长度;若消息类型为扩展十六进制,则为随后
域长度的一半)。
</msgLen>
<msg :len="" cn="消息块">
二进制或扩展十六进制形式的消息块。
</msg>
<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>MT</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效消息类型代码">
<hex>03</hex>
</option>
<option cn="无效密钥类型代码">
<hex>04</hex>
</option>
<option cn="无效消息块号">
<hex>05</hex>
</option>
<option cn="无效密钥长度代码">
<hex>06</hex>
</option>
<option cn="ZAK奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK错误报告给管理员">
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效的用户存储索引">
<hex>21</hex>
</option>
<option cn="无效密钥长度">
<hex>27</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<MAB :len="retMacLen()" cn="MAB">
当消息块号为“1”或“2”时作为下一块的IV。
当消息块号为“0”或“3”时用于消息认证。
</MAB>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function calcMSGLen(){
if( 0 == $packet.data.dataType$option ){
return $packet.data.msg.length
} else {
return ($packet.data.msg.length / 2) as int
}
}
function retMacLen(){
if ( 0 == $packet.data.mode$option ) {
return 16;
} else {
return 16;
}
}
</script>
</packet>