init files

This commit is contained in:
Cheney
2021-06-29 11:32:24 +08:00
commit bbf0cb2fb9
337 changed files with 167274 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
/.idea/
/target/
*.b64
*.bin
*.iml
*.cer
/doc/
*.log
/logs/
*.sunyard.main.version
/public/
+116
View File
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>4D41</bin>
</command>
<data extend="data">
<tag len="1" cn="IV标识">
<text>P</text>
</tag>
<alg len="1" cn="MAC 算法">
<options>
<option cn="3DES">
<text>1</text>
</option>
<option cn="SM4">
<text>2</text>
</option>
</options>
</alg>
<type len="1" cn="密钥类型">
<options>
<option cn="ZAK1(3DES 认证密钥) ">
<text>0</text>
</option>
<option cn="ZAK2(SM4 认证密钥) ">
<text>1</text>
</option>
</options>
</type>
<full len="1" cn="填充类型">
<text>0</text>
</full>
<macLen len="1" cn="MAC 长度标识">
<text>1</text>
</macLen>
<key cn="密钥">
X+K+27 位的索引号
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥 索引号,具体要求组成见每 2 章节。
</key>
<MACData maxLen="4096" cn="MAC数据">
需要 MAC 的数据(HEX 格式),n=4096 注:数据长度应该为 8 或 16 的整数倍,如果不是 8 或 16 的整数倍,系统默认在数据后面填充 0x00 组成 8 或 16 的整数倍。
</MACData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="终止信息分隔符">
可选项。如果显示消息尾域,则该域必须显示。值为“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="消息尾">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<bin>4D42</bin>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="MAC校验错">
<hex>01</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="8">
所计算出的MAC。有MAC返回标识决定,默认8H
</MAC>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script></script>
</packet>
+123
View File
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>4D43</bin>
</command>
<data extend="data">
<tag len="1" cn="IV标识">
<text>P</text>
</tag>
<alg len="1" cn="MAC 算法">
<options>
<option cn="3DES">
<text>1</text>
</option>
<option cn="SM4">
<text>2</text>
</option>
</options>
</alg>
<type len="1" cn="密钥类型">
<options>
<option cn="ZAK1(3DES 认证密钥) ">
<text>0</text>
</option>
<option cn="ZAK2(SM4 认证密钥) ">
<text>1</text>
</option>
</options>
</type>
<full len="1" cn="填充类型">
<text>0</text>
</full>
<macLen len="1" cn="MAC 长度标识">
<text>1</text>
</macLen>
<key cn="密钥">
X+K+27 位的索引号
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥 索引号,具体要求组成见每 2 章节。
</key>
<MAC cn="MAC数据" len="8">
所计算出的MAC。有MAC返回标识决定,默认8H
</MAC>
<MACData maxLen="4096" cn="MAC数据">
需要 MAC 的数据(HEX 格式),n=4096 注:数据长度应该为 8 或 16 的整数倍,如果不是 8 或 16 的整数倍,系统默认在数据后面填充 0x00 组成 8 或 16 的整数倍。
</MACData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="终止信息分隔符">
可选项。如果显示消息尾域,则该域必须显示。值为“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="消息尾">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<bin>4D44</bin>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="MAC校验错">
<hex>01</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>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script> </script>
</packet>
+87
View File
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>60</hex>
</command>
<data extend="data">
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>61</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的成份号">
<hex>03</hex>
</option>
<option cn="成份奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效的用户存储索引">
<hex>21</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="传输保护秘钥校验值和和实际不一致">
<hex>57</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<DK len="32" cn="DK密钥密文">
LMK14-15 加密下的密钥.
密钥方案为S
</DK>
<keyCheck len="16" cn="密钥校验值">
密钥明文的 MAC 值(X9.19)。
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
</script>
</packet>
+93
View File
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>61</hex>
</command>
<data extend = "data">
<roleInfo len="16" cn="角色信息">
IC 卡内存放的角色信息密文(LMK14-15)
密钥方案X。
</roleInfo>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>62</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="验证失败">
<hex>02</hex>
</option>
<option cn="无效的成份号">
<hex>03</hex>
</option>
<option cn="成份奇偶校验错">
<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>17</hex>
</option>
<option cn="无效的用户存储索引">
<hex>21</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<roleType len="1" cn="角色类型">
1:系统管理员
2:密钥管理员.
3: 配置管理员
</roleType>
<roleId len="1" cn="角色ID">
1:管理员1
2:管理员2
</roleId>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
</script>
</packet>
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>62</hex>
</command>
<data extend="data">
<keyType len="3" cn="秘钥类型">
密钥类型
</keyType>
<key cn="应用秘钥">
LMK加密下的应用密钥
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</key>
<AlgorithmKey len="1" cn="算法标识">
取值P(可选,没有此选项,默认为算法为IDEA,输出格式0)
</AlgorithmKey>
<alg len="1" cn="密押算法">
<options>
<option cn="IDEA">
<hex>0</hex>
</option>
<option cn="SM1">
<hex>1</hex>
</option>
</options>
</alg>
<outputFormat len="1" cn="输出格式" :if="useAlgorithmKey()">
<options>
<option cn="软MD5后前8与后8异或后加密,密押取前4位并转为8字节的HEX格式">
<hex>0</hex>
</option>
<option cn="软MD5后取前8字节加密,输出8节的BIN格式">
<hex>1</hex>
</option>
</options>
</outputFormat>
<dataLength len="4" :value="dataLen()" cn="数据长度">
加押数据的字节长度
</dataLength>
<infoData cn="信息数据">
加押数据
</infoData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>63</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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 len="8" cn="MAC">
密押,默认为8H
</MAC>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function useAlgorithmKey(){
if( "P".equals(new String($packet.data.AlgorithmKey) ))
{
return true;
}else{
return false;
}
}
</script>
</packet>
+129
View File
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>63</hex>
</command>
<data extend="data">
<keyType len="3" cn="秘钥类型">
密钥类型
</keyType>
<key cn="应用秘钥">
LMK加密下的应用密钥
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</key>
<AlgorithmKey len="1" cn="算法标识">
取值P(可选,没有此选项,默认为算法为IDEA,输出格式0)
</AlgorithmKey>
<alg len="1" cn="密押算法">
<options>
<option cn="IDEA">
<hex>0</hex>
</option>
<option cn="SM1">
<hex>1</hex>
</option>
</options>
</alg>
<outputFormat len="1" cn="输出格式" :if="useAlgorithmKey()">
<options>
<option cn="软MD5后前8与后8异或后加密,密押取前4位并转为8字节的HEX格式">
<hex>0</hex>
</option>
<option cn="软MD5后取前8字节加密,输出8节的BIN格式">
<hex>1</hex>
</option>
</options>
</outputFormat>
<secret len="8" cn="密押">
需要验证的密押
</secret>
<!--<verify len="1" cn="验证方式">
可选,只针对应用密钥通过索引访问的情况
<options>
<option cn="只用新密钥验证">
<hex>0</hex>
</option>
<option cn="新密钥验证不过,如果老密押存在且在有效期之内,再用老密押验证">
<hex>1</hex>
</option>
</options>
</verify>-->
<dataLength len="4" :value="dataLen()" cn="数据长度">
加押数据的字节长度
</dataLength>
<infoData cn="信息数据">
加押数据
</infoData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>64</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function useAlgorithmKey(){
if( "P".equals(new String($packet.data.AlgorithmKey) ))
{
return true;
}else{
return false;
}
}
</script>
</packet>
+134
View File
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>64</hex>
</command>
<data extend="data">
<keyType len="3" cn="秘钥类型">
密钥类型
</keyType>
<key cn="应用秘钥">
LMK加密下的应用密钥
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</key>
<log len="1" cn="加解密标识">
加解密时,数据长度必须为分组长度
<options>
<option cn="加密">
<hex>0</hex>
</option>
<option cn="解密">
<hex>1</hex>
</option>
</options>
</log>
<AlgorithmKey len="1" cn="算法标识">
取值P(可选,没有此选项,默认为算法为IDEA,输出格式0)
</AlgorithmKey>
<alg len="1" cn="加密算法" :if="useAlgorithmKey()">
<options>
<option cn="IDEA">
<hex>0</hex>
</option>
<option cn="SM1">
<hex>1</hex>
</option>
<option cn="3DES">
<hex>2</hex>
</option>
<option cn="SM4">
<hex>3</hex>
</option>
</options>
</alg>
<dataLength len="4" :value="dataLen()" cn="数据长度">
数据的字节长度
</dataLength>
<infoData cn="信息数据">
数据
</infoData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>65</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<infoLen len="4" cn="数据长度">
返回原数据长度
</infoLen>
<info :len="infoLen()" cn="信息数据">
数据
</info>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function useAlgorithmKey(){
if( "P".equals(new String($packet.data.AlgorithmKey) ))
{
return true;
}else{
return false;
}
}
function infoLen(){
return Util.a2i( $final.getSection('data').getSection('infoLen') )
}
</script>
</packet>
+127
View File
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>65</hex>
</command>
<data extend="data">
<keyType len="3" cn="秘钥类型">
密钥类型
</keyType>
<srcKey cn="源应用秘钥">
LMK加密下的应用密钥
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</srcKey>
<aimKey cn="目的应用秘钥">
LMK加密下的应用密钥
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</aimKey>
<AlgorithmKey len="1" cn="算法标识">
取值P(可选,没有此选项,默认为算法为IDEA,输出格式0)
</AlgorithmKey>
<alg len="1" cn="加密算法" :if="useAlgorithmKey()">
<options>
<option cn="IDEA">
<hex>0</hex>
</option>
<option cn="SM1">
<hex>1</hex>
</option>
<option cn="3DES">
<hex>2</hex>
</option>
<option cn="SM4">
<hex>3</hex>
</option>
</options>
</alg>
<dataLength len="4" :value="dataLen()" cn="密文数据长度">
密文数据长度
</dataLength>
<infoData cn="密文数据">
密文数据
</infoData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>66</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<infoLen len="4" cn="密文数据长度">
密文数据长度
</infoLen>
<info :len="infoLen()" cn="密文数据">
密文数据
</info>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function useAlgorithmKey(){
if( "P".equals(new String($packet.data.AlgorithmKey) ))
{
return true;
}else{
return false;
}
}
function infoLen(){
return Util.a2i( $final.getSection('data').getSection('infoLen') )
}
</script>
</packet>
+116
View File
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>66</hex>
</command>
<data extend="data">
<key cn="ZPK">
LMK(06-07)加密下的ZPK
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</key>
<log len="1" cn="加解密标识">
<options>
<option cn="加密">
<hex>0</hex>
</option>
<option cn="解密">
<hex>1</hex>
</option>
</options>
</log>
<AlgorithmKey len="1" cn="算法标识" required="false">
取值P(可选,没有此选项,默认为算法为3DES)
</AlgorithmKey>
<alg len="1" cn="加密算法" :if="null != $packet.data.AlgorithmKey">
<options>
<option cn="3DES">
<hex>0</hex>
</option>
<option cn="SM4">
<hex>1</hex>
</option>
</options>
</alg>
<pin cn="PIN数据" >
PIN数据
</pin>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>67</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
</options>
</error>
<info :len="pinLen()" cn="PIN数据">
PIN数据
</info>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function pinLen(){
if(1 == $packet.get('data').get('alg$option')){
return 16
}else {
return 8
}
}
<!--function dcaLen() {
if(1 == $packet.get('data').get('alg$option')){
return 32
}else {
return 16
}
}-->
<!-- function infoLen(){
if(1 == $packet.get('data').get('alg$option')){
return 16
}else {
return 8
}
}-->
<!--function infoLen(){
return $packet.get('data').get('sca$option').length;
}-->
</script>
</packet>
+101
View File
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>67</hex>
</command>
<data extend="data">
<srcKey cn="源ZPK">
LMK(06-07)加密下的ZPK
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</srcKey>
<aimKey cn="目的ZPK">
LMK(06-07)加密下的ZPK
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</aimKey>
<AlgorithmKey len="1" cn="算法标识">
取值P(可选,没有此选项,默认为算法为3DES)
</AlgorithmKey>
<alg len="1" cn="加密算法" :if="useAlgorithmKey()">
<options>
<option cn="3DES">
<hex>0</hex>
</option>
<option cn="SM4">
<hex>1</hex>
</option>
</options>
</alg>
<pin cn="密文PIN">
PIN密文
</pin>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>68</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
</options>
</error>
<info :len="pinLen()" cn="密文PIN">
PIN密文
</info>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function useAlgorithmKey(){
if( "P".equals(new String($packet.data.AlgorithmKey) ))
{
return true;
}else{
return false;
}
}
function pinLen(){
if(1 == $packet.get('data').get('alg$option')){
return 16
}else {
return 8
}
}
</script>
</packet>
+161
View File
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>68</hex>
</command>
<data extend="data">
<DEK cn="DEK">
LMK对(36-37)下加密的DEK。
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</DEK>
<infoDataLen len="4" :value="infoDataLen()" cn="数据长度">
密文数据的字节长度
</infoDataLen>
<infoData cn="密文数据">
密文数据(强填充)
</infoData>
<alg len="1" cn="算法标识">
<options>
<option cn="RSA">
<hex>0</hex>
</option>
<option cn="SM2">
<hex>1</hex>
</option>
</options>
</alg>
<fillKey len="1" cn="填充标识" :if="0 == $packet.data.alg$option">
<options>
<option cn="数据长度必须等于密钥长度(DER对应的数据长度)">
<hex>0</hex>
</option>
<option cn="PKCS#1 v1.5 填充方式">
<hex>1</hex>
</option>
</options>
</fillKey>
<publicKeyLen len="4" :value="publicKeyLen()" cn="公钥长度">
公钥的长度(DER)
</publicKeyLen>
<publicKey cn="公钥">
公钥的DER编码
</publicKey>
<AlgorithmKey1 len="1" cn="算法标识" required="false">
取值P(可选,没有此选项,默认为算法为SM4)
</AlgorithmKey1>
<EncryAlgorithm1 len="1" :if="null != $packet.data.AlgorithmKey1" cn="加密算法">
<options>
<option cn="3DES">
<hex>0</hex>
</option>
<option cn="SM4">
<hex>1</hex>
</option>
</options>
</EncryAlgorithm1>
<AlgorithmKey2 len="1" cn="算法标识" required="false">
取值Q(可选,没有此选项,默认为算法为ECB)
</AlgorithmKey2>
<EncryAlgorithm2 len="1" :if="null != $packet.data.AlgorithmKey2" cn="加密算法">
<options>
<option cn="ECB">
<hex>0</hex>
</option>
<option cn="CBC">
<hex>1</hex>
</option>
</options>
</EncryAlgorithm2>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>69</hex>
</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>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyLen len="4" cn="长度">
公钥加密的密文长度
</keyLen>
<key :len="getKeyLen()" cn="密文">
公钥加密的密文的DER编码
</key>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function infoDataLen(){
var data = $packet.data;
return data.infoData.length;
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLen') )
}
</script>
</packet>
+195
View File
@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>69</hex>
</command>
<data extend="data">
<alg len="1" cn="算法标识">
<options>
<option cn="RSA">
<hex>0</hex>
</option>
<option cn="SM2">
<hex>1</hex>
</option>
</options>
</alg>
<fillKey len="1" cn="填充标识" :if="0 == $packet.data.alg$option">
<options>
<option cn="数据长度必须等于密钥长度(DER对应的数据长度)">
<hex>0</hex>
</option>
<option cn="PKCS#1 v1.5 填充方式">
<hex>1</hex>
</option>
</options>
</fillKey>
<privateKeyTag len="27" cn="私钥标记">
数字为存储私钥的索引,除了
全 9 表示使用由命令中提供的密钥。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号。
</privateKeyTag>
<privateKeyLength :if="useLocalKey()" len="4" :value="privateKeyLen()" cn="私钥长度">
私钥密文的长度
可选项,当私钥标记为全9时显示此域
</privateKeyLength>
<privateKey :if="useLocalKey()" cn="私钥">
LMK加密的私钥
可选项,当私钥标记为全9时显示此域
</privateKey>
<dataLength len="4" :value="dataLen()" cn="长度">
公钥加密的密文长度
</dataLength>
<infoData cn="密文">
公钥加密的密文的DER编码
</infoData>
<DEK cn="DEK">
LMK对(36-37)下加密的DEK。
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</DEK>
<AlgorithmKey1 len="1" cn="算法标识">
取值P(可选,没有此选项,默认为算法为SM4)
</AlgorithmKey1>
<EncryAlgorithm1 len="1" :if="useAlgorithmKey1()" cn="加密算法">
<options>
<option cn="3DES">
<hex>0</hex>
</option>
<option cn="SM4">
<hex>1</hex>
</option>
</options>
</EncryAlgorithm1>
<AlgorithmKey2 len="1" cn="算法标识">
取值Q(可选,没有此选项,默认为算法为ECB)
</AlgorithmKey2>
<EncryAlgorithm2 len="1" :if="useAlgorithmKey2()" cn="加密算法">
<options>
<option cn="ECB">
<hex>0</hex>
</option>
<option cn="CBC">
<hex>1</hex>
</option>
</options>
</EncryAlgorithm2>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>6A</hex>
</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>05</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>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyLen len="4" cn="数据长度">
密文数据的字节长度
</keyLen>
<key :len="getKeyLen()" cn="密文数据">
密文数据(强填充)
</key>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function useLocalKey(){
if( "999999999999999999999999999".equals(new String($packet.data.privateKeyTag) ))
{
return true;
}else{
return false;
}
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function useAlgorithmKey1(){
if( "P".equals(new String($packet.data.AlgorithmKey1) ))
{
return true;
}else{
return false;
}
}
function useAlgorithmKey2(){
if( "Q".equals(new String($packet.data.AlgorithmKey2) ))
{
return true;
}else{
return false;
}
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLen') )
}
</script>
</packet>
+164
View File
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>6A</hex>
</command>
<data extend="data">
<alg len="1" cn="算法标识">
<options>
<option cn="RSA2048_AES256_ECB">
<hex>0</hex>
</option>
<option cn="SM2_SM4_ECB">
<hex>1</hex>
</option>
</options>
</alg>
<certificateModel len="1" cn="证书模式">
<options>
<option cn="证书序号">
<hex>0</hex>
</option>
<option cn="证书 DN">
<hex>1</hex>
</option>
</options>
</certificateModel>
<certificateLen len="4" :value="certificateLen()" cn="证书内容长度">
根据证书模式,需要输入内容项的长度 n
</certificateLen>
<certificateSn :len="strlen()" :if="0 == $packet.data.certificateModel$option" cn="X509 证书序号">
可选项,只针对“证书模式”为 0时有。
</certificateSn>
<certificateDn :len="strlen()" :if="1 == $packet.data.certificateModel$option" cn="X509 证书的 subject">
可选项,只针对“证书模式”为 1时有。
</certificateDn>
<keyType len="1" cn="加密密钥方案">
LMK 下加密密钥的方案。
</keyType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>6B</hex>
</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>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyLen len="4" cn="密钥密文长度">
公钥加密的密钥密文长度
</keyLen>
<key :len="getKeyLen()" cn="密钥密文">
公钥加密的密钥密文的 BASE64 编码
</key>
<lmkHead len="1" cn="lmk 头">
如果是 'L' ,lmk 32 个字节长,否则 lmk 64 个字节长。
</lmkHead>
<lmk :len="lmkLen()" cn="对称密钥的密文">
对称密钥的密文,由 LMK30-31 保护。
</lmk>
<keyCheck len="16" cn="密钥校验值">
密钥校验值
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function certificateLen(){
var data = $packet.data;
if( 0 == data.certificateModel$option ){
return data.certificateSn.length()
}
if( 1 == data.certificateModel$option ){
return data.certificateDn.length()
}
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLen') )
}
function lmkLen() {
if( Arrays.equals("L".getBytes(),
$final.getSection('data').getSection('lmkHead').getValue()
) ){
return 64
}else{
return 32
}
} </script>
</packet>
+164
View File
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>6B</hex>
</command>
<data extend="data">
<certificateModel len="1" cn="证书模式">
<options>
<option cn="证书序号">
<hex>0</hex>
</option>
<option cn="证书 DN">
<hex>1</hex>
</option>
</options>
</certificateModel>
<certificateLen len="4" :value="certificateLen()" cn="证书内容长度">
根据证书模式,需要输入内容项的长度 n
</certificateLen>
<certificateSn :len="strlen()" :if="0 == $packet.data.certificateModel$option" cn="X509 证书序号">
可选项,只针对“证书模式”为 0时有。
</certificateSn>
<certificateDn :if="1 == $packet.data.certificateModel$option" cn="X509 证书的 subject">
可选项,只针对“证书模式”为 1时有。
</certificateDn>
<keyLen len="4" :value="keyLen()" cn="密钥密文长度">
公钥加密的密钥密文长度
</keyLen>
<key :len="getKeyLen()" cn="密钥密文">
公钥加密的密钥密文的 BASE64 编码
</key>
<keyType len="1" cn="加密密钥方案">
LMK 下加密密钥的方案。
</keyType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>6C</hex>
</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="输入的数据格式错误">
<hex>21</hex>
</option>
<option cn="DSP 错误">
DSP 错误;报告给管理员。
<hex>47</hex>
</option>
<option cn="密钥块长度错误">
<hex>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<!--<keyLen len="4" cn="密钥密文长度">-->
<!--公钥加密的密钥密文长度-->
<!--</keyLen>-->
<lmkHead len="1" cn="lmk 头">
如果是 'L' ,lmk 32 个字节长,否则 lmk 64 个字节长。
</lmkHead>
<lmk :len="lmkLen()" cn="对称密钥的密文">
对称密钥的密文,由 LMK30-31 保护。
</lmk>
<keyCheck len="16" cn="密钥校验值">
密钥校验值
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function certificateLen(){
var data = $packet.data;
if( 0 == data.certificateModel$option ){
return data.certificateSn.length()
}
if( 1 == data.certificateModel$option ){
return data.certificateDn.length()
}
}
function keyLen() {
return $packet.data.key.length()
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLen') )
}
function lmkLen() {
if( Arrays.equals("L".getBytes(),
$final.getSection('data').getSection('lmkHead').getValue()
) ){
return 64
}else{
return 32
}
} </script>
</packet>
+145
View File
@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>6C</hex>
</command>
<data extend="data">
<certificateModel len="1" cn="证书模式">
<options>
<option cn="证书序号">
<hex>0</hex>
</option>
<option cn="证书 DN">
<hex>1</hex>
</option>
</options>
</certificateModel>
<certificateLen len="4" :value="certificateLen()" cn="证书内容长度">
根据证书模式,需要输入内容项的长度 n
</certificateLen>
<certificateSn :len="strlen()" :if="0 == $packet.data.certificateModel$option" cn="X509 证书序号">
可选项,只针对“证书模式”为 0时有。
</certificateSn>
<certificateDn :len="strlen()" :if="1 == $packet.data.certificateModel$option" cn="X509 证书的 subject">
可选项,只针对“证书模式”为 1时有。
</certificateDn>
<dataLen len="4" :value="inDataLen()" cn="数据长度">
数据长度
</dataLen>
<inData :len="getDataLen()" cn="签名数据">
签名数据内容
</inData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>6D</hex>
</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>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<signLen len="4" cn="签名长度">
签名长度
</signLen>
<sign :len="signLen()" cn="签名">
数字签名(BASE64)
</sign>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function certificateLen(){
var data = $packet.data;
if( 0 == data.certificateModel$option ){
return data.certificateSn.length()
}
if( 1 == data.certificateModel$option ){
return data.certificateDn.length()
}
}
function inDataLen() {
return $packet.data.inData.length
}
function getDataLen() {
return Util.a2i( $final.getSection('data').getSection('dataLen') )
}
function signLen() {
return Util.a2i( $final.getSection('data').getSection('signLen') );
} </script>
</packet>
+161
View File
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>6D</hex>
</command>
<data extend="data">
<certificateModel len="1" cn="证书模式">
<options>
<option cn="证书序号">
<hex>0</hex>
</option>
<option cn="证书 DN">
<hex>1</hex>
</option>
<option cn="机构号">
<hex>2</hex>
</option>
</options>
</certificateModel>
<certificateLen len="4" :value="certificateLen()" cn="证书内容长度">
根据证书模式,需要输入内容项的长度 n
</certificateLen>
<certificateSn :len="strlen()" :if="0 == $packet.data.certificateModel$option" cn="X509 证书序号">
可选项,只针对“证书模式”为 0时有。
</certificateSn>
<certificateDn :len="strlen()" :if="1 == $packet.data.certificateModel$option" cn="X509 证书的 subject">
可选项,只针对“证书模式”为 1时有。
</certificateDn>
<organizationNum :len="strlen()" :if="2 == $packet.data.certificateModel$option" cn="机构号">
可选项,只针对“证书模式”为2 时有。
</organizationNum>
<dataLen len="4" :value="inDataLen()" cn="数据长度">
数据长度
</dataLen>
<inData :len="getDataLen()" cn="签名数据">
签名数据内容
</inData>
<signLen len="4" :value="signLen()" cn="签名长度">
签名长度
</signLen>
<sign :len="getSignLen()" cn="签名">
签名
</sign>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>6E</hex>
</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>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function certificateLen(){
var data = $packet.data;
if( 0 == data.certificateModel$option ){
return data.certificateSn.length()
}
if( 1 == data.certificateModel$option ){
return data.certificateDn.length()
}
if( 2 == data.certificateModel$option ){
return data.organizationNum.length()
}
}
function inDataLen() {
return $packet.data.inData.length
}
function getDataLen() {
return Util.a2i( $final.getSection('data').getSection('dataLen') )
}
function signLen() {
return $packet.data.sign.length()
}
function getSignLen() {
return Util.a2i( $final.getSection('data').getSection('signLen') )
}
</script>
</packet>
+93
View File
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>6E</hex>
</command>
<data extend="data">
<certificateModel len="1" cn="证书类型">
<options>
<option cn="签名证书">
<hex>0</hex>
</option>
<option cn="加密证书">
<hex>1</hex>
</option>
</options>
</certificateModel>
<dnLen len="4" :value="dnLen()" cn="DN 长度">
DN 长度 n
</dnLen>
<certificateDn :len="strlen()" cn="DN">
Subject
</certificateDn>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>6F</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的DN">
<hex>21</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<snLen len="4" cn="SN 长度">
签名长度
</snLen>
<sn :len="snLength()" cn="SN">
SN
</sn>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function dnLen() {
return $packet.data.certificateDn.length
}
function snLength() {
return Util.a2i( $final.getSection('data').getSection('snLen') )
} </script>
</packet>
+95
View File
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>71</hex>
</command>
<data extend="data">
<publicKeyLength len="4" :value="publicKeyLen()" cn="公钥的长度"></publicKeyLength>
<publicKey cn="公钥"></publicKey>
<key cn="密钥">LMK30-31下加密的密钥</key>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>72</hex>
</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>76</hex>
</option>
<option cn="信息长度错">
<hex>80</hex>
</option>
</options>
</error>
<keyLength len="4" cn="长度(pub)">
公钥加密的密文长度
</keyLength>
<key :len="getKeyLen()" cn="密文(pub)">
公钥加密的密文的DER编码
</key>
</data>
</res>
<script>function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLength') )
}
</script>
</packet>
+156
View File
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>72</hex>
</command>
<data extend="data">
<publicKeyLength len="4" :value="publicKeyLen()" cn="公钥长度">
公钥长度
</publicKeyLength>
<publicKey cn="公钥的">
公钥的 DER 编码
</publicKey>
<lmk len="1" cn="LMK">
LMK 下加密密钥的方案。
</lmk>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>73</hex>
</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>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyLen len="4" cn="密钥密文长度">
公钥加密的密钥密文长度
</keyLen>
<key :len="getKeyLen()" cn="密钥密文">
公钥加密的密钥密文的 DER 编码
</key>
<lmkHead len="1" cn="lmk 头">
如果是 'L' ,lmk 32 个字节长,否则 lmk 64 个字节长。
</lmkHead>
<lmk :len="lmkLen()" cn="对称密钥的密文">
对称密钥的密文,由 LMK30-31 保护。
</lmk>
<keyCheck len="16" cn="密钥校验值">
密钥校验值
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function useLocalKey(){
if( "999999999999999999999999999".equals($packet.data.privateKeyTag))
{
return true;
}else{
return false;
}
}
function userIdLen(){
return $packet.data.userId.length;
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function dataLen(){
return $packet.data.infoData.length;
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLen') )
}
function lmkLen() {
if( Arrays.equals("L".getBytes(),
$final.getSection('data').getSection('lmkHead').getValue()
) ){
return 64
}else{
return 32
}
} </script>
</packet>
+158
View File
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>73</hex>
</command>
<data extend="data">
<privateKeyTag len="27" cn="指示私钥位置的标记" :if="useLocalKey()" >
数字为存储私钥的索引,除了
全 9 表示使用由命令中提供的密钥。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号。
</privateKeyTag>
<privateKeyLength len="4" :value="privateKeyLen()" cn="私钥长度">
当私钥标记为全 9 时使用该区域的值
</privateKeyLength>
<privateKey cn="私钥" >
当私钥标记为全 9 时使用该区域的值
</privateKey>
<cipherKeyLength len="4" :value="cipherKeyLen()" cn="会话密钥长度"></cipherKeyLength>
<cipherKey cn="会话密钥"></cipherKey>
<lmk len="1" cn="LMK">
LMK 下加密密钥的方案。
</lmk>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>74</hex>
</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>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<lmkHead len="1" cn="lmk 头">
如果是 'L' ,lmk 32 个字节长,否则 lmk 64 个字节长。
</lmkHead>
<lmk :len="lmkLen()" cn="对称密钥的密文">
对称密钥的密文,由 LMK30-31 保护。
</lmk>
<keyCheck len="16" cn="密钥校验值">
密钥校验值
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function useLocalKey(){
if( "999999999999999999999999999".equals($packet.data.privateKeyTag))
{
return false;
}else{
return true;
}
}
function userIdLen(){
return $packet.data.userId.length;
}
function cipherKeyLen(){
var data = $packet.data;
return data.cipherKey.length;
}
function dataLen(){
return $packet.data.infoData.length;
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLen') )
}
function lmkLen() {
if( Arrays.equals("L".getBytes(),
$final.getSection('data').getSection('lmkHead').getValue()
) ){
return 64
}else{
return 32
}
} </script>
</packet>
+188
View File
@@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>74</hex>
</command>
<data extend="data">
<signatureDataType len="1" cn="签名数据类型">
<options>
<option cn="HASH">
<hex>0</hex>
</option>
<option cn="原数据">
<hex>1</hex>
</option>
</options>
</signatureDataType>
<hashData :len="32" :if="0 == $packet.data.signatureDataType$option" cn="HASH 值">
可选项,只对“签名数据类型”为 0 时有效。
</hashData>
<userIdLength len="2" :if="1 == $packet.data.signatureDataType$option" :value="userIdLen()" cn="用户 ID 长度">
最大为 64(必须是 4 的整数倍),只对“签名数据类型”为 1 时有效
</userIdLength>
<userId :if="1 == $packet.data.signatureDataType$option" cn="用户 ID">
可选项,只对“签名数据类型”为 1 时有效。
</userId>
<publicKeyLength len="4" :if="1 == $packet.data.signatureDataType$option" :value="publicKeyLen()" cn="公钥长度">
可选项,只对“签名数据类型”为 1 时有效。
</publicKeyLength>
<publicKey :if="1 == $packet.data.signatureDataType$option" cn="公钥的 DER 编码">
可选项,只对“签名数据类型”为 1 时有效。
</publicKey>
<dataLength len="4" :if="1 == $packet.data.signatureDataType$option" :value="dataLen()" cn="用于签名的信息数据的字节长度">
可选项,只对“签名数据类型”为 1 时有效。
</dataLength>
<infoData :if="1 == $packet.data.signatureDataType$option" cn="要签名的信息">
可选项,只对“签名数据类型”为 1 时有效。
</infoData>
<privateKeyTag len="27" cn="指示私钥位置的标记">
数字为存储私钥的索引,除了
全 9 表示使用由命令中提供的密钥。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号。
</privateKeyTag>
<privateKeyLength len="4" cn="加密密钥方案" :if="useLocalKey()" :value="privateKeyLen()">
可选项,当私钥标记为全 9 时显示此域
</privateKeyLength>
<privateKey cn="LMK34-35 下加密的私钥" :if="useLocalKey()">
可选项,当私钥标记为全 9 时显示此域
</privateKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>75</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的私钥类型">
<hex>03</hex>
</option>
<option cn="无效私钥标记">
<hex>04</hex>
</option>
<option cn="无效的哈希标识">
<hex>05</hex>
</option>
<option cn="无效的签名标识">
<hex>06</hex>
</option>
<option cn="无效的附加标识">
<hex>07</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>74</hex>
</option>
<option cn="公钥长度错误">
<hex>76</hex>
</option>
<option cn="私钥长度错误">
<hex>78</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<signatureLen len="4" cn="签名的字节长度">
签名的字节长度
</signatureLen>
<signature :len="signatureLen()" cn="签名的 DER 编码">
签名的 DER 编码
</signature>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function useLocalKey(){
if( "999999999999999999999999999".equals($packet.data.privateKeyTag))
{
return true;
}else{
return false;
}
}
function userIdLen(){
return $packet.data.userId.length;
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function dataLen(){
return $packet.data.infoData.length;
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function signatureLen() {
return Util.a2i( $final.getSection('data').getSection('signatureLen') )
} </script>
</packet>
+164
View File
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>75</hex>
</command>
<data extend="data">
<signatureLen len="4" :value="signatureLen()" cn="签名长度">
签名的字节长度
</signatureLen>
<signature cn="计算的签名(DER)">
计算的签名(DER)
</signature>
<signatureDataType len="1" cn="签名数据类型">
<options>
<option cn="HASH">
<hex>0</hex>
</option>
<option cn="原数据">
<hex>1</hex>
</option>
</options>
</signatureDataType>
<hashData :len="32" :if="0 == $packet.data.signatureDataType$option" cn="HASH 值">
可选项,只对“签名数据类型”为 0 时有效。
</hashData>
<userIdLength len="2" :if="1 == $packet.data.signatureDataType$option" :value="userIdLen()" cn="用户 ID 长度">
最大为 64(必须是 4 的整数倍),只对“签名数据类型”为 1 时有效
</userIdLength>
<userId :if="1 == $packet.data.signatureDataType$option" cn="用户 ID">
可选项,只对“签名数据类型”为 1 时有效。
</userId>
<dataLength len="4" :if="1 == $packet.data.signatureDataType$option" :value="dataLen()" cn="用于签名的信息数据的字节长度">
可选项,只对“签名数据类型”为 1 时有效。
</dataLength>
<infoData :if="1 == $packet.data.signatureDataType$option" cn="要签名的信息">
可选项,只对“签名数据类型”为 1 时有效。
</infoData>
<publicKeyLength len="4" :value="publicKeyLen()" cn="公钥的长度(DER)">
公钥的长度(DER)
</publicKeyLength>
<publicKey cn="公钥的 DER 编码">
公钥的 DER 编码
</publicKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>76</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="签名校验失败">
<hex>02</hex>
</option>
<option cn="公钥不符合编码规则">
<hex>04</hex>
</option>
<option cn="无效的哈希标识">
<hex>05</hex>
</option>
<option cn="无效的签名标识">
<hex>06</hex>
</option>
<option cn="无效的附加标识">
<hex>07</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>74</hex>
</option>
<option cn="公钥长度错误">
<hex>76</hex>
</option>
<option cn="明文数据块错误">
<hex>77</hex>
</option>
<option cn="哈希算法对象标识错误">
<hex>79</hex>
</option>
<option cn="信息长度错">
<hex>80</hex>
</option>
<option cn="签名长度错">
<hex>81</hex>
</option>
</options>
</error>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function signatureLen(){
var data = $packet.data;
return data.signature.length;
}
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function userIdLen(){
var data = $packet.data;
return data.userId.length;
} </script>
</packet>
+145
View File
@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>76</hex>
</command>
<data extend="data">
<packSn len="1" cn="消息块号">
<options>
<option cn="仅一块">
<hex>0</hex>
</option>
<option cn="第一块">
<hex>1</hex>
</option>
<option cn="中间块">
<hex>2</hex>
</option>
<option cn="最后块">
<hex>3</hex>
</option>
</options>
</packSn>
<dataLength len="4" :value="dataLen()" cn="消息长度">
消息长度。
</dataLength>
<msg cn="消息数据">
二进制的消息块
</msg>
<userIdLength len="2" :if="1 == $packet.data.packSn$option || 0 == $packet.data.packSn$option" :value="userIdLen()" cn="用户 ID 长度">
最大为 64(必须是 4 的整数倍),只对“消息块号”为 0、1 时有效
</userIdLength>
<userId :if="1 == $packet.data.packSn$option || 0 == $packet.data.packSn$option" cn="用户 ID">
可选项,只对“消息块号”为 0、1 时有效。
</userId>
<publicKeyLength len="4" :value="publicKeyLen()" :if="1 == $packet.data.packSn$option || 0 == $packet.data.packSn$option" cn="公钥的长度(DER)" >
公钥的长度(DER)
</publicKeyLength>
<publicKey :if="1 == $packet.data.packSn$option || 0 == $packet.data.packSn$option" cn="公钥的 DER 编码">
公钥的 DER 编码
</publicKey>
<filterDataLen len="4" :value="filterDataLength()" :if="hasFilterDataLen()" cn="过渡数据长度">
只对“消息块号”为 2、3 时有效
</filterDataLen>
<filterData :if="hasFilterData()" cn="过渡消息数据">
只对“消息块号”为 2、3 时有效
</filterData>
</data>
</req>
<res>
<command>
<hex>77</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>
<hash len="32" :if="0 == $packet.data.packSn$option || 3 == $packet.data.packSn$option" cn="hash"></hash>
<filterDataLen len="4" :value="filterDataLength()" :if="2 == $packet.data.packSn$option || 1 == $packet.data.packSn$option" cn="过渡数据长度">
只对“消息块号”为 2、1 时有效
</filterDataLen>
<filterData :len="getFilterDataLen()" :if="2 == $packet.data.packSn$option || 1 == $packet.data.packSn$option " cn="过渡消息数据">
只对“消息块号”为 2、1 时有效
</filterData>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function dataLen(){
var data = $packet.data;
return data.msg.length;
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function userIdLen(){
var data = $packet.data;
return data.userId.length;
}
function filterDataLength(){
var data = $packet.data;
return data.filterData.length;
}
function getFilterDataLen() {
return Util.a2i( $final.getSection('data').getSection('filterDataLen') )
}
def hasFilterDataLen(){
try{ return 2 == $packet.data.packSn$option || 3 == $packet.data.packSn$option}catch(Exception e){e.printStackTrace();}
}
def hasFilterData(){
try{ return 2 == $packet.data.packSn$option || 3 == $packet.data.packSn$option}catch(Exception e){e.printStackTrace();}
}
</script>
</packet>
+121
View File
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>77</hex>
</command>
<data extend="data">
<AlgorithmKey len="1" cn="算法标识">
<options>
<option cn="RSA">
<hex>0</hex>
</option>
<option cn="SM2">
<hex>1</hex>
</option>
</options>
</AlgorithmKey>
<fillKey len="1" cn="填充标识" :if="0 == $packet.data.AlgorithmKey$option">
<options>
<option cn="数据长度必须等于密钥长度">
<hex>0</hex>
</option>
<option cn="PKCS#1 v1.5 填充方式">
<hex>1</hex>
</option>
</options>
</fillKey>
<publicKeyLength len="4" :value="publicKeyLen()" cn="公钥的长度(DER)">
公钥的长度(DER)
</publicKeyLength>
<publicKey cn="公钥的 DER 编码">
公钥的 DER 编码
</publicKey>
<dataLength len="4" :value="dataLen()" cn="数据长度">
数据长度
</dataLength>
<infoData cn="数据">
数据
</infoData>
</data>
</req>
<res>
<command>
<hex>78</hex>
</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="输入数据错">
<hex>15</hex>
</option>
<option cn="DSP 错误">
DSP 错误;报告给管理员。
<hex>47</hex>
</option>
<option cn="密钥块长度错误">
<hex>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<dataLen len="4" cn="公钥加密的密文长度">
公钥加密的密文长度
</dataLen>
<cipherData :len="cipherLen()" cn="公钥加密的密文的 DER 编码">
公钥加密的密文的 DER 编码(对于 RSA 算法,数据类
型为 BIT).
</cipherData>
</data>
</res>
<script>
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function cipherLen(){
return Util.a2i( $final.getSection('data').getSection('dataLen') )
}
</script>
</packet>
+155
View File
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>78</hex>
</command>
<data extend="data">
<AlgorithmKey len="1" cn="算法标识">
<options>
<option cn="RSA">
<hex>0</hex>
</option>
<option cn="SM2">
<hex>1</hex>
</option>
</options>
</AlgorithmKey>
<fillKey len="1" cn="填充标识" :if="0 == $packet.data.AlgorithmKey$option">
<options>
<option cn="数据长度必须等于密钥长度">
<hex>0</hex>
</option>
<option cn="PKCS#1 v1.5 填充方式">
<hex>1</hex>
</option>
</options>
</fillKey>
<privateKeyTag len="27" cn="指示私钥位置的标记">
数字为存储私钥的索引,除了
全 9 表示使用由命令中提供的密钥。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号。
</privateKeyTag>
<privateKeyLength len="4" cn="加密密钥方案" :if="useLocalKey()" :value="privateKeyLen()">
可选项,当私钥标记为全 9 时显示此域
</privateKeyLength>
<privateKey cn="LMK下加密的私钥" :if="useLocalKey()">
可选项,当私钥标记为全 9 时显示此域
</privateKey>
<dataLength len="4" :value="dataLen()" cn="数据长度">
密文数据长度
</dataLength>
<infoData cn="数据">
密文数据(DER 编码)
</infoData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>79</hex>
</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="解密错误">
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="DSP 错误">
DSP 错误;报告给管理员。
<hex>47</hex>
</option>
<option cn="密钥块长度错误">
<hex>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<dataLen len="4" cn="公钥加密的密文长度">
解密出的明文长度
</dataLen>
<data :len="resDataLen()" cn="公钥加密的密文的 DER 编码">
公钥加密的密文的 DER 编码(对于 RSA 算法,数据类
型为 BIT).
</data>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function useLocalKey(){
if( "999999999999999999999999999".equals(new String($packet.data.privateKeyTag) ))
{
return true;
}else{
return false;
}
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function resDataLen(){
return Util.a2i( $final.getSection('data').getSection('dataLen') )
} </script>
</packet>
+136
View File
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>79</hex>
</command>
<data extend="data">
<AlgorithmKey len="1" cn="算法标识">
<options>
<option cn="RSA">
<hex>0</hex>
</option>
<option cn="SM2">
<hex>1</hex>
</option>
</options>
</AlgorithmKey>
<fillKey len="1" cn="填充标识" :if="0 == $packet.data.AlgorithmKey$option">
<options>
<option cn="数据长度必须等于密钥长度">
<hex>0</hex>
</option>
<option cn="PKCS#1 v1.5 填充方式">
<hex>1</hex>
</option>
</options>
</fillKey>
<privateKeyTag len="27" cn="指示私钥位置的标记">
数字为存储私钥的索引,除了
全 9 表示使用由命令中提供的密钥。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号。
</privateKeyTag>
<privateKeyLength :if="useLocalKey()" len="4" :value="privateKeyLen()" cn="私钥的长度">
私钥的长度(DER)
</privateKeyLength>
<privateKey :if="useLocalKey()" cn="私钥值">
私钥值
</privateKey>
<dataLength len="4" :value="dataLen()" cn="数据长度">
数据长度
</dataLength>
<infoData cn="数据">
数据
</infoData>
</data>
</req>
<res>
<command>
<hex>7A</hex>
</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="输入数据错">
<hex>15</hex>
</option>
<option cn="DSP 错误">
DSP 错误;报告给管理员。
<hex>47</hex>
</option>
<option cn="密钥块长度错误">
<hex>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<dataLen len="4" cn="密文长度">
密文长度
</dataLen>
<cipherData :len="cipherLen()" cn="密文的 DER 编码">
密文的 DER 编码(对于 RSA 算法,数据类型为 BIT).
</cipherData>
</data>
</res>
<script>
function useLocalKey(){
if( "999999999999999999999999999".equals(new String($packet.data.privateKeyTag) ))
{
return true;
}else{
return false;
}
}
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function cipherLen(){
return Util.a2i( $final.getSection('data').getSection('dataLen') )
}
</script>
</packet>
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>7A</hex>
</command>
<data extend="data">
<AlgorithmKey len="1" cn="算法标识">
<options>
<option cn="RSA">
<hex>0</hex>
</option>
<option cn="SM2">
<hex>1</hex>
</option>
</options>
</AlgorithmKey>
<fillKey len="1" cn="填充标识" :if="0 == $packet.data.AlgorithmKey$option">
<options>
<option cn="数据长度必须等于密钥长度">
<hex>0</hex>
</option>
<option cn="PKCS#1 v1.5 填充方式">
<hex>1</hex>
</option>
</options>
</fillKey>
<publicKeyLength len="4" :value="publicKeyLen()" cn="公钥的长度(DER)">
公钥的长度(DER)
</publicKeyLength>
<publicKey cn="公钥的 DER 编码">
公钥的 DER 编码
</publicKey>
<dataLength len="4" :value="dataLen()" cn="数据长度">
数据长度
</dataLength>
<infoData cn="数据">
数据
</infoData>
</data>
</req>
<res>
<command>
<hex>7B</hex>
</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="输入数据错">
<hex>15</hex>
</option>
<option cn="DSP 错误">
DSP 错误;报告给管理员。
<hex>47</hex>
</option>
<option cn="密钥块长度错误">
<hex>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<dataLen len="4" cn="明文长度">
明文长度
</dataLen>
<cipherData :len="cipherLen()" cn="明文">
明文
</cipherData>
</data>
</res>
<script>
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function cipherLen(){
return Util.a2i( $final.getSection('data').getSection('dataLen') )
}
</script>
</packet>
+161
View File
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>7B</hex>
</command>
<data extend="data">
<signatureDataType len="1" cn="签名数据类型">
<options>
<option cn="HASH">
<hex>0</hex>
</option>
<option cn="原数据">
<hex>1</hex>
</option>
</options>
</signatureDataType>
<hashMark len="1" cn="哈希标识">
指示用于哈希证书数据的哈希算法的标识
<options>
<option cn="SHA1">
<hex>0</hex>
</option>
<option cn="SHA256">
<hex>1</hex>
</option>
<option cn="MD5">
<hex>2</hex>
</option>
</options>
</hashMark>
<hashData :len="32" :if="0 == $packet.data.signatureDataType$option" cn="HASH 值">
可选项,只对“签名数据类型”为 0 时有效。
</hashData>
<dataLength len="4" :if="1 == $packet.data.signatureDataType$option" :value="dataLen()" cn="用于签名的信息数据的字节长度">
可选项,只对“签名数据类型”为 1 时有效。
</dataLength>
<infoData :if="1 == $packet.data.signatureDataType$option" cn="要签名的信息">
可选项,只对“签名数据类型”为 1 时有效。
</infoData>
<privateKeyTag len="27" cn="指示私钥位置的标记">
privateKeyTag len="27" cn="指示私钥位置的标记">
数字为存储私钥的索引,除了
全 9 表示使用由命令中提供的密钥。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号。
</privateKeyTag>
<privateKeyLength len="4" cn="加密密钥方案" :if="useLocalKey()" :value="privateKeyLen()">
可选项,当私钥标记为全 9 时显示此域
</privateKeyLength>
<privateKey cn="LMK34-35 下加密的私钥" :if="useLocalKey()">
可选项,当私钥标记为全 9 时显示此域
</privateKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>7C</hex>
</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="输入数据错">
<hex>15</hex>
</option>
<option cn="DSP 错误">
DSP 错误;报告给管理员。
<hex>47</hex>
</option>
<option cn="公钥长度错误">
<hex>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<signatureLen len="4" cn="签名的字节长度">
签名的字节长度
</signatureLen>
<signature :len="signatureLen()" cn="签名的 DER 编码">
签名的 DER 编码
</signature>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function useLocalKey(){
if( "999999999999999999999999999".equals(new String($packet.data.privateKeyTag) ))
{
return true;
}else{
return false;
}
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function dataLen(){
return $packet.data.infoData.length;
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function signatureLen() {
return Util.a2i( $final.getSection('data').getSection('signatureLen') )
} </script>
</packet>
+164
View File
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>7C</hex>
</command>
<data extend="data">
<signatureLen len="4" :value="signatureLen()" cn="签名长度">
签名的字节长度
</signatureLen>
<signature cn="计算的签名(DER)">
计算的签名(DER)
</signature>
<signatureDataType len="1" cn="签名数据类型">
<options>
<option cn="HASH">
<hex>0</hex>
</option>
<option cn="原数据">
<hex>1</hex>
</option>
</options>
</signatureDataType>
<hashMark len="1" cn="哈希标识">
指示用于哈希证书数据的哈希算法的标识
<options>
<option cn="SHA1">
<hex>0</hex>
</option>
<option cn="SHA256">
<hex>1</hex>
</option>
<option cn="MD5">
<hex>2</hex>
</option>
</options>
</hashMark>
<hashData :len="32" :if="0 == $packet.data.signatureDataType$option" cn="HASH 值">
可选项,只对“签名数据类型”为 0 时有效。
</hashData>
<dataLength len="4" :if="1 == $packet.data.signatureDataType$option" :value="dataLen()" cn="用于签名的信息数据的字节长度">
可选项,只对“签名数据类型”为 1 时有效。
</dataLength>
<infoData :if="1 == $packet.data.signatureDataType$option" cn="要签名的信息">
可选项,只对“签名数据类型”为 1 时有效。
</infoData>
<publicKeyLength len="4" :value="publicKeyLen()" cn="公钥的长度(DER)">
公钥的长度(DER)
</publicKeyLength>
<publicKey cn="公钥的 DER 编码">
公钥的 DER 编码
</publicKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>7D</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="签名校验失败">
<hex>02</hex>
</option>
<option cn="公钥不符合编码规则">
<hex>04</hex>
</option>
<option cn="无效的哈希标识">
<hex>05</hex>
</option>
<option cn="无效的签名标识">
<hex>06</hex>
</option>
<option cn="无效的附加标识">
<hex>07</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>74</hex>
</option>
<option cn="公钥长度错误">
<hex>76</hex>
</option>
<option cn="明文数据块错误">
<hex>77</hex>
</option>
<option cn="哈希算法对象标识错误">
<hex>79</hex>
</option>
<option cn="信息长度错">
<hex>80</hex>
</option>
<option cn="签名长度错">
<hex>81</hex>
</option>
</options>
</error>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function signatureLen(){
var data = $packet.data;
return data.signature.length;
}
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
</script>
</packet>
+127
View File
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>7D</hex>
</command>
<data extend="data">
<hashType len="1" cn="HASH类型">
<options>
<option cn="SHA1">
<hex>0</hex>
</option>
<option cn="SHA256">
<hex>1</hex>
</option>
<option cn="MD5">
<hex>2</hex>
</option>
</options>
</hashType>
<packSn len="1" cn="消息块号">
<options>
<option cn="仅一块">
<hex>0</hex>
</option>
<option cn="第一块">
<hex>1</hex>
</option>
<option cn="中间块">
<hex>2</hex>
</option>
<option cn="最后块">
<hex>3</hex>
</option>
</options>
</packSn>
<dataLength len="4" :value="dataLen()" cn="消息长度">
消息长度。
</dataLength>
<msg cn="消息数据">
二进制的消息块
</msg>
<filterDataLen len="4" :value="filterDataLength()" :if="hasFilterDataLen()" cn="过渡数据长度">
只对“消息块号”为 2、3 时有效
</filterDataLen>
<filterData :if="hasFilterData()" cn="过渡消息数据">
只对“消息块号”为 2、3 时有效
</filterData>
</data>
</req>
<res>
<command>
<hex>7E</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>
<hash len="32" :if="0 == $packet.data.packSn$option || 3 == $packet.data.packSn$option" cn="hash"></hash>
<filterDataLen len="4" :value="filterDataLength()" :if="2 == $packet.data.packSn$option || 1 == $packet.data.packSn$option" cn="过渡数据长度">
只对“消息块号”为 2、1 时有效
</filterDataLen>
<filterData :len="getFilterDataLen()" :if="2 == $packet.data.packSn$option || 1 == $packet.data.packSn$option " cn="过渡消息数据">
只对“消息块号”为 2、1 时有效
</filterData>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function dataLen(){
var data = $packet.data;
return data.msg.length;
}
function filterDataLength(){
var data = $packet.data;
return data.filterData.length;
}
function getFilterDataLen() {
return Util.a2i( $final.getSection('data').getSection('filterDataLen') )
}
def hasFilterDataLen(){
try{ return 2 == $packet.data.packSn$option || 3 == $packet.data.packSn$option}catch(Exception e){e.printStackTrace();}
}
def hasFilterData(){
try{ return 2 == $packet.data.packSn$option || 3 == $packet.data.packSn$option}catch(Exception e){e.printStackTrace();}
}
</script>
</packet>
+86
View File
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>7E</hex>
</command>
<data extend="data">
<userCertificateType len="1" cn="签名数据类型">
<options>
<option cn="签名证书">
<hex>0</hex>
</option>
<option cn="加密证书">
<hex>1</hex>
</option>
</options>
</userCertificateType>
<DNLen len="4" :value="DNLen()" cn="证书长度">
证书长度
</DNLen>
<DN cn="证书">
证书
</DN>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>7F</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的索引值">
<hex>21</hex>
</option>
</options>
</error>
<publicKeyLen len="4" cn="公钥的字节长度">
公钥的字节长度
</publicKeyLen>
<publicKey :len="publicKeyLen()" cn="公钥">
公钥
</publicKey>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function DNLen() {
return $packet.data.DN.length
}
function publicKeyLen() {
return Util.a2i( $final.getSection('data').getSection('publicKeyLen') )
} </script>
</packet>
+119
View File
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>80</hex>
</command>
<data extend="data">
<certificateNoLen len="4" :value="certificateNoLength()" cn="证书序列号长度">
证书序列号的长度
</certificateNoLen>
<certificateNo cn="证书序列号">
X509证书序号
</certificateNo>
<dataLen len="4" :value="dataLength()" cn="数据长度">
数据长度
</dataLen>
<infoData cn="数据">
数据
</infoData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>81</hex>
</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>
<signatureLen len="4" cn="签名的字节长度">
签名的字节长度
</signatureLen>
<signature :len="signatureLen()" cn="签名的 DER 编码">
签名的 DER 编码
</signature>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function certificateNoLength(){
var data = $packet.data;
return data.certificateNo.length;
}
function dataLength(){
return $packet.data.infoData.length;
}
function signatureLen() {
return Util.a2i( $final.getSection('data').getSection('signatureLen') )
} </script>
</packet>
+128
View File
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8003</bin>
</command>
<data extend="data">
<signatureDataType len="1" cn="获取公私钥标记位">
<options>
<option cn="索引方式">
<hex>0</hex>
</option>
<option cn="DN 方式">
<hex>1</hex>
</option>
</options>
</signatureDataType>
<DN cn="DN 或 DN索引">
若上面的标志为1,则此域为证书DN,若为0,则此域为两个字节的证书索引;
</DN>
<dataLength len="2" :value="dataLen()" cn="待签名数据长度">
待签名数据长度
</dataLength>
<data cn="待签名数据">
待签名数据
</data>
</data>
</req>
<res>
<command>
<bin>8004</bin>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的私钥类型">
<hex>03</hex>
</option>
<option cn="无效私钥标记">
<hex>04</hex>
</option>
<option cn="无效的哈希标识">
<hex>05</hex>
</option>
<option cn="无效的签名标识">
<hex>06</hex>
</option>
<option cn="无效的附加标识">
<hex>07</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>74</hex>
</option>
<option cn="公钥长度错误">
<hex>76</hex>
</option>
<option cn="私钥长度错误">
<hex>78</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<signatureLen len="2" cn="签名的字节长度">
签名的字节长度
</signatureLen>
<signature :len="signatureLen()" cn="签名的 DER 编码">
签名的 DER 编码
</signature>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script type="javascript"><![CDATA[
function dataLen(){
def len = $packet.data.data.length
def ret = new byte[2]
ret[0] = (byte)(len >> 8 & 0xFF)
ret[1] = (byte)(len & 0xFF)
return ret;
}
function signatureLen() {
return Util.b2i( $final.data.signatureLen )
}
]]> </script>
</packet>
+176
View File
@@ -0,0 +1,176 @@
<?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="索引方式">
<hex>0</hex>
</option>
<option cn="DN 方式">
<hex>1</hex>
</option>
<option cn="通过机构号获取">
<hex>2</hex>
</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>
<data cn="待签名数据">
待签名数据
</data>
<signatureLen len="2" :value="signLen()" cn="签名的字节长度">
签名的字节长度
</signatureLen>
<signature :len="signatureLen()" cn="签名的 DER 编码">
签名的 DER 编码
</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.data.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>
+101
View File
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8005</bin>
</command>
<data extend="data">
<DN len="256" cn="证书 DN">
X509证书序号
</DN>
<hashFlag cn="是否为 hash 模式" len="1" required="false"></hashFlag>
<hash cn="hash 值" :if="'P' == $packet.data.hashFlag"></hash>
<dataLen :if="'P' != $packet.data.hashFlag" len="2" format="X" :value="dataLength()" cn="数据长度">
数据长度
</dataLen>
<infoData :if="'P' != $packet.data.hashFlag" cn="数据">
数据
</infoData>
</data>
</req>
<res>
<command>
<bin>8006</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>
<signatureLen len="2" cn="签名的字节长度">
签名的字节长度
</signatureLen>
<signature :len="signatureLen()" cn="签名的 DER 编码">
签名的 DER 编码
</signature>
</data>
</res>
<script><![CDATA[ function dataLength(){
def len = $packet.data.infoData.length;
def data = new byte[2];
data[0] = (byte)(len >> 8 & 0xFF)
data[1] = (byte)(len & 0xFF)
return data;
}
function signatureLen() {
return Util.b2i( $final.getSection('data').getSection('signatureLen') )
} ]]> </script>
</packet>
+130
View File
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8006</bin>
</command>
<data extend="data">
<hashFlag cn="是否为 hash 模式" len="1" required="false"></hashFlag>
<hash cn="hash 值" :if="'P' == $packet.data.hashFlag"></hash>
<originLen :if="'P' != $packet.data.hashFlag" len="2" :value="orginLength()" cn="待签名数据长度">
待签名数据长度
</originLen>
<originData :if="'P' != $packet.data.hashFlag" cn="待签名数据">
待签名数据
</originData>
<signLen len="2" :value="signLength()" cn="数据长度">
已签名数据长度
</signLen>
<signData cn="已签名数据">
已签名数据
</signData>
<flag len="2" cn="标记">
<options>
<option cn="不返回">
<bin>0000</bin>
</option>
<option cn="返回">
<bin>0001</bin>
</option>
</options>
</flag>
</data>
</req>
<res>
<command>
<bin>8007</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.flag$option">
信息长度
</infoLen>
<info :len="getInfoLen()" cn="信息" :if="0 != $packet.data.flag$option">
若发送报文返回证书信息标志位为0,则返回已签名数据,
若发送报文返回证书信息标志位为1,则返回 CERT_INFO 结构的证书数据
</info>
</data>
</res>
<script><![CDATA[
function orginLength(){
def len = $packet.data.originData.length;
def data = new byte[2];
data[0] = (byte)(len >> 8 & 0xFF)
data[1] = (byte)(len & 0xFF)
return data;
}
function signLength(){
def len = $packet.data.signData.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>
+155
View File
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8012</bin>
</command>
<data extend="data">
<originLen len="2" :value="orginLength()" cn="待签名数据长度">
待签名数据长度
</originLen>
<originData cn="待签名数据">
待签名数据
</originData>
<signLen len="2" :value="signLength()" cn="数据长度">
已签名数据长度
</signLen>
<signData cn="已签名数据">
已签名数据
</signData>
<flag len="2" cn="标记">
<options>
<option cn="不上载">
<bin>0000</bin>
</option>
<option cn="上载并返回证书内容">
<bin>0001</bin>
</option>
<option cn="上传并返回证书内容,并更新机构号">
<bin>0002</bin>
</option>
</options>
</flag>
<organizationNumLen len="2" :if="useOrganization()" :value="bNumberLength()" cn="机构号长度">
标志为0002 时存在
</organizationNumLen>
<organizationNum :if="useOrganization()" cn="机构号内容">
标志为0002 时存在
</organizationNum>
</data>
</req>
<res>
<command>
<bin>8013</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="信息长度">
信息长度
</infoLen>
<info :len="infoLen()" cn="信息">
若发送报文返回证书信息标志位为0,则返回已签名数据,
若发送报文返回证书信息标志位为1,则返回CERT_INFO结构的证书数据
</info>
</data>
</res>
<script><![CDATA[
function orginLength(){
def len = $packet.data.originData.length;
def data = new byte[2];
data[0] = (byte)(len >> 8 & 0xFF)
data[1] = (byte)(len & 0xFF)
return data;
}
function signLength(){
def len = $packet.data.signData.length;
def data = new byte[2];
data[0] = (byte)(len >> 8 & 0xFF)
data[1] = (byte)(len & 0xFF)
return data;
}
function useOrganization(){
if (0002 == $packet.data.flag$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 infoLen() {
if (null == $final.data.infoLen){
return 0;
}
return Util.b2i( $final.data.infoLen )
} ]]> </script>
</packet>
+97
View File
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8016</bin>
</command>
<data extend="data">
<certLen len="2" format="X" :value="certificateLen()" cn="证书长度"></certLen>
<cert cn="证书"></cert>
</data>
</req>
<res>
<command>
<bin>8017</bin>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的私钥类型">
<hex>03</hex>
</option>
<option cn="无效私钥标记">
<hex>04</hex>
</option>
<option cn="无效的哈希标识">
<hex>05</hex>
</option>
<option cn="无效的签名标识">
<hex>06</hex>
</option>
<option cn="无效的附加标识">
<hex>07</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>74</hex>
</option>
<option cn="公钥长度错误">
<hex>76</hex>
</option>
<option cn="私钥长度错误">
<hex>78</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<certInfoLen len="2" format="X" cn="证书信息的字节长度">
证书信息的字节长度
</certInfoLen>
<certInfo :len="certInfoLen()" cn="证书">
证书信息
</certInfo>
</data>
</res>
<script>function certificateLen(){
var data = $packet.data;
int len = data.cert.length
byte[] ret = new byte[2];
ret[0] = len / 256
ret[1] = len % 256
return ret
}
function certInfoLen() {
return Util.b2i( $final.getSection('data').getSection('certInfoLen') )
} </script>
</packet>
+99
View File
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8017</bin>
</command>
<data extend="data">
<userId cn="用户编号">
用户编号
</userId>
<type len="1" format="X" cn="证书类型">
</type>
</data>
</req>
<res>
<command>
<bin>8018</bin>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的私钥类型">
<hex>03</hex>
</option>
<option cn="无效私钥标记">
<hex>04</hex>
</option>
<option cn="无效的哈希标识">
<hex>05</hex>
</option>
<option cn="无效的签名标识">
<hex>06</hex>
</option>
<option cn="无效的附加标识">
<hex>07</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>74</hex>
</option>
<option cn="公钥长度错误">
<hex>76</hex>
</option>
<option cn="私钥长度错误">
<hex>78</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<certLen len="2" format="X" cn="证书的字节长度">
证书的字节长度
</certLen>
<cert :len="certLen()" cn="证书">
证书
</cert>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function certLen() {
return Util.b2i( $final.getSection('data').getSection('certLen') )
} </script>
</packet>
+93
View File
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8018</bin>
</command>
<data extend="data">
<DN len="256" cn="证书 DN">
X509证书序号
</DN>
<dataLen len="4" :value="dataLength()" cn="数据长度">
数据长度
</dataLen>
<infoData cn="数据">
数据
</infoData>
</data>
</req>
<res>
<command>
<bin>8006</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>
<signatureLen len="2" cn="签名的字节长度">
签名的字节长度
</signatureLen>
<signature :len="signatureLen()" cn="签名的 DER 编码">
签名的 DER 编码
</signature>
</data>
</res>
<script>function dataLength(){
return $packet.data.infoData.length;
}
function signatureLen() {
return Util.a2i( $final.getSection('data').getSection('signatureLen') )
} </script>
</packet>
+105
View File
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8019</bin>
</command>
<data extend="data">
<DN len="256" cn="证书 DN">
X509证书序号
</DN>
<dataLen len="2" :value="dataLength()" cn="数据长度">
已签名数据长度
</dataLen>
<infoData cn="已签名数据">
已签名数据
</infoData>
<flag len="2" cn="标记">
<options>
<option cn="不返回">
<bin>0000</bin>
</option>
<option cn="返回">
<bin>0001</bin>
</option>
</options>
</flag>
</data>
</req>
<res>
<command>
<bin>8007</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="信息长度">
信息长度
</infoLen>
<info :len="infoLen()" cn="信息">
若发送报文返回证书信息标志位为0,则返回已签名数据,
若发送报文返回证书信息标志位为1,则返回CERT_INFO结构的证书数据
</info>
</data>
</res>
<script>function dataLength(){
return $packet.data.infoData.length;
}
function infoLen() {
return Util.a2i( $final.data.infoLen )
} </script>
</packet>
+104
View File
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8024</bin>
</command>
<data extend="data">
<keyTag len="4" cn="密钥号">
密钥对应的索引号。
</keyTag>
<hashFlag cn="是否为 hash 模式" len="1" required="false"></hashFlag>
<hash cn="hash 值" len="32" :if="'P' == $packet.data.hashFlag"></hash>
<dataLen :if="'P' != $packet.data.hashFlag" len="2" format="X" :value="dataLength()" cn="数据长度">
数据长度
</dataLen>
<infoData :if="'P' != $packet.data.hashFlag" cn="数据">
数据
</infoData>
</data>
</req>
<res>
<command>
<bin>8025</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>
<signatureLen len="2" cn="签名的字节长度">
签名的字节长度
</signatureLen>
<signature :len="signatureLen()" cn="签名的 DER 编码">
签名的 DER 编码
</signature>
</data>
</res>
<script>
<![CDATA[
function dataLength(){
def len = $packet.data.infoData.length;
def data = new byte[2];
data[0] = (byte)(len >> 8 & 0xFF)
data[1] = (byte)(len & 0xFF)
return data;
}
function signatureLen() {
return Util.b2i( $final.getSection('data').getSection('signatureLen') )
} ]]> </script>
</packet>
+130
View File
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8025</bin>
</command>
<data extend="data">
<hashFlag cn="是否为 hash 模式" len="1" required="false"></hashFlag>
<hash cn="hash 值" len="32" :if="'P' == $packet.data.hashFlag"></hash>
<originLen :if="'P' != $packet.data.hashFlag" len="2" :value="orginLength()" cn="待签名数据长度">
待签名数据长度
</originLen>
<originData :if="'P' != $packet.data.hashFlag" cn="待签名数据">
待签名数据
</originData>
<signLen len="2" :value="signLength()" cn="数据长度">
已签名数据长度
</signLen>
<signData cn="已签名数据">
已签名数据
</signData>
<flag len="2" cn="标记">
<options>
<option cn="不返回">
<bin>0000</bin>
</option>
<option cn="返回">
<bin>0001</bin>
</option>
</options>
</flag>
</data>
</req>
<res>
<command>
<bin>8026</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.flag$option">
信息长度
</infoLen>
<info :len="getInfoLen()" cn="信息" :if="0 != $packet.data.flag$option">
若发送报文返回证书信息标志位为0,则返回已签名数据,
若发送报文返回证书信息标志位为1,则返回 CERT_INFO 结构的证书数据
</info>
</data>
</res>
<script> <![CDATA[
function orginLength(){
def len = $packet.data.originData.length;
def data = new byte[2];
data[0] = (byte)(len >> 8 & 0xFF)
data[1] = (byte)(len & 0xFF)
return data;
}
function signLength(){
def len = $packet.data.signData.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>
+105
View File
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<bin>8026</bin>
</command>
<data extend="data">
<certificateNoLen len="1" format="X" :value="certificateNoLength()" cn="证书序列号长度">
证书序列号的长度
</certificateNoLen>
<certificateNo cn="证书序列号">
X509证书序号
</certificateNo>
<dataSign len="1" required="false" cn="签名数据类型标识">
‘p’:为p时传入数据为SM3-HASH值
</dataSign>
<hash len="32" :if=" 'P' == $packet.data.dataSign " cn="SM3-HASH">
待签名数据的HASH标志位存在时存在
</hash>
<dataLength len="2" format="X" :if=" 'P' != $packet.data.dataSign " :value="dataLen()" cn="用于签名的信息数据的字节长度">
待签名数据长度。签名数据类型志位存在时不存在
</dataLength>
<infoData :if=" 'P' != $packet.data.dataSign " cn="要签名的信息">
待签名数据内容。签名数据类型志位存在时不存在
</infoData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<bin>8027</bin>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
</options>
</error>
<signatureLen len="2" cn="返回结果长度">
</signatureLen>
<signature :len="resSignatureLen()" cn="返回结果数据">
符合PKCS7标准的签名结果
</signature>
</data>
</res>
<script> <![CDATA[
function signatureLen(){
var data = $packet.data;
return data.signature.length;
}
function dataLen(){
def len = $packet.data.infoData.length;
def data = new byte[2];
data[0] = (byte)(len >> 8 & 0xFF)
data[1] = (byte)(len & 0xFF)
return data;
}
function certificateNoLength(){
def len = $packet.data.certificateNo.length();
def data = new byte[1];
data[0] = (byte)(len & 0xFF)
return data;
}
function resSignatureLen() {
return Util.b2i( $final.getSection('data').getSection('signatureLen') )
}
]]> </script>
</packet>
+121
View File
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>81</hex>
</command>
<data extend="data">
<certificateNoLen len="4" :value="certificateNoLength()" cn="证书序列号长度">
证书序列号的长度
</certificateNoLen>
<certificateNo cn="证书序列号">
X509证书序号
</certificateNo>
<dataLength len="4" :value="dataLen()" cn="用于签名的信息数据的字节长度">
数据长度。
</dataLength>
<infoData cn="要签名的信息">
签名数据内容
</infoData>
<signatureLen len="4" :value="signatureLen()" cn="签名长度">
签名的字节长度
</signatureLen>
<signature cn="计算的签名(DER)">
计算的签名(DER)
</signature>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>82</hex>
</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>76</hex>
</option>
<option cn="信息长度错">
<hex>80</hex>
</option>
</options>
</error>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function signatureLen(){
var data = $packet.data;
return data.signature.length;
}
function dataLen(){
var data = $packet.data;
return data.infoData.length;
}
function certificateNoLength(){
var data = $packet.data;
return data.certificateNo.length;
} </script>
</packet>
+136
View File
@@ -0,0 +1,136 @@
<?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>
+127
View File
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>83</hex>
</command>
<data extend="data">
<cardType len="1" cn="卡类型">
<options>
<option cn="Visa">
<hex>0</hex>
</option>
<option cn="Master">
<hex>1</hex>
</option>
<option cn="PBOC">
<hex>2</hex>
</option>
</options>
</cardType>
<AlgorithmType len="1" cn="算法类型" >
<options>
<option cn="3DES">
<hex>0</hex>
</option>
<option cn="SM4">
仅PBOC类型卡片支持SM4
<hex>1</hex>
</option>
</options>
</AlgorithmType>
<pattern len="1" cn="模式">
<options>
<option cn="只验证ARQC">
<hex>0</hex>
</option>
<option cn="验证ARQC,验证成功后生成 ARPC">
<hex>1</hex>
</option>
<option cn="只产生ARPC">
<hex>2</hex>
</option>
</options>
</pattern>
<keyType len="3" cn="应用主密钥密钥类型">
应用主密钥密钥类型
</keyType>
<key len="27" cn="应用主密钥">
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号,‘K’为传入索引标志;
</key>
<cardDispersionFactor len="16" cn="卡片分散因子">
用于分散主密钥生成卡片密钥
</cardDispersionFactor>
<ATC len="4" cn="ATC(会话密钥分散因子)">
用于进一步分散卡片密钥生成会话密钥,VISA卡,卡片密钥与会话密钥相同。
</ATC>
<ARQC len="16" cn="ARQC">
待验证ARQC,同时参与ARPC生成
</ARQC>
<messageLength len="4" :if="0 == $packet.data.patten$option || 1 == $packet.data.patten$option" :value="messageLen()" cn="数据长度">
模式为0/1时存在,用于计算ARQC并校验的数据长度
</messageLength>
<message cn="数据">
用于计算ARQC并校验的数据
</message>
<ARC len="4" :if="1 == $packet.data.patten$option || 2 == $packet.data.patten$option" cn="ARC">
模式为1/2时存在,作用于ARQC,然后用于计算ARPC
</ARC>
</data>
</req>
<res>
<command>
<hex>84</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ARQC校验失败">
<hex>07</hex>
</option>
<option cn="LMK运算错误">
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="数据长度错">
<hex>80</hex>
</option>
</options>
</error>
<APRC len="16" :if="1 == $packet.data.patten$option || 2 == $packet.data.patten$option" cn="APRC">
模式为1/2,输出AQPC
</APRC>
</data>
</res>
<script>
function messageLen(){
var data = $packet.data;
return data.message.length();
}
</script>
</packet>
+109
View File
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>93</hex>
</command>
<data extend="data">
<privateKeyLength len="4" :value="privateKeyLen()" cn="私钥的长度"></privateKeyLength>
<privateKey cn="私钥"></privateKey>
<publicKeyLength len="4" :value="publicKeyLen()" cn="公钥的长度"></publicKeyLength>
<publicKey cn="公钥"></publicKey>
<dataLength len="4" :value="dataLen()" cn="数据的长度"></dataLength>
<data cn="数据"></data>
</data>
</req>
<res>
<command>
<hex>94</hex>
</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>76</hex>
</option>
<option cn="信息长度错">
<hex>80</hex>
</option>
</options>
</error>
<dev len="16" cn="设备编号" >
设备编号
</dev>
<signLength len="4" cn="签名长度">
签名长度
</signLength>
<sign :len="getSignLen()" cn="密钥">
密钥
</sign>
</data>
</res>
<script>
function dataLen(){
var data = $packet.data;
return data.data.length;
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function getSignLen() {
return Util.a2i( $final.getSection('data').getSection('signLength') )
} </script>
</packet>
+131
View File
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>94</hex>
</command>
<data extend="data">
<pkLen len="4" :value="pkLength()" cn="公钥长度">
公钥长度
</pkLen>
<pk cn="公钥">
DER 编码的公钥
</pk>
<infoLen len="4" :value="infoLength()" cn="附加信息长度">
附加信息长度
</infoLen>
<info cn="附加信息">
附加信息
</info>
<sln len="1" cn="密钥方案">
密钥方案
</sln>
</data>
</req>
<res>
<command>
<hex>95</hex>
</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>76</hex>
</option>
<option cn="信息长度错">
<hex>80</hex>
</option>
</options>
</error>
<keyLength len="4" cn="密钥长度">
密钥长度
</keyLength>
<key :len="getKeyLen()" cn="密钥">
密钥
</key>
<takLmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</takLmkHead>
<takLmk len="32" cn="ZPK(ZMK)" >
LMK 对 16-17 下加密的 TAK
</takLmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 TAK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。 当 LMK 的密钥方案为 S 时,默认或 KCV
类型为 0 时,输出 32H 的 KCV
</keyCheck>
</data>
</res>
<script>
function pkLength(){
var data = $packet.data;
return data.pk.length;
}
function infoLength(){
var data = $packet.data;
return data.info.length;
}
function keyCheckLen() {
var sln = $packet.data.sln
if ( "S".equals( sln ) ) {
return 32
}else {
return 16
}
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLength') )
}
</script>
</packet>
+147
View File
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>95</hex>
</command>
<data extend="data">
<privateKeyLength len="4" :value="privateKeyLen()" cn="私钥的长度"></privateKeyLength>
<privateKey cn="私钥"></privateKey>
<keyLength len="4" :value="keyLen()" cn="密钥的长度">公钥加密后的密钥的长度</keyLength>
<key cn="密钥">公钥加密后的密钥</key>
<sln len="1" cn="密钥的方案">
LMK 下加密密钥的方案。
</sln>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>96</hex>
</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>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<lmkHead len="1" cn="lmk 头">
如果是 'L' ,lmk 32 个字节长,否则 lmk 64 个字节长。
</lmkHead>
<lmk :len="lmkLen()" cn="对称密钥的密文">
对称密钥的密文,由 LMK30-31 保护。
</lmk>
<keyCheck :len="KCVLen()" cn="密钥校验值">
密钥校验值
</keyCheck>
<infoLen len="4" cn="附加信息长度">
附加信息长度
</infoLen>
<info :len="getInfoLen()" cn="附加信息">
附加信息
</info>
</data>
</res>
<script>
function keyLen(){
var data = $packet.data;
return data.key.length;
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function KCVLen(){
var sln = $packet.data.sln
if ( "S".equals( sln ) ) {
return 32
}else {
return 16
}
}
function getKeyLen() {
return Util.a2i( $final.getSection('data').getSection('keyLen') )
}
function getInfoLen() {
return Util.a2i( $final.getSection('data').getSection('infoLen') )
}
function lmkLen() {
if( Arrays.equals("L".getBytes(),
$final.getSection('data').getSection('lmkHead').getValue()
) ){
return 64
}else{
return 32
}
} </script>
</packet>
+113
View File
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>96</hex>
</command>
<data extend="data">
<keyA len="33" cn="密钥 A"></keyA>
<keyB len="33" cn="密钥 B"></keyB>
<sln len="1" cn="密钥方案"></sln>
<alg len="1" cn="算法"></alg>
</data>
</req>
<res>
<command>
<hex>97</hex>
</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>76</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyC len="33" cn="合成密钥">
合成密钥
</keyC>
<keyCheck :len="KCVLen()" cn="密钥校验值">
密钥校验值
</keyCheck>
<infoLen len="4" cn="附加信息长度">
附加信息长度
</infoLen>
<info :len="getInfoLen()" cn="附加信息">
附加信息
</info>
</data>
</res>
<script>
function publicKeyLen(){
var data = $packet.data;
return data.publicKey.length;
}
function privateKeyLen(){
var data = $packet.data;
return data.privateKey.length;
}
function getInfoLen() {
return Util.a2i( $final.getSection('data').getSection('infoLen') )
}
function KCVLen(){
var sln = $packet.data.sln
if ( "S".equals( sln ) ) {
return 32
}else {
return 16
}
} </script>
</packet>
+170
View File
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>A0</hex>
</command>
<data extend="data">
<mode len="1" cn="模式">
<options>
<option cn="产生密钥">
<hex>0</hex>
</option>
<option cn="产生密钥并在 ZMK 下加密">
<hex>1</hex>
</option>
</options>
</mode>
<keyType len="3" cn="密钥类型">
密钥类型
</keyType>
<solution len="1" cn="密钥长度/LMK 下加密密钥的方案。">
密钥长度/LMK 下加密密钥的方案。
</solution>
<zmk cn="ZMK" :if="hasZmk()">
仅当模式为 1 时才显示该 ZMK 域
</zmk>
<keySolution len="1" cn="加密输出密钥的密钥方案" :if="1 == $packet.data.mode$option">
加密输出密钥的密钥方案。仅当模式为 1 时才显示该域
</keySolution>
<businessKey len="1" cn="业务标识" required="false">
<text>N</text>
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>A1</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
</options>
</error>
<lmkHead len="1" cn="lmk 头">
如果是 'Z' ,lmk 16 个字节长
如果是 'X,U,S' ,lmk 32 个字节长
如果是 'Y,T' ,lmk 48 个字节长
</lmkHead>
<lmk :len="lmkLen()" cn="密钥(LMK)">
LMK 加密下的密钥。
</lmk>
<zmkHead len="1" cn="zmk 头" :if="1 == $packet.data.mode$option">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zmkHead>
<zmk :len="zmkLen()" cn="密钥(ZMK)" :if="1 == $packet.data.mode$option">
ZMK 加密下的密钥。
</zmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值" required="false">
密钥校验值。当存在 ZMK 密钥时,以 ZMK 保护新密钥
的方案为基准,否则以 LMK 保护新密钥的方案为基准。
当保护新密钥的密钥方案为 S 时,输出 32H, KCV 计
算算法为 SM4,否则,输出 16H,KCV 计算算法为
DES/3DES
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function lmkLen() {
if( $final.data.lmkHead.eqStr("Y") || $final.data.lmkHead.eqStr("T") ){
return 48
}else if( $final.data.lmkHead.eqStr("X") || $final.data.lmkHead.eqStr("U") ){
return 32
}
return 15
}
function zmkLen() {
if( $final.data.lmkHead.eqStr("Y") || $final.data.lmkHead.eqStr("T") ){
return 48
}else if( $final.data.lmkHead.eqStr("X") || $final.data.lmkHead.eqStr("U") ){
return 32
}
return 15
}
function keyCheckLen() {
if( null != $final.data.zmk ){
if( $final.data.zmkHead.eqStr("S") ){
return 32
}else{
return 16
}
}else{
if( $final.data.lmkHead.eqStr("S") ){
return 32
}else{
return 16
}
}
}
function hasZmk(){
return 1 == $packet.data.mode$option
}
</script>
</packet>
+118
View File
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>A2</hex>
</command>
<data extend="data">
<keyType len="3" cn="密钥类型">
密钥类型
</keyType>
<solution len="1" cn="密钥长度/LMK 下加密密钥的方案。">
密钥长度/LMK 下加密密钥的方案。
</solution>
<flag len="1" cn="业务标识">
业务标识
</flag>
<print cn="打印域">
; 分隔多个打印域
</print>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>A3</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="密钥奇偶校验错">
<hex>01</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="无效的密钥类型">
<hex>28</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyHead len="1" cn="lmk 头">
如果是 'Z' ,lmk 16 个字节长
如果是 'X,U,S' ,lmk 32 个字节长
如果是 'Y,T' ,lmk 48 个字节长
</keyHead>
<key :len="Len()" cn="密钥(LMK)">
LMK 加密下的密钥。
</key>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function Len() {
if( $final.data.keyHead.eqStr("Y") || $final.data.keyHead.eqStr("T") ){
return 48
}else if( $final.data.keyHead.eqStr("X") || $final.data.keyHead.eqStr("U") ){
return 32
}
return 15
}
</script>
</packet>
+124
View File
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>A4</hex>
</command>
<data extend="data">
<num len="1" cn="成分数量">
2到9
</num>
<keyType len="3" cn="密钥类型">
查看密钥类型表。
</keyType>
<lmkSolution len="1" cn="密钥方案(LMK)">
LMK下加密密钥的方案
</lmkSolution>
<keys cn="所有成分">
所有成分
</keys>
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>A5</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的成份号">
<hex>03</hex>
</option>
<option cn="成份奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyHead len="1" cn="lmk 头">
如果是 'Z' ,lmk 16 个字节长
如果是 'X,U,S' ,lmk 32 个字节长
如果是 'Y,T' ,lmk 48 个字节长
</keyHead>
<key :len="Len()" cn="密钥(LMK)">
LMK 加密下的密钥。
</key>
<kcv :len="KCVLen()" cn="密钥校验值">
密钥校验值。密钥方案为S时,此载为32H。
</kcv>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function Len() {
return Util.lenChoice($final.getSection('data').getSection('keyHead').getValue() )
}
function KCVLen() {
if( $final.data.keyHead.eqStr("S") ){
return 32
}
return 16
}
</script>
</packet>
+139
View File
@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>A6</hex>
</command>
<data extend="data">
<keyType len="3" cn="密钥类型">
密钥类型
</keyType>
<zmk cn="zmk">
ZMK。
27 位的索引号: 16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<key cn="密钥(ZMK)">
ZMK 加密下的密钥。
</key>
<keySolution len="1" cn="加密输出密钥的密钥方案" >
加密输出密钥的密钥方案。
</keySolution>
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>A7</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="密钥奇偶校验错">
<hex>01</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="无效的密钥类型">
<hex>28</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<lmkHead len="1" cn="lmk 头">
如果是 'Z' ,lmk 16 个字节长
如果是 'X,U,S' ,lmk 32 个字节长
如果是 'Y,T' ,lmk 48 个字节长
</lmkHead>
<lmk :len="Len()" cn="密钥(LMK)">
LMK 加密下的密钥。
</lmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
密钥校验值。当 LMK 保护密钥的方案为‘S’,KCV 为
32H,算法为 SM4,否则 KCV 为 16H,算法为 DES/3DES
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function Len() {
if( $final.data.lmkHead.eqStr("Y") || $final.data.lmkHead.eqStr("T") ){
return 48
}else if( $final.data.lmkHead.eqStr("X") || $final.data.lmkHead.eqStr("U") ){
return 32
}
return 15
}
function keyCheckLen() {
if ( $final.data.lmkHead.eqStr("S") ) {
return 32
} else {
return 16
}
} </script>
</packet>
+134
View File
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>A8</hex>
</command>
<data extend="data">
<keyType len="3" cn="密钥类型">
查看密钥类型表
</keyType>
<zmk cn="zmk">
ZMK。
27 位的索引号: 16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<key cn="密钥(LMK)">
LMK 加密的密钥。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</key>
<keySolution len="1" cn="密钥方案(ZMK)" >
加密输出密钥的密钥方案
</keySolution>
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>A9</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="密钥校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<zmkHead len="1" cn="zmk 头">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zmkHead>
<zmk :len="Len()" cn="密钥(ZMK)">
ZMK 加密下的密钥。
</zmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
密钥校验值。当 ZMK 保护密钥的方案为‘S’,KCV 为
32H,算法为 SM4,否则 KCV 为 16H,算法为 DES/3DES
密钥校验值,当密钥方案为 S 时输出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function Len() {
return Util.lenChoice($final.getSection('data').getSection('zmkHead').getValue() )
}
function keyCheckLen() {
if (Arrays.equals("S".getBytes(),
$final.getSection('data').getSection('zmkHead').getValue()
)) {
return 32
} else {
return 16
}
} </script>
</packet>
+119
View File
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>AA</hex>
</command>
<data extend="data">
<keyType len="3" cn="密钥类型">
密钥类型
</keyType>
<keySolution len="1" cn="密 钥 方 案(LMK)" >
LMK 下加密密钥的方案
</keySolution>
<keyClearPattern cn="密钥明文模式" >
两个明文分量异或合成
</keyClearPattern>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>AB</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
</options>
</error>
<lmkHead len="1" cn="lmk 头">
如果是 'X,U,S' ,lmk 32 个字节长
如果是 'Y,T' ,lmk 48 个字节长
</lmkHead>
<lmk :len="lmkLen()" cn="密钥(LMK)">
LMK 加密下的密钥。
</lmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
密钥校验值。当保护新密钥的密钥方案为 S 时,
输出 32H, KCV 计算算法为 SM4,否则,输出
16H,KCV 计算算法为 DES/3DES
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function Len() {
return Util.lenChoice($final.getSection('data').getSection('lmkHead').getValue() )
}
function lmkLen() {
if( $final.data.lmkHead.eqStr("Y") || $final.data.lmkHead.eqStr("T") ){
return 48
}else if( $final.data.lmkHead.eqStr("X") || $final.data.lmkHead.eqStr("U") ){
return 32
}
return 15
}
function keyCheckLen() {
if (Arrays.equals("S".getBytes(),
$final.getSection('data').getSection('lmkHead').getValue()
)) {
return 32
} else {
return 16
}
}
</script>
</packet>
+101
View File
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>AB</hex>
</command>
<data extend = "data">
<keyType len="3" cn="秘钥类型">
密钥类型(固定为002)。
</keyType>
<key cn="密钥(LMK)">
LMK下加密密钥的方案。
</key>
<keyCheck len="1" cn="输出校验值算法选项" required="false">
取值P,默认算法由密钥方案决定
</keyCheck>
<checkAlg len="1" cn="校验值算法" :if=" null != $packet.data.keyCheck ">
<options>
<option cn="3DES">
<hex>0</hex>
</option>
<option cn="SM4">
<hex>1</hex>
</option>
</options>
</checkAlg>
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>AC</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK错误;报告给管理员">
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
</options>
</error>
<key1 :len="len()" cn="密钥明文分量1"></key1>
<key2 :len="len()" cn="密钥明文分量2"></key2>
<keyCheck :len="len()" cn="密钥校验值">
密钥明文的校验值
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function len() {
if(1 == $packet.get('data').get('checkAlg$option')){
return 32
}else {
return 16
}
}
</script>
</packet>
+124
View File
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>AE</hex>
</command>
<data extend="data">
<tmkNow cn="TMK" >
LMK 对(14-15)下加密的当前 TMK、 TPK 或 PVK
</tmkNow>
<tmkStorage cn="TMK" >
LMK 对(14-15)下加密的存储 TMK、 TPK 或 PVK
</tmkStorage>
<separator cn="分隔符" :if=" null != $packet.data.tmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<tmkSolution len="1" cn="密钥方案(TMK)" required="false">
可选项。TMK 下加密密钥的方案。
</tmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。LMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>AF</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="当前 TMK、 TPK 或 PVK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="存储 TMK、 TPK 或 PVK 奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
</options>
</error>
<tmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</tmkHead>
<tmkKey :len="tmkLen()" cn="ZPK(ZMK)" >
当前密钥下加密的存储密钥
</tmkKey>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 ZPK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。
当输出的 ZMK 加密的 ZPK 密钥方案为 S 时,KCV 选项
为 0 是,输入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function tmkLen() {
return Util.lenChoice($final.getSection('data').getSection('tmkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('tmkHead').getValue() )
} </script>
</packet>
+137
View File
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>AG</hex>
</command>
<data extend="data">
<tmk cn="TMK" >
LMK 对(14-15)下加密的 TMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</tmk>
<tak cn="TAK" >
LMK 对(16-17)下加密的 TAK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</tak>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.tmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<tmkSolution len="1" cn="密钥方案(TMK)" required="false">
可选项。TMK 下加密密钥的方案
</tmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。LMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>AH</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="TMK、TPK 或 PVK 奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<tmkTakHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</tmkTakHead>
<tmkTak :len="lmkLen()" cn="ZPK(ZMK)" >
转换后的 TAK;TMK 下加密。
</tmkTak>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 TAK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。当 TMK 的密钥方案为 S 时,默认或 KCV
类型为 0 时,输出 32H 的 KCV
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function lmkLen() {
return Util.lenChoice($final.getSection('data').getSection('tmkTakHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('tmkTakHead').getValue() )
} </script>
</packet>
+95
View File
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>B0</hex>
</command>
<data extend="data">
<keyType len="3" cn="密钥类型">
密钥类型
</keyType>
<key cn="密钥(LMK)">
LMK 加密下的密钥。
</key>
<keySolution len="1" cn="密钥方案(LMK)" >
密钥长度/LMK 下加密密钥的方案
</keySolution>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>B1</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
</options>
</error>
<lmkHead len="1" cn="lmk 头">
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</lmkHead>
<lmk :len="Len()" cn="密钥(LMK)">
LMK 加密下的密钥。
</lmk>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function Len() {
return Util.lenChoice($final.getSection('data').getSection('lmkHead').getValue() )
} </script>
</packet>
+94
View File
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
加密一个文本PIN的明文。注意:HSM必须处于授权状态。
<command>
<hex>BA</hex>
</command>
<data extend="data">
<alg len="1" cn="算法标识">
<options>
<option cn="3DES">
<hex>0</hex>
</option>
<option cn="SM4">
<hex>1</hex>
</option>
</options>
</alg>
<pin cn="PIN">
左对齐的形式的文本PIN,后面附加字符“X’F”直至已加密PIN的长度。其值在安全配置“CS”命令中设置(范围为5至13)。例如:PIN:123456,此字段应该为06123456FFFFFFFF(8字节分组算法)
</pin>
<account cn="账号">
账号中去除校验位的最右12位。
</account>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>BB</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
</options>
</error>
<pinBlock :len="dcaLen()" format="X" cn="PIN 块" >
LMK 对(02-03)下加密的 PIN
</pinBlock>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function dcaLen() {
if(1 == $packet.get('data').get('alg$option')){
return 32
}else {
return 16
}
}
</script>
</packet>
+135
View File
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>BY</hex>
</command>
<data extend="data">
<!--<portionNum len="1" cn="成份数" >
成份数在 2 到 9 之间(包含 2 和 9)
</portionNum>
-->
<zmki cn="ZMKi" >
LMK 对(04-05)下加密的 ZMKi。
</zmki>
<zmk cn="ZMK" >
ZMKi 下加密的 ZMK
</zmk>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" >
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" >
可选项。LMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>BZ</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="密钥奇偶校验错,仅仅是报告错误,并不影响结果">
<hex>01</hex>
</option>
<option cn="第一个成份奇偶校验错">
<hex>10</hex>
</option>
<option cn="第二或第三个成份奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
</options>
</error>
<zmkHead len="1" cn="zmk 头">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zmkHead>
<zmk :len="zmkLen()" cn="ZPK(ZMK)">
ZMK 加密下的ZPK。
</zmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
密钥校验值。是 16H 还是 6H 取决于 KCV 的类型选项。
当输出的 ZMK 密钥方案为 S 时,KCV 选项为 0 是,输
入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function zmkLen() {
return Util.lenChoice($final.getSection('data').getSection('zmkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('zmkHead').getValue() )
} </script>
</packet>
+182
View File
@@ -0,0 +1,182 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>CA</hex>
</command>
<data extend="data">
<sourceZpk cn="源 ZPK" >
当前加密 PIN 块的 ZPK;LMK 对(06-07)下加密。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</sourceZpk>
<purposeZpk cn="目的 ZPK" >
将要加密 PIN 块的 ZPK;LMK 对(06-07)下加密。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</purposeZpk>
<algorithmKey len="1" cn="算法标识" required="false">
取值 P(可选)
</algorithmKey>
<sca len="1" cn="源算法 SCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES(默认)">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</sca>
<dca len="1" cn="目的算法 DCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES(默认)">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</dca>
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<maxLength len="2" cn="最大 PIN 长度">
值为“12”。强制
<hex>12</hex>
</maxLength>
<sourcePinBlock len="16" cn="源 PIN 块" >
源 ZPK 下加密的源 PIN 块
</sourcePinBlock>
<sourcePinBlockFormat len="2" cn="源 PIN 块格式" >
源 PIN 块的格式代码。
01:带主帐号的 ANSI9.8 格式
02: Docutel ATM;
03: Diebold and IBM ATM,;
04: Plus Network;
05: ISO9564-1-1 格式,1NP..PR...R
06:不带主帐号的 ANSI9.8 格式
</sourcePinBlockFormat>
<purposePinBlockFormat len="2" cn="目的 PIN 块格式" >
目的 PIN 块的格式代码。
01:带主帐号的 ANSI9.8 格式
02: Docutel ATM;
03: Diebold and IBM ATM,;
04: Plus Network;
05: ISO9564-1-1 格式,1NP..PR...R
06:不带主帐号的 ANSI9.8 格式
</purposePinBlockFormat>
<account len="12" cn="账号" >
账号中去除校验位的最右 12 位
</account>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>CB</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="源 ZPK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="目的 ZPK 奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="PIN块错误">
<hex>20</hex>
</option>
<option cn="无效的用户存储索引">
<hex>21</hex>
</option>
<option cn="帐号无效">
<hex>22</hex>
</option>
<option cn="无效 PIN 块格式代码">
<hex>23</hex>
</option>
<option cn="PIN 小于 4 位或大于 12 位。">
<hex>24</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<pinLen len="2" cn="PIN 块" >
所返回 PIN 的长度
</pinLen>
<purposePinBlock :len="pinLen()" cn="目的 PIN 块" >
目的 ZPK 下加密的目的 PIN 块
</purposePinBlock>
<purposePinBlockFormat len="2" cn="目的 PIN 块格式" >
格式代码与收到的命令消息中的值相同。
</purposePinBlockFormat>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function pinLen() {
if(1 == $packet.get('data').get('dca$option')){
return 32
}else {
return 16
}
} </script>
</packet>
+213
View File
@@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>CB</hex>
</command>
<data extend="data">
<srcKeyType len="3" cn="源秘钥类型">
查看密钥类型表
</srcKeyType>
<desKeyType len="3" cn="目的秘钥类型">
查看密钥类型表
</desKeyType>
<srcKey cn="源秘钥">
当前加密PIN块的密钥;LMK加密的密文。
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</srcKey>
<desKey cn="目的秘钥">
将要加密PIN块的密钥;LMK加密的密文。
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</desKey>
<algorithmKey len="1" cn="算法标识" required="false">
取值P(可选,没有此选项,默认为算法为3DES)
</algorithmKey>
<sca len="1" cn="源算法SCA" :if="null != $packet.data.algorithmKey" required="false">
<options>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</sca>
<dca len="1" cn="目的算法DCA" :if="null != $packet.data.algorithmKey" required="false">
<options>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</dca>
<sPin :len="scaLen()" cn="源PIN块">
源密钥加密的源PIN块,源算法3DES时16H,源算法SM4时32H。
</sPin>
<sPinType len="2" cn="源PIN块格式">
<options>
<option cn="带主帐号的ANSI9.8格式">
<hex>01</hex>
</option>
<option cn="Docutel ATM">
<hex>02</hex>
</option>
<option cn="Diebold and IBM ATM">
<hex>03</hex>
</option>
<option cn="Plus Network">
<hex>04</hex>
</option>
<option cn="ISO9564-1-1格式,1NP..PR...R">
<hex>05</hex>
</option>
<option cn="不带主帐号的ANSI9.8格式">
<hex>06</hex>
</option>
</options>
</sPinType>
<dPinType len="2" cn="目的PIN块格式">
<options>
<option cn="带主帐号的ANSI9.8格式">
<hex>01</hex>
</option>
<option cn="Docutel ATM">
<hex>02</hex>
</option>
<option cn="Diebold and IBM ATM">
<hex>03</hex>
</option>
<option cn="Plus Network">
<hex>04</hex>
</option>
<option cn="ISO95641-format 1格式,1NP..PR...R">
<hex>05</hex>
</option>
<option cn="不带主帐号的ANSI9.8格式">
<hex>06</hex>
</option>
</options>
</dPinType>
<primaryAccount len="12" cn="主账号">
账号中去除校验位的最右12位。
</primaryAccount>
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>CC</hex>
</command>
<data>
<error len="2" cn="错误代码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="源ZPK奇偶校验错">
<hex>10</hex>
</option>
<option cn="目的ZPK奇偶校验错">
<hex>11</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>22</hex>
</option>
<option cn="无效PIN块格式代码">
<hex>23</hex>
</option>
<option cn="PIN小于4位或大于12位">
<hex>24</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<pinLen len="2" cn="PIN长度">
所返回PIN的长度。
</pinLen>
<dPin :len="dcaLen()" cn="目的PIN块">
目的秘钥下加密的目的PIN块。
</dPin>
<dPinType len="2" cn="目的PIN块格式">
格式代码与收到的命令消息中的值相同。
</dPinType>
<tailSep len="1" required="false" cn="终止信息分隔符">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="消息尾">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function scaLen() {
if(1 == $packet.get('data').get('sca$option')){
return 32
}else {
return 16
}
}
function dcaLen() {
if(1 == $packet.get('data').get('dca$option')){
return 32
}else {
return 16
}
}
</script>
</packet>
+188
View File
@@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>CC</hex>
</command>
<data extend="data">
<sourceZpk cn="源 ZPK" >
当前加密 PIN 块的 ZPK;LMK 对(06-07)下加密。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</sourceZpk>
<purposeZpk cn="目的 ZPK" >
将要加密 PIN 块的 ZPK;LMK 对(06-07)下加密。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</purposeZpk>
<algorithmKey len="1" cn="算法标识" required="false">
取值 P(可选)
</algorithmKey>
<sca len="1" cn="源算法 SCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES(默认)">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</sca>
<dca len="1" cn="目的算法 DCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES(默认)">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</dca>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<maxLength len="2" cn="最大 PIN 长度">
值为“12”。强制
<hex>12</hex>
</maxLength>
<sourcePinBlock :len="scaLen()" cn="源 PIN 块" >
源 ZPK 下加密的源 PIN 块
</sourcePinBlock>
<sourcePinBlockFormat len="2" cn="源 PIN 块格式" >
源 PIN 块的格式代码。
01:带主帐号的 ANSI9.8 格式
02: Docutel ATM;
03: Diebold and IBM ATM,;
04: Plus Network;
05: ISO9564-1-1 格式,1NP..PR...R
06:不带主帐号的 ANSI9.8 格式
</sourcePinBlockFormat>
<purposePinBlockFormat len="2" cn="目的 PIN 块格式" >
目的 PIN 块的格式代码。
01:带主帐号的 ANSI9.8 格式
02: Docutel ATM;
03: Diebold and IBM ATM,;
04: Plus Network;
05: ISO9564-1-1 格式,1NP..PR...R
06:不带主帐号的 ANSI9.8 格式
</purposePinBlockFormat>
<account len="12" cn="账号" >
账号中去除校验位的最右 12 位
</account>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>CD</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="源 ZPK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="目的 ZPK 奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效的用户存储索引">
<hex>21</hex>
</option>
<option cn="帐号无效">
<hex>22</hex>
</option>
<option cn="无效 PIN 块格式代码">
<hex>23</hex>
</option>
<option cn="PIN 小于 4 位或大于 12 位。">
<hex>24</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<pinLen len="2" cn="PIN 块" >
所返回 PIN 的长度
</pinLen>
<purposePinBlock :len="dcaLen()" cn="目的 PIN 块" >
目的 ZPK 下加密的目的 PIN 块
</purposePinBlock>
<purposePinBlockFormat len="2" cn="目的 PIN 块格式" >
格式代码与收到的命令消息中的值相同。
</purposePinBlockFormat>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function scaLen() {
if(1 == $packet.get('data').get('sca$option')){
return 32
}else {
return 16
}
}
function dcaLen() {
if(1 == $packet.get('data').get('dca$option')){
return 32
}else {
return 16
}
}
</script>
</packet>
+103
View File
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>DE</hex>
</command>
<data extend="data">
<pvk cn="PVK">
LMK对(14-15)下加密的PVK;用于生成offset。
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</pvk>
<pin len="16" cn="需要offset的PIN">
需要offset的PIN;LMK对(02-03)下加密。
</pin>
<pinLen cn="PIN 长度">
</pinLen>
<account cn="账号">
账号中去除校验位的最右12位。
</account>
<turn len="16" cn="十进制转换表">
将十六进制转换为十进制的转换表。
</turn>
<pinCheck len="12" cn="PIN校验数据">
用户定义的、包含十六进制字符和字符“N”的数据,用来指示HSM插入账号最后5位的位置。
</pinCheck>
</data>
</req>
<res>
<command>
<hex>DF</hex>
</command>
<data>
<error len="2" cn="错误代码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="源ZPK奇偶校验错">
<hex>10</hex>
</option>
<option cn="目的ZPK奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK错误;报告给管理员">
<hex>13</hex>
</option>
<option cn="加密的 PIN 错误">
<hex>14</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效的用户存储索引">
<hex>21</hex>
</option>
<option cn="帐号无效">
<hex>22</hex>
</option>
<option cn="无效PIN块格式代码">
<hex>23</hex>
</option>
<option cn="PIN小于4位或大于12位">
<hex>24</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<offset len="12" cn="Offset">
所返回PIN的长度。
</offset>
<tailSep len="1" required="false" cn="终止信息分隔符">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="消息尾">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
</script>
</packet>
+401
View File
@@ -0,0 +1,401 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>E0</hex>
</command>
<data extend="data" >
<packSn len="1" cn="消息块号">
<options>
<option cn="仅一块">
<hex>0</hex>
</option>
<option cn="第一块">
<hex>1</hex>
</option>
<option cn="中间块">
<hex>2</hex>
</option>
<option cn="最后块">
<hex>3</hex>
</option>
</options>
</packSn>
<alg len="1" cn="密钥模式">
<options>
<option cn="DES加密">
<hex>0</hex>
</option>
<option cn="DES解密">
<hex>1</hex>
</option>
<option cn="AES加密">
<hex>2</hex>
</option>
<option cn="AES解密">
<hex>3</hex>
</option>
<option cn="SSF33 加密">
<hex>4</hex>
</option>
<option cn="SSF33 解密">
<hex>5</hex>
</option>
<option cn="SM1加密">
<hex>6</hex>
</option>
<option cn="SM1解密">
<hex>7</hex>
</option>
<option cn="SM4加密">
<hex>8</hex>
</option>
<option cn="SM4解密">
<hex>9</hex>
</option>
<option cn="IDEA 加密">
<hex>A</hex>
</option>
<option cn="IDEA 解密">
<hex>B</hex>
</option>
<option cn="AES256 加密">
<hex>C</hex>
</option>
<option cn="AES256 解密">
<hex>D</hex>
</option>
</options>
</alg>
<roundModel len="1" cn="轮模式">
<options>
<option cn="ECB">
<hex>1</hex>
</option>
<option cn="CBC">
<hex>2</hex>
</option>
<option cn="CFB">
<hex>3</hex>
</option>
<option cn="OFB">
<hex>4</hex>
</option>
</options>
</roundModel>
<keyType len="1" cn="密钥类型">
<options>
<option cn="ZEK">
<hex>0</hex>
</option>
<option cn="TEK">
<hex>1</hex>
</option>
</options>
</keyType>
<key cn="密钥">
LMK30-31 对下保护的 ZEK
LMK32-33 对下保护的 TEK
</key>
<inType len="1" cn="输入消息类型">
<options>
<option cn="二进制">
<hex>0</hex>
</option>
<option cn="扩展十六进制">
<hex>1</hex>
</option>
</options>
</inType>
<outType len="1" cn="输出消息类型">
<options>
<option cn="二进制">
<hex>0</hex>
</option>
<option cn="扩展十六进制">
<hex>1</hex>
</option>
</options>
</outType>
<fullMode len="1" :if="0 == $packet.data.packSn$option || 3 == $packet.data.packSn$option" cn="填充模式">
仅当消息块号为 0,3 时有此域
<options>
<option cn="饥饿模式">
如果数据块长度为 8/16 的整数倍,不需要填
充;如果长度不为 8/16 的整数倍,填充至长度满
8/16 的整数倍(填充方式按 Pad character 域中
描述的规则进行,由加密机内部自动完成)
<hex>0</hex>
</option>
<option cn="贪婪模式">
如果数据块长度为 8/16 的整数倍,填充一个
整 8/16 字节的数据(填充方式按 Pad character
域中描述的规则进行,由加密机内部自动完成);
如果长度不为8/16的整数倍,填充至长度满8/16
的整数倍(填充方式按 Pad character 域中描述
的规则进行,由加密机内部自动完成)
<hex>1</hex>
</option>
</options>
</fullMode>
<fullChar len="4" :if="0 == $packet.data.packSn$option || 3 == $packet.data.packSn$option" cn="填充字符">
仅当消息块号为 0,3 时有此域
Pad character 为4H (以 XXYY 表示来进行说
明),其中XX为第一个字节的填充字符,之后的其
他所有需要填充的字节都填充为 YY。
<options>
<option cn="0000">
<text>0000</text>
</option>
<option cn="8000">
<text>8000</text>
</option>
<option cn="7FFF">
<text>7FFF</text>
</option>
</options>
</fullChar>
<fullType len="1" :if="0 == $packet.data.packSn$option || 3 == $packet.data.packSn$option" cn="填充字符">
仅当消息块号为 0,3 时有此域
Pad character 为4H (以 XXYY 表示来进行说
明),其中XX为第一个字节的填充字符,之后的其
他所有需要填充的字节都填充为 YY。
<options>
<option cn="不计尾">
填充数据的最后一个字节不填充计数位。解
密后的数据包含填充数据,由应用摘取实际数据。
<hex>0</hex>
</option>
<option cn="计尾">
填充数据的最后一个字节填充计数位。计数
位取值在 X’01 to X’08/ X’10 之间。解密后
的数据由加密机根据 Pad count flag值在内部自
动去掉填充数据
<hex>1</hex>
</option>
<option cn="pkcs">
pkcs5 和 pkcs7 填充
<hex>2</hex>
</option>
</options>
</fullType>
<iv :len="ivLen()" cn="IV" :if="0 != $packet.data.roundModel$option">
初始值,仅当密钥加密模式为 2,3,4 时有此域。
当密钥模式为 0,1 时,该域为 16H
当密钥模式为 2,3,4,5,6,7 时,该域为 32H
</iv>
<msgLen len="3" format="X" :value="msgLen()" cn="消息数据长度">
将要作 MAC的消息长度(若消息类型为二进制,则为
随后域长度;若消息类型为扩展十六进制,则为随后
域长度的一半)。
</msgLen>
<msg :len="" cn="消息数据">
二进制或扩展十六进制形式的消息块。
</msg>
</data>
</req>
<res>
<command>
<hex>E1</hex>
</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="未定义的方案 ID">
<hex>05</hex>
</option>
<option cn="根密钥奇偶校验错">
<hex>10</hex>
</option>
<option cn="保护密钥奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="离散次数错">
<hex>34</hex>
</option>
<option cn="密钥类型错">
<hex>28</hex>
</option>
<option cn="保护密钥类型错">
<hex>50</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<outType len="1" cn="输出消息类型">
<options>
<option cn="二进制">
<hex>0</hex>
</option>
<option cn="扩展十六进制">
<hex>1</hex>
</option>
</options>
</outType>
<msgLen len="3" format="X" cn="消息数据长度">
将要作 MAC的消息长度(若消息类型为二进制,则为
随后域长度;若消息类型为扩展十六进制,则为随后
域长度的一半)。
</msgLen>
<msg :len="getMsgLen()" cn="消息数据">
二进制或扩展十六进制形式的消息块。
</msg>
<iv :len="ivLen()" cn="IV 数据域" required="false">
在 CBC, OFB, CFB, PCBC模式下,当数据块为“first
block 或 middle block”时,命令输出的 IV 域为下
一个数据块输入的IV域(IV数据格式固定为Expanded
Hex-16 字节)。当数据块为“only block 或 last
block”时,输出不包含 IV 数据域
</iv>
</data>
</res>
<script>function ivLen() {
if( 0 == $packet.data.alg$option || 1 == $packet.data.alg$option ){
return 16;
}else{
return 32;
}
}
function msgLen() {
int len = $packet.data.msg.length;
if ( 0 == $packet.data.inType$option ){
return len;
}else{
return 2 * len;
}
}
/**
* 触发重载指令
*
* 参数 v 表示 reload 所在字段的值
* 如果是动态值,一定是先求值
*
*
* 返回值表示本次渲染继续还是终止
* true 继续
* false 终止
*/
function reload() {
var packlen = 2048
if( null == $packet.data.packSn$option ){
// 第一次进来
// 计算重载包数
int v = msgLen();
int loop = v / packlen;
int tailLen = v % packlen;
if ( tailLen ){
loop++;
}else{
tailLen = packlen;
}
$packet.data.msgAll = $packet.data.msg
$packet.data.loop = loop;
$packet.data.loopIndex = 0;
$packet.data.tailLen = tailLen;
}
int loop = $packet.data.loop;
int i = $packet.data.loopIndex;
//println("包个数 " + $packet.data.loop)
//println("包序号 " + $packet.data.loopIndex)
if( 0 == i ){
if( 1 == loop ){
// 唯一包
$packet.data.packSn$option = 0;
$packet.data.msg = $packet.data.msgAll
println("唯一包")
return false;
}else {
// 首包
$packet.data.packSn$option = 1;
$packet.data.msg = new byte[packlen];
System.arraycopy($packet.data.msgAll, 0, $packet.data.msg,0, packlen);
//println("首包")
}
}else{
if( i == (loop -1) ){
// 尾包
$packet.data.packSn$option = 3;
$packet.data.msg = new byte[$packet.data.tailLen];
System.arraycopy($packet.data.msgAll, i * packlen, $packet.data.msg,0, $packet.data.tailLen);
//println("尾包")
return false;
}else {
// 中间包
$packet.data.packSn$option = 2;
$packet.data.msg = new byte[packlen];
System.arraycopy($packet.data.msgAll, i * packlen, $packet.data.msg,0, packlen);
//println("中间包")
}
}
$packet.data.loopIndex += 1;
return true;
}
function getMsgLen() {
int len = Util.a2i( $final.getSection('data').getSection('msgLen') )
if (
Arrays.equals(
"0".getBytes(),
$final.getSection('data').getSection('outType').getValue()
)
){
return len;
}else{
return 2 * len;
}
}
</script>
</packet>
+399
View File
@@ -0,0 +1,399 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>E1</hex>
</command>
<data extend="data" >
<packSn len="1" cn="消息块号">
<options>
<option cn="仅一块">
<hex>0</hex>
</option>
<option cn="第一块">
<hex>1</hex>
</option>
<option cn="中间块">
<hex>2</hex>
</option>
<option cn="最后块">
<hex>3</hex>
</option>
</options>
</packSn>
<alg len="1" cn="密钥模式">
<options>
<option cn="DES加密">
<hex>0</hex>
</option>
<option cn="DES解密">
<hex>1</hex>
</option>
<option cn="AES加密">
<hex>2</hex>
</option>
<option cn="AES解密">
<hex>3</hex>
</option>
<option cn="SSF33 加密">
<hex>4</hex>
</option>
<option cn="SSF33 解密">
<hex>5</hex>
</option>
<option cn="SM1加密">
<hex>6</hex>
</option>
<option cn="SM1解密">
<hex>7</hex>
</option>
<option cn="SM4加密">
<hex>8</hex>
</option>
<option cn="SM4解密">
<hex>9</hex>
</option>
<option cn="IDEA 加密">
<hex>A</hex>
</option>
<option cn="IDEA 解密">
<hex>B</hex>
</option>
<option cn="AES256 加密">
<hex>C</hex>
</option>
<option cn="AES256 解密">
<hex>D</hex>
</option>
</options>
</alg>
<roundModel len="1" cn="密钥加密模式">
<options>
<option cn="ECB">
<hex>1</hex>
</option>
<option cn="CBC">
<hex>2</hex>
</option>
<option cn="CFB">
<hex>3</hex>
</option>
<option cn="OFB">
<hex>4</hex>
</option>
</options>
</roundModel>
<keyType len="1" cn="密钥类型">
<options>
<option cn="ZEK">
<hex>0</hex>
</option>
<option cn="TEK">
<hex>1</hex>
</option>
</options>
</keyType>
<key :len="" cn="密钥">
LMK30-31 对下保护的 ZEK
LMK32-33 对下保护的 TEK
</key>
<inType len="1" cn="输入消息类型">
<options>
<option cn="二进制">
<hex>0</hex>
</option>
<option cn="扩展十六进制">
<hex>1</hex>
</option>
</options>
</inType>
<outType len="1" cn="输出消息类型">
<options>
<option cn="二进制">
<hex>0</hex>
</option>
<option cn="扩展十六进制">
<hex>1</hex>
</option>
</options>
</outType>
<fullMode len="1" :if="0 == $packet.data.packSn$option || 3 == $packet.data.packSn$option" cn="填充模式">
仅当消息块号为 0,3 时有此域
<options>
<option cn="饥饿模式">
如果数据块长度为 8/16 的整数倍,不需要填
充;如果长度不为 8/16 的整数倍,填充至长度满
8/16 的整数倍(填充方式按 Pad character 域中
描述的规则进行,由加密机内部自动完成)
<hex>0</hex>
</option>
<option cn="贪婪模式">
如果数据块长度为 8/16 的整数倍,填充一个
整 8/16 字节的数据(填充方式按 Pad character
域中描述的规则进行,由加密机内部自动完成);
如果长度不为8/16的整数倍,填充至长度满8/16
的整数倍(填充方式按 Pad character 域中描述
的规则进行,由加密机内部自动完成)
<hex>1</hex>
</option>
</options>
</fullMode>
<fullChar len="4" :if="0 == $packet.data.packSn$option || 3 == $packet.data.packSn$option" cn="填充字符">
仅当消息块号为 0,3 时有此域
Pad character 为4H (以 XXYY 表示来进行说
明),其中XX为第一个字节的填充字符,之后的其
他所有需要填充的字节都填充为 YY。
<options>
<option cn="0000">
<text>0000</text>
</option>
<option cn="8000">
<text>8000</text>
</option>
<option cn="7FFF">
<text>7FFF</text>
</option>
</options>
</fullChar>
<fullType len="1" :if="0 == $packet.data.packSn$option || 3 == $packet.data.packSn$option" cn="填充字符">
仅当消息块号为 0,3 时有此域
Pad character 为4H (以 XXYY 表示来进行说
明),其中XX为第一个字节的填充字符,之后的其
他所有需要填充的字节都填充为 YY。
<options>
<option cn="不计尾">
填充数据的最后一个字节不填充计数位。解
密后的数据包含填充数据,由应用摘取实际数据。
<hex>0</hex>
</option>
<option cn="计尾">
填充数据的最后一个字节填充计数位。计数
位取值在 X’01 to X’08/ X’10 之间。解密后
的数据由加密机根据 Pad count flag值在内部自
动去掉填充数据
<hex>1</hex>
</option>
<option cn="pkcs">
pkcs5 和 pkcs7 填充
<hex>2</hex>
</option>
</options>
</fullType>
<iv :len="ivLen()" cn="IV" :if="0 != $packet.data.roundModel$option">
初始值,仅当密钥加密模式为 2,3,4 时有此域。
当密钥模式为 0,1 时,该域为 16H
当密钥模式为 2,3,4,5,6,7 时,该域为 32H
</iv>
<msgLen len="4" format="A" :value="msgLen()" cn="消息数据长度">
将要作 MAC的消息长度(若消息类型为二进制,则为
随后域长度;若消息类型为扩展十六进制,则为随后
域长度的一半)。
</msgLen>
<msg :len="" cn="消息数据">
二进制或扩展十六进制形式的消息块。
</msg>
</data>
</req>
<res>
<command>
<hex>E2</hex>
</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="未定义的方案 ID">
<hex>05</hex>
</option>
<option cn="根密钥奇偶校验错">
<hex>10</hex>
</option>
<option cn="保护密钥奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="离散次数错">
<hex>34</hex>
</option>
<option cn="密钥类型错">
<hex>28</hex>
</option>
<option cn="保护密钥类型错">
<hex>50</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<outType len="1" cn="输出消息类型">
<options>
<option cn="二进制">
<hex>0</hex>
</option>
<option cn="扩展十六进制">
<hex>1</hex>
</option>
</options>
</outType>
<msgLen len="4" format="A" cn="消息数据长度">
将要作 MAC的消息长度(若消息类型为二进制,则为
随后域长度;若消息类型为扩展十六进制,则为随后
域长度的一半)。
</msgLen>
<msg :len="getMsgLen()" cn="消息数据">
二进制或扩展十六进制形式的消息块。
</msg>
<iv len="16" cn="IV 数据域" required="false">
在 CBC, OFB, CFB, PCBC模式下,当数据块为“first
block 或 middle block”时,命令输出的 IV 域为下
一个数据块输入的IV域(IV数据格式固定为Expanded
Hex-16 字节)。当数据块为“only block 或 last
block”时,输出不包含 IV 数据域
</iv>
</data>
</res>
<script>function ivLen() {
if( 0 == $packet.data.alg$option || 1 == $packet.data.alg$option ){
return 16;
}else{
return 32;
}
}
function msgLen() {
int len = $packet.data.msg.length;
if ( 0 == $packet.data.inType$option ){
return len;
}else{
return 2 * len;
}
}
/**
* 触发重载指令
*
* 参数 v 表示 reload 所在字段的值
* 如果是动态值,一定是先求值
*
*
* 返回值表示本次渲染继续还是终止
* true 继续
* false 终止
*/
function reload() {
var packlen = 8000
if( null == $packet.data.packSn$option ){
// 第一次进来
// 计算重载包数
int v = msgLen();
int loop = v / packlen;
int tailLen = v % packlen;
if ( tailLen ){
loop++;
}else{
tailLen = packlen;
}
$packet.data.msgAll = $packet.data.msg
$packet.data.loop = loop;
$packet.data.loopIndex = 0;
$packet.data.tailLen = tailLen;
}
int loop = $packet.data.loop;
int i = $packet.data.loopIndex;
//println("包个数 " + $packet.data.loop)
//println("包序号 " + $packet.data.loopIndex)
if( 0 == i ){
if( 1 == loop ){
// 唯一包
$packet.data.packSn$option = 0;
$packet.data.msg = $packet.data.msgAll
println("唯一包")
return false;
}else {
// 首包
$packet.data.packSn$option = 1;
$packet.data.msg = new byte[packlen];
System.arraycopy($packet.data.msgAll, 0, $packet.data.msg,0, packlen);
//println("首包")
}
}else{
if( i == (loop -1) ){
// 尾包
$packet.data.packSn$option = 3;
$packet.data.msg = new byte[$packet.data.tailLen];
System.arraycopy($packet.data.msgAll, i * packlen, $packet.data.msg,0, $packet.data.tailLen);
//println("尾包")
return false;
}else {
// 中间包
$packet.data.packSn$option = 2;
$packet.data.msg = new byte[packlen];
System.arraycopy($packet.data.msgAll, i * packlen, $packet.data.msg,0, packlen);
//println("中间包")
}
}
$packet.data.loopIndex += 1;
return true;
}
function getMsgLen() {
int len = Util.a2i( $final.getSection('data').getSection('msgLen') )
if (
Arrays.equals(
"0".getBytes(),
$final.getSection('data').getSection('outType').getValue()
)
){
return len;
}else{
return 2 * len;
}
} </script>
</packet>
+119
View File
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>E2</hex>
</command>
<data extend="data">
<algorithmId len="1" cn="算法标识">
<options>
<option cn="RSA">
<hex>0</hex>
</option>
<option cn="SM2">
<hex>1</hex>
</option>
</options>
</algorithmId>
<keyLength len="4" cn="密钥长度">
RSA 算法,算法长度 0320-2048
SM2 算法,算法长度固定为 0256
</keyLength>
<flag len="1" cn="是否存储标志" required="false">
可选,存在,则固定值为‘P’
</flag>
<index len="27" cn="索引" :if="null != $packet.data.flag">
存储标志存在时存在,27位数字,以此索引存储生成的密钥
</index>
<startTime len="8" cn="生效时间" :if="null != $packet.data.flag">
存储标志存在时存在,密钥生效时间
</startTime>
<endTime len="8" cn="失效时间" :if="null != $packet.data.flag">
存储标志存在时存在,密钥失效时间
</endTime>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>E3</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的哈希标识">
<hex>05</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="DSP 错误">
DSP 错误;报告给管理员。
<hex>47</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<privateKeyLength len="4" cn="私钥长度">
私钥的密文长度
</privateKeyLength>
<privateKey :len="getPriKeyLen()" cn="私钥">
LMK 加密下的私钥(LMK34-35)
</privateKey>
<publicKeyLength len="4" cn="公钥长度">
公钥长度(DER)
</publicKeyLength>
<publicKey :len="getPubKeyLen()" cn="公钥">
公钥的 DER 编码
</publicKey>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function getPubKeyLen() {
return Util.a2i( $final.getSection('data').getSection('publicKeyLength') )
}
function getPriKeyLen() {
return Util.a2i( $final.getSection('data').getSection('privateKeyLength') )
}
</script>
</packet>
+107
View File
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>E4</hex>
</command>
<data extend="data">
<nid len="4" cn="曲线nid">
ECC的NID
415:prime256v1
715:secp384r1
</nid>
<flg len="1" required="false" cn="是否存储标志">
可选,存在,则固定值为‘P’
</flg>
<index len="4" cn="索引" :if=" null != $packet.data.flg">
存储标志存在时存在,4位数字,以此索引存储生成的密钥。0001-9998
</index>
<startTime len="8" cn="生效时间" :if=" null != $packet.data.flg">
存储标志存在时存在,密钥生效时间
</startTime>
<endTime len="8" cn="失效时间" :if=" null != $packet.data.flg">
存储标志存在时存在,密钥失效时间
</endTime>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>E5</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效的哈希标识">
<hex>05</hex>
</option>
<option cn="生成密钥错误">
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="DSP 错误">
DSP 错误;报告给管理员。
<hex>47</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<privateKeyLength len="4" cn="私钥长度">
私钥的密文长度
</privateKeyLength>
<privateKey :len="getPriKeyLen()" cn="私钥">
LMK 加密下的私钥(LMK34-35)
</privateKey>
<publicKeyLength len="4" cn="公钥长度">
公钥长度(DER)
</publicKeyLength>
<publicKey :len="getPubKeyLen()" cn="公钥">
公钥的 DER 编码
</publicKey>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function getPubKeyLen() {
return Util.a2i( $final.getSection('data').getSection('publicKeyLength') )
}
function getPriKeyLen() {
return Util.a2i( $final.getSection('data').getSection('privateKeyLength') )
}
</script>
</packet>
+142
View File
@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>FA</hex>
</command>
<data extend="data">
<zmk cn="ZMK" >
LMK 对(04-05)加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<zpk cn="ZPK" >
ZMK 下加密的 ZPK
</zpk>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>FB</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="密钥奇偶校验错,仅仅是报告错误,并不影响结果">
<hex>01</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="全 0 的 ZPK 为偶校验(终止运行)">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<zpkHead len="1" cn="zpk 头">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zpkHead>
<zpk :len="zpkLen()" cn="ZPK(ZMK)">
转换后的 ZPK;由 LMK06-07 对加密
</zpk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 ZPK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。
当输出的 ZMK 加密的 ZPK 密钥方案为 S 时,KCV 选项
为 0 是,输入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function zpkLen() {
return Util.lenChoice($final.getSection('data').getSection('zpkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('zpkHead').getValue() )
} </script>
</packet>
+134
View File
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>FC</hex>
</command>
<data extend="data">
<zmk cn="ZMK" >
LMK 对(04-05)下加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<tmk cn="TMK" >
ZMK 下加密的 TMK、 TPK 或 PVK。
</tmk>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。LMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>FD</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="TMK、 TPK 或 PVK 奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
</options>
</error>
<tmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</tmkHead>
<tmkKey :len="tmkLen()" cn="ZPK(ZMK)" >
转换后的 TMK、 TPK 或 PVK; LMK 对(14-15)下
加密
</tmkKey>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 ZPK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。
当输出的 ZMK 加密的 ZPK 密钥方案为 S 时,KCV 选项
为 0 是,输入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function tmkLen() {
return Util.lenChoice($final.getSection('data').getSection('tmkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('tmkHead').getValue() )
} </script>
</packet>
+138
View File
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>FE</hex>
</command>
<data extend="data">
<zmk cn="ZMK" >
LMK 对(04-05)下加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<tmk cn="TMK" >
LMK 对(14-15)下加密的 TMK、TPK 或 PVK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</tmk>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。LMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>FF</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="TMK、 TPK 或 PVK 奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<tmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</tmkHead>
<tmkKey :len="tmkLen()" cn="ZPK(ZMK)" >
转换后的 TMK、TPK 或 PVK;ZMK 下加密。
</tmkKey>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 ZPK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。
当输出的 ZMK 加密的 ZPK 密钥方案为 S 时,KCV 选项
为 0 是,输入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function tmkLen() {
return Util.lenChoice($final.getSection('data').getSection('tmkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('tmkHead').getValue() )
} </script>
</packet>
+201
View File
@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>FI</hex>
</command>
<data extend="data">
<key len="1" cn="标识">
<options>
<option cn="ZEK">
<hex>0</hex>
</option>
<option cn="ZAK">
<hex>1</hex>
</option>
</options>
</key>
<zmk cn="ZMK" >
LMK 对(04-05)加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>FJ</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="第一个成份奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<zekZmkHead len="1" cn="zpk 头" :if="zekChoice()">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zekZmkHead>
<zekZmk :len="zmkLen()" cn="ZPK(ZMK)" :if="zekChoice()">
转换后的 ZPK;由 LMK06-07 对加密
</zekZmk>
<zekLmkHead len="1" cn="zpk 头" :if="zekChoice()">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zekLmkHead>
<zekLmk :len="lmkLen()" cn="ZPK(ZMK)" :if="zekChoice()">
转换后的 ZPK;由 LMK06-07 对加密
</zekLmk>
<zakZmkHead len="1" cn="zpk 头" :if="zakChoice()">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zakZmkHead>
<zakZmk :len="zmkLen()" cn="ZPK(ZMK)" :if="zakChoice()">
转换后的 ZPK;由 LMK06-07 对加密
</zakZmk>
<zakLmkHead len="1" cn="zpk 头" :if="zakChoice()">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zakLmkHead>
<zakLmk :len="lmkLen()" cn="ZPK(ZMK)" :if="zakChoice()">
转换后的 ZPK;由 LMK06-07 对加密
</zakLmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 ZPK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。
当输出的 ZMK 加密的 ZPK 密钥方案为 S 时,KCV 选项
为 0 是,输入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function lmkLen() {
if(zakChoice()){
return Util.lenChoice($final.getSection('data').getSection('zakLmkHead').getValue() )
}else {
return Util.lenChoice($final.getSection('data').getSection('zekLmkHead').getValue() )
}
}
function zmkLen() {
if(zakChoice()){
return Util.lenChoice($final.getSection('data').getSection('zakZmkHead').getValue() )
}else {
return Util.lenChoice($final.getSection('data').getSection('zekZmkHead').getValue() )
}
}
function zakChoice() {
if(1 == $packet.get('data').get('key$option')){
return true
}else {
return false
}
}
function zekChoice() {
if(0 == $packet.get('data').get('key$option')){
return true
}else {
return false
}
}
function keyCheckLen() {
if(1 == $packet.get('data').get('key$option')){
return Util.keyCheckLen($final.getSection('data').getSection('zakZmkHead').getValue() )
}else {
return Util.keyCheckLen($final.getSection('data').getSection('zekZmkHead').getValue() )
}
} </script>
</packet>
+179
View File
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>FK</hex>
</command>
<data extend="data">
<key len="1" cn="标识">
<options>
<option cn="ZEK">
<hex>0</hex>
</option>
<option cn="ZAK">
<hex>1</hex>
</option>
</options>
</key>
<zmk cn="ZMK" >
LMK 对(04-05)加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<zekOrzak cn="ZEK 或 ZAK" >
ZMK 下加密的 ZEK 或 ZAK
</zekOrzak>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>FL</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="第一个成份奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<zekLmkHead len="1" cn="zpk 头" :if="zekChoice()">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zekLmkHead>
<zekLmk :len="zekLmkLen()" cn="ZPK(LMK)" :if="zekChoice()">
LMK30-31对下加密的ZEK。(仅当标志位为0时才有该域)
</zekLmk>
<zakLmkHead len="1" cn="zpk 头" :if="zakChoice()">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zakLmkHead>
<zakLmk :len="zakLmkLen()" cn="ZPK(LMK)" :if="zakChoice()">
LMK26-27对下加密的ZAK。(仅当标志位为1时才有该域)
</zakLmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用ZEK或ZAK加密64位0的结果。是16H还是6H取决于KCV的类型选项。
当输入可选项的LMK密钥方案为S时,KCV选项为0是,输入出32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function zekLmkLen() {
return Util.lenChoice($final.getSection('data').getSection('zekLmkHead').getValue() )
}
function zakLmkLen() {
return Util.lenChoice($final.getSection('data').getSection('zakLmkHead').getValue() )
}
function zakChoice() {
if(1 == $packet.get('data').get('key$option')){
return true
}else {
return false
}
}
function zekChoice() {
if(0 == $packet.get('data').get('key$option')){
return true
}else {
return false
}
}
function keyCheckLen() {
if(1 == $packet.get('data').get('key$option')){
return Util.keyCheckLen($final.getSection('data').getSection('zakLmkHead').getValue() )
}else {
return Util.keyCheckLen($final.getSection('data').getSection('zekLmkHead').getValue() )
}
} </script>
</packet>
+184
View File
@@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>FM</hex>
</command>
<data extend="data">
<key len="1" cn="标识">
<options>
<option cn="ZEK">
<hex>0</hex>
</option>
<option cn="ZAK">
<hex>1</hex>
</option>
</options>
</key>
<zmk cn="ZMK" >
LMK 对(04-05)加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<zekOrzak cn="ZEK 或 ZAK" >
LMK 下加密的 ZEK 或 ZAK。
ZEK=LMK30-31,ZAK=LMK26-27
(标志位为 0 时为 ZEK,1 为 ZAK)
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zekOrzak>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" >
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" >
可选项。ZMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>FN</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="第一个成份奇偶校验错">
<hex>10</hex>
</option>
<option cn="第二或第三个成份奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<zekZmkHead len="1" cn="zpk 头" :if="zekChoice()">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zekZmkHead>
<zekZmk :len="zekZmkLen()" cn="ZPK(ZMK)" :if="zekChoice()">
转换后的 ZPK;由 LMK06-07 对加密
</zekZmk>
<zakZmkHead len="1" cn="zpk 头" :if="zakChoice()">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zakZmkHead>
<zakZmk :len="zakZmkLen()" cn="ZPK(ZMK)" :if="zakChoice()">
转换后的 ZPK;由 LMK06-07 对加密
</zakZmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 ZPK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。
当输出的 ZMK 加密的 ZPK 密钥方案为 S 时,KCV 选项
为 0 是,输入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function zekZmkLen() {
return Util.lenChoice($final.getSection('data').getSection('zekZmkHead').getValue() )
}
function zakZmkLen() {
return Util.lenChoice($final.getSection('data').getSection('zakZmkHead').getValue() )
}
function zakChoice() {
if(1 == $packet.get('data').get('key$option')){
return true
}else {
return false
}
}
function zekChoice() {
if(0 == $packet.get('data').get('key$option')){
return true
}else {
return false
}
}
function keyCheckLen() {
if(1 == $packet.get('data').get('key$option')){
return Util.keyCheckLen($final.getSection('data').getSection('zakZmkHead').getValue() )
}else {
return Util.keyCheckLen($final.getSection('data').getSection('zekZmkHead').getValue() )
}
} </script>
</packet>
+144
View File
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>GC</hex>
</command>
<data extend="data">
<zmk cn="ZMK" >
LMK 对(04-05)加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<zpk cn="ZPK" >
LMK 对(06-07)下加密的 ZPK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zpk>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>GD</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="密钥奇偶校验错,仅仅是报告错误,并不影响结果">
<hex>01</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="全 0 的 ZPK 为偶校验(终止运行)">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<zpkHead len="1" cn="zpk 头">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zpkHead>
<zpk :len="zpkLen()" cn="ZPK(ZMK)">
转换后的 ZPK;由 LMK06-07 对加密
</zpk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 ZPK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。
当输出的 ZMK 加密的 ZPK 密钥方案为 S 时,KCV 选项
为 0 是,输入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function zpkLen() {
return Util.lenChoice($final.getSection('data').getSection('zpkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('zpkHead').getValue() )
} </script>
</packet>
+140
View File
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>GY</hex>
</command>
<data extend="data">
<num len="1" cn="成分数量">
成分数量
</num>
<keys cn="所有成分">
所有成分
</keys>
<flag len="1" cn="业务标识">
业务标识
</flag>
<split len="1" cn="分隔符">
</split>
<zmk len="1" cn="zmk 方案">
</zmk>
<lmk len="1" cn="lmk 方案">
</lmk>
<kcvType len="1" cn="密钥校验值类型">
</kcvType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>GZ</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="密钥奇偶校验错">
<hex>01</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="无效的密钥类型">
<hex>28</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyHead len="1" cn="lmk 头">
如果是 'Z' ,lmk 16 个字节长
如果是 'X,U,S' ,lmk 32 个字节长
如果是 'Y,T' ,lmk 48 个字节长
</keyHead>
<key :len="Len()" cn="密钥(LMK)">
LMK 加密下的密钥。
</key>
<kcv :len="KCVLen()" cn="密钥校验值">
用ZMK加密64位0的结果。是16H还是6H取决于KCV的类型选项。
当输出的ZMK密钥方案为S时,KCV选项为0是,输入出32H
</kcv>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function Len() {
if( $final.data.keyHead.eqStr("Y") || $final.data.keyHead.eqStr("T") ){
return 48
}else if( $final.data.keyHead.eqStr("X") || $final.data.keyHead.eqStr("U") ){
return 32
}
return 15
}
function KCVLen() {
if( $final.data.keyHead.eqStr("S") ){
return 32
}
return 16
}
</script>
</packet>
+144
View File
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>HA</hex>
</command>
<data extend="data">
<tmk cn="TMK" >
LMK 对(14-15)下加密的 TMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</tmk>
<businessKey len="1" cn="业务标识" required="false">
<text>N</text>
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if="null != $packet.data.tmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<tmkSolution len="1" cn="密钥方案(TMK)" required="false">
可选项。TMK 下加密密钥的方案。
</tmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false" >
可选项。LMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>HB</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="第一个成份奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<takTmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</takTmkHead>
<takTmk :len="tmkLen()" cn="ZPK(ZMK)" >
TMK 下加密的随机的 TAK
</takTmk>
<takLmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</takLmkHead>
<takLmk :len="lmkLen()" cn="ZPK(ZMK)" >
LMK 对 16-17 下加密的密钥
</takLmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 TAK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。 当 TMK 的密钥方案为 S 时,默认或 KCV
类型为 0 时,输出 32H 的 KCV
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function tmkLen() {
return Util.lenChoice($final.getSection('data').getSection('takTmkHead').getValue() )
}
function lmkLen() {
return Util.lenChoice($final.getSection('data').getSection('takLmkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('takTmkHead').getValue() )
} </script>
</packet>
+144
View File
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>HC</hex>
</command>
<data extend="data">
<tmk cn="TMK" >
LMK 对(14-15)下加密的 TMK、TPK 或 PVK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</tmk>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.tmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<tmkSolution len="1" cn="密钥方案(TMK)" required="false">
可选项。TMK 下加密密钥的方案。
</tmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>HD</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="第一个成份奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<tmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</tmkHead>
<tmkKey :len="tmkLen()" cn="ZPK(TMK)" >
当前的TMK (TPK或PVK)下加密的新密钥。
</tmkKey>
<lmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</lmkHead>
<lmkKey :len="lmkLen()" cn="ZPK(LMK)" >
LMK下加密的新密钥。
</lmkKey>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 ZPK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。
当输出的 ZMK 加密的 ZPK 密钥方案为 S 时,KCV 选项
为 0 是,输入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function tmkLen() {
return Util.lenChoice($final.getSection('data').getSection('tmkHead').getValue() )
}
function lmkLen() {
return Util.lenChoice($final.getSection('data').getSection('lmkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('tmkHead').getValue() )
} </script>
</packet>
+69
View File
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>HI</hex>
</command>
<data extend="data">
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>HJ</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="系统调用错误">
<hex>73</hex>
</option>
</options>
</error>
<cpu len="8" cn="cpu 使用率" >
百分比状态
</cpu>
<mem len="8" cn="内存使用率" >
百分比状态
</mem>
<disk len="8" cn="磁盘使用率" >
单位 MB
</disk>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script> </script>
</packet>
+75
View File
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>HV</hex>
</command>
<data extend="data">
<num len="4" cn="授权响应码">
授权响应码
</num>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>HW</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="系统调用错误">
<hex>73</hex>
</option>
</options>
</error>
<name len="40" cn="设备生产厂商名称" >
设备生产厂商名称
</name>
<model len="16" cn="设备型号" >
设备型号
</model>
<equipNo len="16" cn="设备机具号" >
设备型号
</equipNo>
<softVersion len="10" cn="设备内部软件版本号" >
设备内部软件版本号
</softVersion>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script> </script>
</packet>
+142
View File
@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>IA</hex>
</command>
<data extend="data">
<zmk cn="ZMK" >
LMK 对(04-05)加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>IB</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<zpkZmkHead len="1" cn="zmk 头">
如果是 'Z' ,zmk 16 个字节长
如果是 'X,U,S' ,zmk 32 个字节长
如果是 'Y,T' ,zmk 48 个字节长
</zpkZmkHead>
<zpkZmk :len="zmkLen()" cn="ZPK(ZMK)">
ZMK 加密下的ZPK。
</zpkZmk>
<zpkLmkHead len="1" cn="lmk 头">
如果是 'Z' ,lmk 16 个字节长
如果是 'X,U,S' ,lmk 32 个字节长
如果是 'Y,T' ,lmk 48 个字节长
</zpkLmkHead>
<zpkLmk :len="lmkLen()" cn="ZPK(LMK)">
LMK 加密下的ZPK。
</zpkLmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 ZPK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。
当输出的 ZMK 加密的 ZPK 密钥方案为 S 时,KCV 选项
为 0 是,输入出 32H
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function lmkLen() {
return Util.lenChoice($final.getSection('data').getSection('zpkLmkHead').getValue() )
}
function zmkLen() {
return Util.lenChoice($final.getSection('data').getSection('zpkZmkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('zpkZmkHead').getValue() )
} </script>
</packet>
+102
View File
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>JA</hex>
</command>
<data extend="data">
<account len="12" cn="账号" >
账号中去除校验位的最右 12 位
</account>
<pinLen len="2" cn="PIN 长度" required="false">
可选项。范围为 04 到 12。如果没有该域,则生成一
个 4 位的 PIN。
</pinLen>
<algorithmKey len="1" cn="算法标识" required="false">
取值 P(可选)
</algorithmKey>
<encryptionAlg cn="加密算法" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES(默认)">
<hex>0</hex>
</option>
<option cn="SM4">
<hex>1</hex>
</option>
</options>
</encryptionAlg>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>JB</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="PIN 长度等于或大于被加密的 PIN 长度。">
<hex>24</hex>
</option>
</options>
</error>
<pinBlock :len="pingLen()" cn="PIN 块" >
LMK 对(02-03)下加密的导出 PINBLOCK。(PINBLOCK
格式默认为 01 格式)
</pinBlock>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function pingLen() {
if(1 == $packet.data.encryptionAlg$option){
return 32
}else {
return 16
}
}
</script>
</packet>
+161
View File
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>JC</hex>
</command>
<data extend="data">
<zpk cn="ZPK" >
当前加密 PIN 块的 ZPK;LMK 对(06-07)下加密。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zpk>
<algorithmKey len="1" cn="算法标识" required="false">
取值 P(可选)
</algorithmKey>
<sca len="1" cn="源算法 SCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</sca>
<dca len="1" cn="目的算法 DCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</dca>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<PinBlock :len="scaLen()" cn="PIN 块" >
源 ZPK 下加密的源 PIN 块
</PinBlock>
<pinBlockFormat len="2" cn="PIN 块格式" >
源 PIN 块的格式代码。
01:带主帐号的 ANSI9.8 格式
02: Docutel ATM;
03: Diebold and IBM ATM,;
04: Plus Network;
05: ISO9564-1-1 格式,1NP..PR...R
06:不带主帐号的 ANSI9.8 格式
</pinBlockFormat>
<account len="12" cn="账号" >
账号中去除校验位的最右 12 位
</account>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>JD</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="源TPK奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="PIN块错误">
<hex>20</hex>
</option>
<option cn="无效的用户存储索引">
<hex>21</hex>
</option>
<option cn="帐号无效">
<hex>22</hex>
</option>
<option cn="无效 PIN 块格式代码">
<hex>23</hex>
</option>
<option cn="PIN 小于 4 位或大于 12 位。">
<hex>24</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<pinBlock :len="dcaLen()" cn="PIN 块" >
LMK 对(02-03)下加密的 PIN
</pinBlock>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function scaLen() {
if(1 == $packet.get('data').get('sca$option')){
return 32
}else {
return 16
}
}
function dcaLen() {
if(1 == $packet.get('data').get('dca$option')){
return 32
}else {
return 16
}
} </script>
</packet>
+161
View File
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>JE</hex>
</command>
<data extend="data">
<zpk cn="ZPK" >
当前加密 PIN 块的 ZPK;LMK 对(06-07)下加密。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zpk>
<algorithmKey len="1" cn="算法标识" required="false">
取值 P(可选)
</algorithmKey>
<sca len="1" cn="源算法 SCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</sca>
<dca len="1" cn="目的算法 DCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</dca>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<PinBlock :len="scaLen()" cn="PIN 块" >
源 ZPK 下加密的源 PIN 块
</PinBlock>
<pinBlockFormat len="2" cn="PIN 块格式" >
源 PIN 块的格式代码。
01:带主帐号的 ANSI9.8 格式
02: Docutel ATM;
03: Diebold and IBM ATM,;
04: Plus Network;
05: ISO9564-1-1 格式,1NP..PR...R
06:不带主帐号的 ANSI9.8 格式
</pinBlockFormat>
<account len="12" cn="账号" >
账号中去除校验位的最右 12 位
</account>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>JF</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="源 ZPK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="PIN块错误">
<hex>20</hex>
</option>
<option cn="无效的用户存储索引">
<hex>21</hex>
</option>
<option cn="帐号无效">
<hex>22</hex>
</option>
<option cn="无效 PIN 块格式代码">
<hex>23</hex>
</option>
<option cn="PIN 小于 4 位或大于 12 位。">
<hex>24</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<pinBlock :len="dcaLen()" cn="PIN 块" >
LMK 对(02-03)下加密的 PIN
</pinBlock>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function scaLen() {
if(1 == $packet.get('data').get('sca$option')){
return 32
}else {
return 16
}
}
function dcaLen() {
if(1 == $packet.get('data').get('dca$option')){
return 32
}else {
return 16
}
} </script>
</packet>
+162
View File
@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>JG</hex>
</command>
<data extend="data">
<zpk cn="ZPK" >
当前加密 PIN 块的 ZPK;LMK 对(06-07)下加密。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zpk>
<algorithmKey len="1" cn="算法标识" required="false">
取值 P(可选)
</algorithmKey>
<sca len="1" cn="源算法 SCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</sca>
<dca len="1" cn="目的算法 DCA" :if=" null != $packet.data.algorithmKey ">
<options>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
</options>
</dca>
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<PinBlock :len="scaLen()" cn="PIN 块" >
源 ZPK 下加密的源 PIN 块
</PinBlock>
<pinBlockFormat len="2" cn="PIN 块格式" >
源 PIN 块的格式代码。
01:带主帐号的 ANSI9.8 格式
02: Docutel ATM;
03: Diebold and IBM ATM,;
04: Plus Network;
05: ISO9564-1-1 格式,1NP..PR...R
06:不带主帐号的 ANSI9.8 格式
</pinBlockFormat>
<account len="12" cn="账号" >
账号中去除校验位的最右 12 位
</account>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>JH</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZPK 奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="来自主机的PIN错误">
<hex>14</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="PIN块错误">
<hex>20</hex>
</option>
<option cn="无效的用户存储索引">
<hex>21</hex>
</option>
<option cn="无效 PIN 块格式代码">
<hex>23</hex>
</option>
<option cn="PIN 小于 4 位或大于 12 位。">
<hex>24</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<pinBlock :len="dcaLen()" cn="PIN 块" >
LMK 对(02-03)下加密的 PIN
</pinBlock>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function scaLen() {
if(1 == $packet.get('data').get('sca$option')){
return 32
}else {
return 16
}
}
function dcaLen() {
if(1 == $packet.get('data').get('dca$option')){
return 32
}else {
return 16
}
}
</script>
</packet>
+113
View File
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>LB</hex>
</command>
<data extend="data">
<indexFlag len="1" cn="索引标志">
值为“K”。
</indexFlag>
<index len="27" cn="索引地址">
指示用户密钥存储区的27位地址。
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</index>
<key cn="KEY">
被加密的密钥
</key>
<checkFlag len="1" required="false" cn="校验标志">
取值P(可选项)
</checkFlag>
<checkValue :if="hasCheckFlag()" cn="校验值">
CheckValue校验值,仅“校验标志”为P时此值显示。
</checkValue>
<startTime len="8" cn="密钥启用日期">
YYYYMMDD
</startTime>
<endTime len="8" cn="密钥到期日期">
YYYYMMDD
</endTime>
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>LC</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="MAC校验不过">
<hex>01</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效的用户密钥存储索引">
<hex>21</hex>
</option>
<option cn="无效的索引值">
<hex>22</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错">
<hex>80</hex>
</option>
</options>
</error>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function hasCheckFlag(){
if( "P".equals(new String($packet.data.checkFlag) ))
{
return true;
}else{
return false;
}
}
</script>
</packet>
+105
View File
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>LF</hex>
</command>
<data extend="data">
<indexFlag len="1" cn="索引标志">
值为“K”。
</indexFlag>
<index len="27" cn="索引地址">
指示用户密钥存储区的27位地址。
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</index>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>LG</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="用户密钥存储区没有装载数据">
<hex>12</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="无效的用户密钥存储索引">
<hex>21</hex>
</option>
<option cn="无效的索引值">
<hex>22</hex>
</option>
</options>
</error>
<keyHead len="1" cn="key 头">
如果是 'Z' ,key 16 个字节长
如果是 'X,U,S' ,key 32 个字节长
如果是 'Y,T' ,key 48 个字节长
</keyHead>
<key :len="keyLen()" cn="KEY">
被加密的密钥
</key>
<keyCheck :len="keyCheckLen()" cn="密钥校验值" required="false">
S-32H,else-16H(目前仅3.07_B目标代码生效)
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function keyLen() {
if( $final.data.keyHead.eqStr("Y") || $final.data.keyHead.eqStr("T") ){
return 48
}else if( $final.data.keyHead.eqStr("X") || $final.data.keyHead.eqStr("U") ){
return 32
}else{
return 16
}
}
function keyCheckLen() {
if( $final.data.keyHead.eqStr("S") ){
return 32
}else{
return 16
}
}
</script>
</packet>
+112
View File
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>LG</hex>
</command>
<data extend="data">
<indexFlag len="1" cn="索引标志">
值为“K”。
</indexFlag>
<index len="27" cn="索引地址">
指示用户密钥存储区的27位地址。
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</index>
<key cn="KEY">
被加密的密钥
</key>
<checkFlag len="1" required="false" cn="校验标志">
取值P(可选项)
</checkFlag>
<checkValue :if="hasCheckFlag()" cn="校验值">
CheckValue校验值,仅“校验标志”为P时此值显示。
</checkValue>
<startTime len="8" cn="密钥启用日期">
YYYYMMDD
</startTime>
<endTime len="8" cn="密钥到期日期">
YYYYMMDD
</endTime>
<oldEndTime len="8" cn="老密钥到期日期">
YYYYMMDD
</oldEndTime>
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>LH</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>21</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function hasCheckFlag(){
if( "P".equals(new String($packet.data.checkFlag) ))
{
return true;
}else{
return false;
}
}
</script>
</packet>
+150
View File
@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>MA</hex>
</command>
<data extend="data">
<businessKey len="1" cn="业务标识" required="false">
取值 P(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<alg len="1" cn="算法">
<options>
<option cn="DES">
<hex>0</hex>
</option>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
<option cn="AES">
<hex>3</hex>
</option>
<option cn="IDEA">
<hex>4</hex>
</option>
<option cn="SM1">
<hex>5</hex>
</option>
<option cn="3DESX919">
<hex>6</hex>
</option>
</options>
</alg>
<keyType len="1" cn="密钥类型">
<options>
<option cn="TAK">
<hex>0</hex>
</option>
<option cn="ZAK">
<hex>1</hex>
</option>
</options>
</keyType>
<fullMode len="1" cn="填充类型">
<options>
<option cn="弱填充">
<hex>0</hex>
</option>
<option cn="强填充">
<hex>1</hex>
</option>
</options>
</fullMode>
<MACLen len="1" cn="MAC数据长度">
<options>
<option cn="4">
<hex>1</hex>
</option>
<option cn="8">
<hex>2</hex>
</option>
<option cn="16">
<hex>3</hex>
</option>
</options>
</MACLen>
<key cn="密钥">
</key>
<MACData maxLen="1024" cn="MAC数据">
生成MAC的数据,n=1024
注:数据长度应该为8的整数倍,如果不是8的整数倍,系统默认在数据后面填充0x00组成8的整数倍。
</MACData>
</data>
</req>
<res>
<command>
<hex>MB</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返回标识决定,默认8H
</MAC>
</data>
</res>
<script>
function retMacLen(){
if( 0 == $packet.data.MACLen$option ) {
return 8;
} else if ( 1 == $packet.data.MACLen$option ) {
return 16;
} else if ( 2 == $packet.data.MACLen$option ) {
return 32;
}
}
</script>
</packet>
+101
View File
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>MA</hex>
</command>
<data extend="data">
<businessKey len="1" cn="业务标识" required="false">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<IVKey len="1" cn="IV标识" required="false">
取值P(可选)
</IVKey>
<IV len="16" :if=" null != $packet.data.IVKey" cn="IV" >
IV标识存在时存在
计算MAC的IV值,默认为8字节0x00
</IV>
<TAK cn="TAK">
LMK对(16-17)下加密的TAK。
27位的索引号:16位机构号+3位密钥类型+8位密钥索引号
</TAK>
<MACData maxLen="1024" cn="MAC数据">
生成MAC的数据,n=1024
注:数据长度应该为8的整数倍,如果不是8的整数倍,系统默认在数据后面填充0x00组成8的整数倍。
</MACData>
<tailSep len="1" :if=" null != $packet.data.tail " cn="终止信息分隔符">
可选项。如果显示消息尾域,则该域必须显示。值为“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="消息尾">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>MB</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="8">
所计算出的MAC。有MAC返回标识决定,默认8H
</MAC>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script> </script>
</packet>
+138
View File
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>MC</hex>
</command>
<data extend="data">
<businessKey len="1" cn="业务标识" required="false">
取值 P(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<alg len="1" cn="算法">
<options>
<option cn="DES">
<hex>0</hex>
</option>
<option cn="3DES">
<hex>1</hex>
</option>
<option cn="SM4">
<hex>2</hex>
</option>
<option cn="AES">
<hex>3</hex>
</option>
<option cn="IDEA">
<hex>4</hex>
</option>
<option cn="SM1">
<hex>5</hex>
</option>
<option cn="3DESX919">
<hex>6</hex>
</option>
</options>
</alg>
<keyType len="1" cn="密钥类型">
<options>
<option cn="TAK">
<hex>0</hex>
</option>
<option cn="ZAK">
<hex>1</hex>
</option>
</options>
</keyType>
<fullMode len="1" cn="填充类型">
<options>
<option cn="弱填充">
<hex>0</hex>
</option>
<option cn="强填充">
<hex>1</hex>
</option>
</options>
</fullMode>
<MACLen len="1" cn="MAC数据长度">
<options>
<option cn="4">
<hex>1</hex>
</option>
<option cn="8">
<hex>2</hex>
</option>
<option cn="16">
<hex>3</hex>
</option>
</options>
</MACLen>
<key cn="密钥">
</key>
<MAC cn="MAC">
8H或16H或32H
</MAC>
<MACData maxLen="1024" cn="MAC数据">
生成MAC的数据,n=1024
注:数据长度应该为8的整数倍,如果不是8的整数倍,系统默认在数据后面填充0x00组成8的整数倍。
</MACData>
</data>
</req>
<res>
<command>
<hex>MD</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>
</data>
</res>
<script>
</script>
</packet>
+137
View File
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>MF</hex>
</command>
<data extend="data">
<zmk cn="ZMK" >
LMK 对(04-05)下加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<tak cn="TAK" >
ZMK 下加密的 TAK。
</tak>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。LMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>MG</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="TMK、TPK 或 PVK 奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<takLmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</takLmkHead>
<takLmk :len="lmkLen()" cn="ZPK(ZMK)" >
LMK 对 16-17 下加密的 TAK
</takLmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 TAK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。 当 LMK 的密钥方案为 S 时,默认或 KCV
类型为 0 时,输出 32H 的 KCV
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function lmkLen() {
return Util.lenChoice($final.getSection('data').getSection('takLmkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('takLmkHead').getValue() )
} </script>
</packet>
+137
View File
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>MG</hex>
</command>
<data extend="data">
<zmk cn="ZMK" >
LMK 对(04-05)下加密的 ZMK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</zmk>
<tak cn="TAK" >
LMK 对(16-17)下加密的 TAK。
27 位的索引号:16 位机构号+3 位密钥类型+8 位密钥
索引号
</tak>
<businessKey len="1" cn="业务标识">
取值 N(可选)当选定此标识时,表示密钥加密方案采用默认方式
</businessKey>
<separator cn="分隔符" :if=" null != $packet.data.zmkSolution ">
可选项。如果显示后面的三个域,则该域必须显示。
值为“;”。
如果命令不需要一个可选域,则用一个有效值或 0 填
充。
</separator>
<zmkSolution len="1" cn="密钥方案(ZMK)" required="false">
可选项。ZMK 下加密密钥的方案。
</zmkSolution>
<lmkSolution len="1" cn="密钥方案(LMK)" required="false">
可选项。LMK 下加密密钥的方案。
</lmkSolution>
<keyCheckType len="1" cn="密钥校验值类型" required="false">
可选项。密钥校验值计算方式。
0-KCV 向后兼容。
1-KCV 6H。
</keyCheckType>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>MH</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="TMK、TPK 或 PVK 奇偶校验错">
<hex>11</hex>
</option>
<option cn="用户存储区没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
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>
<takZmkHead len="1" cn="zpk 头" >
如果是 'Z' , 16 个字节长
如果是 'X,U,S' , 32 个字节长
如果是 'Y,T' , 48 个字节长
</takZmkHead>
<takZmk :len="lmkLen()" cn="ZPK(ZMK)" >
ZMK 下加密的 TAK
</takZmk>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
用 TAK 加密 64 位 0 的结果。是 16H 还是 6H 取决于 KCV
的类型选项。当 ZMK 的密钥方案为 S 时,默认或 KCV
类型为 0 时,输出 32H 的 KCV
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function lmkLen() {
return Util.lenChoice($final.getSection('data').getSection('takZmkHead').getValue() )
}
function keyCheckLen() {
return Util.keyCheckLen($final.getSection('data').getSection('takZmkHead').getValue() )
} </script>
</packet>
+183
View File
@@ -0,0 +1,183 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>MS</hex>
</command>
<data extend="data">
<block len="1" cn="消息块号">
<options>
<option cn="仅一块">
<hex>0</hex>
</option>
<option cn="第一块">
<hex>1</hex>
</option>
<option cn="中间块">
<hex>2</hex>
</option>
<option cn="最后块">
<hex>3</hex>
</option>
</options>
</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密钥.Ansi X9.9">
<hex>0</hex>
</option>
<option cn="双倍长度DES密钥,Ansi X9.19">
<hex>1</hex>
</option>
<option cn=" SM4-CBC,弱填充0x00,银联">
<hex>2</hex>
</option>
<option cn="3DES-CBC, ,弱填充0x00,银联">
<hex>3</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="2 == $packet.data.block$option || 3 == $packet.data.block$option">
当消息块号为2或3时显示
</iv>
<msgLen len="4" format="X" :value="calcMSGLen()" cn="消息长度">
将要作 MAC的消息长度(若消息类型为二进制,则为
随后域长度;若消息类型为扩展十六进制,则为随后
域长度的一半)。
</msgLen>
<msg :len="" cn="消息块">
二进制或扩展十六进制形式的消息块。
</msg>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>MT</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="无效消息类型代码">
<hex>03</hex>
</option>
<option cn="无效密钥类型代码">
<hex>04</hex>
</option>
<option cn="无效消息块号">
<hex>05</hex>
</option>
<option cn="无效密钥长度代码">
<hex>06</hex>
</option>
<option cn="ZAK奇偶校验错">
<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>27</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<MAB :len="retMacLen()" cn="MAB">
当消息块号为“1”或“2”时,作为下一块的IV。
当消息块号为“0”或“3”时,用于消息认证。
</MAB>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>
function calcMSGLen(){
if( 0 == $packet.data.dataType$option ){
return $packet.data.msg.length
} else {
return $packet.data.msg.length() /2
}
}
function retMacLen(){
if ( 0 == $packet.data.mode$option ) {
return 16;
} else {
return 32;
}
}
</script>
</packet>
+141
View File
@@ -0,0 +1,141 @@
<?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>
+133
View File
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" ?>
<packet extend="base">
<req>
<command>
<hex>NE</hex>
</command>
<data extend="data">
<keyType len="3" cn="密钥类型">
密钥类型
</keyType>
<solution len="1" cn="密钥长度/LMK 下加密密钥的方案。">
密钥长度/LMK 下加密密钥的方案。
</solution>
<flag len="1" cn="业务标识">
业务标识
</flag>
<print cn="打印域">
; 分隔多个打印域
</print>
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为
“X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</req>
<res>
<command>
<hex>NF</hex>
</command>
<data>
<error len="2" cn="错误码" format="X" :catch="catchError('%s')">
<options>
<option cn="无错误">
<hex>00</hex>
</option>
<option cn="密钥奇偶校验错">
<hex>01</hex>
</option>
<option cn="ZMK 奇偶校验错">
<hex>10</hex>
</option>
<option cn="用户存储区中没有装载密钥">
<hex>12</hex>
</option>
<option cn="LMK 错误">
LMK 错误;报告给管理员。
<hex>13</hex>
</option>
<option cn="输入数据错">
<hex>15</hex>
</option>
<option cn="不在授权状态">
<hex>17</hex>
</option>
<option cn="无效用户存储区索引">
<hex>21</hex>
</option>
<option cn="无效的密钥类型">
<hex>28</hex>
</option>
<option cn="无效的密钥方案">
<hex>26</hex>
</option>
<option cn="输入数据长度错误">
<hex>80</hex>
</option>
</options>
</error>
<keyHead len="1" cn="lmk 头">
如果是 'Z' ,lmk 16 个字节长
如果是 'X,U,S' ,lmk 32 个字节长
如果是 'Y,T' ,lmk 48 个字节长
</keyHead>
<key :len="Len()" cn="密钥(LMK)">
LMK 加密下的密钥。
</key>
<keyCheck :len="keyCheckLen()" cn="密钥校验值">
密钥校验值。当 LMK 保护密钥的方案为‘S’,KCV 为
32H,算法为 SM4,否则 KCV 为 16H,算法为 DES/3DES
</keyCheck>
<tailSep len="1" required="false" cn="尾分隔">
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
<hex>19</hex>
</tailSep>
<tail maxLen="32" required="false" cn="尾部">
可选项。最大长度为 32个字符。
</tail>
</data>
</res>
<script>function Len() {
if( $final.data.keyHead.eqStr("Y") || $final.data.keyHead.eqStr("T") ){
return 48
}else if( $final.data.keyHead.eqStr("X") || $final.data.keyHead.eqStr("U") ){
return 32
}
return 15
}
function keyCheckLen() {
if ( $final.data.keyHead.eqStr("S") ) {
return 32
} else {
return 6
}
}
</script>
</packet>

Some files were not shown because too many files have changed in this diff Show More