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

142 lines
4.0 KiB
XML
Raw Permalink 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>MU</hex>
</command>
<data extend="data">
<block len="1" cn="消息块号">
0仅一块 1第一块 2中间块 3最后块
</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">
<hex>0</hex>
</option>
<option cn="DES3">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</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="hasIV()">
当消息块号为2或3时显示
</iv>
<MACDataLen len="4" format="X" cn="MAC数据长度" :value="calcMACDataLen()">
将要作MAC的消息长度若消息类型为二进制则为随后域长度若消息类型为扩展十六进制则为随后域长度的一半
</MACDataLen>
<MACData maxLen="2048" cn="MAC数据">
生成MAC的数据n=2048
</MACData>
</data>
</req>
<res>
<command>
<hex>MV</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="TAK奇偶校验错">
<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>26</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<MAC cn="MAC数据" :len="retMacLen()">
所计算出的MAC。有MAC返回标识决定默认16H/32H
</MAC>
</data>
</res>
<script>
function hasIV(){
if( 2 == $packet.data.block || 3 == $packet.data.block){
return true
} else {
return false
}
}
function calcMACDataLen(){
if( 0 == $packet.data.dataType$option ){
return $packet.data.MACData.length
} else {
return $packet.data.MACData.length() /2
}
}
function retMacLen(){
if ( 0 == $packet.data.mode$option ) {
return 16;
} else {
return 16;
}
}
</script>
</packet>