177 lines
5.0 KiB
XML
177 lines
5.0 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
||
<packet extend="base">
|
||
<req>
|
||
|
||
<command>
|
||
<bin>8004</bin>
|
||
</command>
|
||
<data extend="data">
|
||
<signatureDataType len="1" cn="获取公私钥标记位">
|
||
<options>
|
||
<option cn="索引方式">
|
||
<bin>00</bin>
|
||
</option>
|
||
<option cn="DN 方式">
|
||
<bin>01</bin>
|
||
</option>
|
||
<option cn="通过机构号获取">
|
||
<bin>02</bin>
|
||
</option>
|
||
</options>
|
||
</signatureDataType>
|
||
|
||
<DN :if="useDN()" cn="DN 或 DN索引">
|
||
若上面的标志为1,则此域为证书DN,若为0,则此域为两个字节的证书索引;若为2,该域不存在
|
||
</DN>
|
||
|
||
<organizationNumLen len="2" :if="useOrganization()" :value="bNumberLength()" cn="机构号长度">
|
||
标志为2 时存在
|
||
</organizationNumLen>
|
||
|
||
<organizationNum :if="useOrganization()" cn="机构号内容">
|
||
标志为2 时存在
|
||
</organizationNum>
|
||
|
||
|
||
<dataLength len="2" :value="dataLen()" cn="待签名数据长度">
|
||
待签名数据长度
|
||
</dataLength>
|
||
|
||
<odata cn="待签名数据">
|
||
待签名数据
|
||
</odata>
|
||
|
||
<signatureLen len="2" :value="signLen()" cn="签名的字节长度">
|
||
签名的字节长度
|
||
</signatureLen>
|
||
|
||
<signature :len="signatureLen()" cn="已签名数据">
|
||
待验签的已签名数据,若为RSA签名则为相应长度的签名数据,若为SM2签名,则前半部分为R.后面半部分为S;
|
||
</signature>
|
||
|
||
<returnSign len="2" cn="返回证书信息标志">
|
||
<options>
|
||
<option cn="不返回">
|
||
<bin>0000</bin>
|
||
</option>
|
||
<option cn="返回">
|
||
<bin>0001</bin>
|
||
</option>
|
||
</options>
|
||
</returnSign>
|
||
</data>
|
||
|
||
|
||
|
||
</req>
|
||
<res>
|
||
|
||
<command>
|
||
<bin>8005</bin>
|
||
</command>
|
||
<data>
|
||
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
|
||
<options>
|
||
<option cn="无错误">
|
||
<hex>00</hex>
|
||
</option>
|
||
<option cn="公钥不符合编码规则">
|
||
<hex>04</hex>
|
||
</option>
|
||
<option cn="无效的加密标识">
|
||
<hex>06</hex>
|
||
</option>
|
||
<option cn="无效的附加模式标识">
|
||
<hex>07</hex>
|
||
</option>
|
||
<option cn="密钥奇偶校验错误">
|
||
<hex>10</hex>
|
||
</option>
|
||
<option cn="LMK 错误">
|
||
LMK 错误;报告给管理员。
|
||
<hex>13</hex>
|
||
</option>
|
||
<option cn="输入数据错">
|
||
<hex>15</hex>
|
||
</option>
|
||
<option cn="DSP 错误">
|
||
DSP 错误;报告给管理员。
|
||
<hex>47</hex>
|
||
</option>
|
||
<option cn="私钥错误">
|
||
私钥错误;报告给管理员。
|
||
<hex>49</hex>
|
||
</option>
|
||
<option cn="密钥块长度错误">
|
||
<hex>76</hex>
|
||
</option>
|
||
<option cn="输入数据长度错误">
|
||
<hex>80</hex>
|
||
</option>
|
||
</options>
|
||
</error>
|
||
|
||
<infoLen len="2" cn="信息长度" :if="0 != $packet.data.returnSign$option">
|
||
信息长度
|
||
</infoLen>
|
||
|
||
<info :len="getInfoLen()" cn="信息" :if="0 != $packet.data.returnSign$option">
|
||
若发送报文返回证书信息标志位为0,则返回一段垃圾数据,可以不用管
|
||
若发送报文返回证书信息标志位为1,则返回 CERT_INFO 结构的证书数据
|
||
</info>
|
||
|
||
</data>
|
||
|
||
|
||
|
||
</res>
|
||
<script><![CDATA[
|
||
function dataLen(){
|
||
def len = $packet.data.odata.length
|
||
def ret = new byte[2]
|
||
ret[0] = (byte)(len >> 8 & 0xFF)
|
||
ret[1] = (byte)(len & 0xFF)
|
||
return ret;
|
||
}
|
||
|
||
function signLen(){
|
||
def len = $packet.data.signature.length
|
||
def ret = new byte[2]
|
||
ret[0] = (byte)(len >> 8 & 0xFF)
|
||
ret[1] = (byte)(len & 0xFF)
|
||
return ret;
|
||
}
|
||
|
||
function useDN(){
|
||
|
||
if (2 == $packet.data.signatureDataType$option){
|
||
return false
|
||
}else {
|
||
return true
|
||
}
|
||
}
|
||
|
||
function useOrganization(){
|
||
|
||
if (2 == $packet.data.signatureDataType$option){
|
||
return true
|
||
}else {
|
||
return false
|
||
}
|
||
}
|
||
|
||
function bNumberLength(){
|
||
def len = $packet.data.organizationNum.length();
|
||
def data = new byte[2];
|
||
data[0] = (byte)(len >> 8 & 0xFF)
|
||
data[1] = (byte)(len & 0xFF)
|
||
return data;
|
||
}
|
||
function getInfoLen() {
|
||
if (null == $final.data.infoLen){
|
||
return 0;
|
||
}
|
||
return Util.b2i( $final.data.infoLen )
|
||
} ]]> </script>
|
||
</packet>
|