142 lines
4.0 KiB
XML
142 lines
4.0 KiB
XML
<?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 32;
|
||
}
|
||
}
|
||
|
||
</script>
|
||
</packet>
|