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

136 lines
3.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>82</hex>
</command>
<data extend="data">
<key_Length len="4" format="X" :value="keyLen()" cn="密钥长度">
输入的数据长度,十六进制值表示。如:“0021”表示输入数据为21字节。密钥长度由散列算法决定。
散列摘要长度L &lt;= Key_Length &lt;= 散列数据块。
</key_Length>
<key cn="秘钥">
秘钥数据
</key>
<hashType len="1" cn="HASH类型">
指示用于哈希证书数据的哈希算法的类型
<options>
<option cn="SHA1">
<hex>1</hex>
</option>
<option cn="SHA256">
<hex>2</hex>
</option>
<option cn="SHA384">
<hex>3</hex>
</option>
<option cn="SHA512">
<hex>4</hex>
</option>
<option cn="SM3">
<hex>5</hex>
</option>
</options>
</hashType>
<contextInfo_Len len="4" :value="contextInfoLen()" cn="上下文信息长度">
输入的散列上下文信息长度如果是第一个散列报文则值送0000,后面数据将不存在。
</contextInfo_Len>
<contextInfo cn="上下文信息">
输入的散列上下文信息,加密机输出,原文传入
</contextInfo>
<infoData_Len len="4" :value="infoDataLen()" cn="消息数据长度">
消息长度
</infoData_Len>
<infoData cn="消息数据">
二进制的消息块
</infoData>
</data>
</req>
<res>
<command>
<hex>83</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="数据长度错">
<hex>80</hex>
</option>
</options>
</error>
<contextInfo_Length len="4" cn="上下文信息长度">
上下文信息的长度,原始数据过大分包计算时需要传入上下文信息。
</contextInfo_Length>
<contextInfo cn="上下文信息">
如果数据分包,则下次请求需要无更改传入此上下文信息。
</contextInfo>
<HMAC_LEN len="4" :value="HMACLen()" cn="HMAC结果长度" >
输出的数据长度,十六进制值表示。如:“0021”表示输入数据为21字节。
</HMAC_LEN>
<HAMC :len="retHMACLen()" cn="HMAC结果">
当调用成功时,返回散列值,长度由散列算法确定:
</HAMC>
</data>
</res>
<script>
function keyLen(){
var data = $packet.data;
return data.key.length();
}
function contextInfoLen(){
var data = $packet.data;
return data.contextInfo.length();
}
function infoDataLen(){
var data = $packet.data;
return data.infoData.length;
}
function HMACLen(){
var data = $packet.data;
return data.HMAC.length;
}
function retHMACLen(){
if( 1 == $packet.data.hashType$option ) {
return 20;
} else if ( 2 == $packet.data.hashType$option || 5 == $packet.data.hashType$option ) {
return 32;
} else if ( 3 == $packet.data.hashType$option ) {
return 48;
}else if ( 4 == $packet.data.hashType$option ) {
return 64;
}
}
</script>
</packet>