100 lines
2.5 KiB
XML
100 lines
2.5 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
||
<packet extend="base">
|
||
<req>
|
||
|
||
<command>
|
||
<hex>SE</hex>
|
||
</command>
|
||
<data extend="data">
|
||
|
||
<keyLength len="4" :value="keyLen()" cn="解密密钥长度">
|
||
仅当存储类型为1时有效
|
||
解密密钥密文长度
|
||
</keyLength>
|
||
|
||
<key cn="解密密钥">
|
||
仅当存储类型为1时有效
|
||
解密密钥密文
|
||
</key>
|
||
|
||
<algorithmKey len="2" cn="解密算法类型">
|
||
解密算法
|
||
支持算法:SM4、3DES和AES
|
||
取值参考数据字典
|
||
</algorithmKey>
|
||
|
||
<iv :len="ivLen()" :if="useCbc()" cn="IV 数据域">
|
||
仅当算法为非ECB模式下有此域
|
||
当算法标识为3DES-CBC 时,该域为8B。
|
||
当算法标识为AES-CBC、 SM4-CBC 时,该域为16B。
|
||
取值参考数据字典
|
||
</iv>
|
||
|
||
<inputDataLen len="4" :value="getInputDataLen()" cn="数据长度">
|
||
待转加密的数据长度
|
||
</inputDataLen>
|
||
|
||
<inputData cn="数据">
|
||
待转加密的数据
|
||
</inputData>
|
||
</data>
|
||
|
||
</req>
|
||
<res>
|
||
|
||
<command>
|
||
<hex>SF</hex>
|
||
</command>
|
||
<data>
|
||
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
|
||
<options>
|
||
<option cn="无错误">
|
||
<hex>00</hex>
|
||
</option>
|
||
</options>
|
||
</error>
|
||
|
||
<keyCiphertextLen len="4" cn="密钥密文长度">
|
||
使用加密机主密钥加密的对称密钥长度
|
||
</keyCiphertextLen>
|
||
|
||
<keyCiphertext :len="getKeyCiphertextLen()" cn="密钥密文">
|
||
使用加密机主密钥加密的对称密钥
|
||
</keyCiphertext>
|
||
</data>
|
||
|
||
</res>
|
||
<script>
|
||
function keyLen() {
|
||
return $packet.data.key.length;
|
||
}
|
||
|
||
function useCbc(){
|
||
var algorithmKey = $packet.data.algorithmKey
|
||
if( 6==algorithmKey || 8==algorithmKey || 2==algorithmKey || 4==algorithmKey || 10==algorithmKey ){
|
||
return true;
|
||
}else{
|
||
return false;
|
||
}
|
||
}
|
||
|
||
function ivLen() {
|
||
var algorithmKey = $packet.data.algorithmKey
|
||
if(8==algorithmKey ){
|
||
return 8;
|
||
}
|
||
if( 4==algorithmKey || 10==algorithmKey ){
|
||
return 16;
|
||
}
|
||
}
|
||
|
||
function getInputDataLen(){
|
||
return $packet.data.inputData.length;
|
||
}
|
||
|
||
function getKeyCiphertextLen(){
|
||
return Util.a2i( $final.getSection('data').getSection('keyCiphertextLen') )
|
||
}
|
||
</script>
|
||
</packet>
|