1、升级dproto依赖,2、添加77,78指令的接口,sm2加解密密文结构为C1C2C3,3、生成数字信封添加机构码
This commit is contained in:
+53
-21
@@ -14,6 +14,9 @@
|
||||
<option cn="SM2_SM4_ECB">
|
||||
<hex>1</hex>
|
||||
</option>
|
||||
<option cn="SM2_SM4_ECB 机构码|02|密钥">
|
||||
<hex>2</hex>
|
||||
</option>
|
||||
</options>
|
||||
</alg>
|
||||
|
||||
@@ -50,6 +53,14 @@
|
||||
LMK 下加密密钥的方案。
|
||||
</keyType>
|
||||
|
||||
<orgCodeLen len="2" :value="orgCodeLen()" :if="hasOrgCode()" cn="机构码长度">
|
||||
公钥加密的密钥格式3所需机构码长度,仅当格式3以及'P'存在时存在
|
||||
</orgCodeLen>
|
||||
|
||||
<orgCode :if="hasOrgCode()" cn="机构码长度">
|
||||
公钥加密的密钥格式3所需机构码长度,仅当格式3以及'P'存在时存在
|
||||
</orgCode>
|
||||
|
||||
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
|
||||
可选项。如果显示消息尾域,则该域必须显示。值为
|
||||
“X’19”。
|
||||
@@ -140,29 +151,50 @@
|
||||
|
||||
|
||||
</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
|
||||
}
|
||||
}
|
||||
<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 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>
|
||||
function lmkLen() {
|
||||
if( Arrays.equals("L".getBytes(),
|
||||
$final.getSection('data').getSection('lmkHead').getValue()
|
||||
) ){
|
||||
return 64
|
||||
}else{
|
||||
return 32
|
||||
}
|
||||
}
|
||||
|
||||
<![CDATA[
|
||||
function hasOrgCode() {
|
||||
if(2 == $packet.data.alg$option && 'P' == $packet.data.pFlag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function orgCodeLen() {
|
||||
def len = $packet.data.orgCode.length();
|
||||
def data = new byte[2];
|
||||
data[0] = (byte)(len >> 8 & 0xFF)
|
||||
data[1] = (byte)(len & 0xFF)
|
||||
|
||||
return data;
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
</packet>
|
||||
|
||||
+37
-24
@@ -120,6 +120,14 @@
|
||||
密钥校验值
|
||||
</keyCheck>
|
||||
|
||||
<orgCodeLen len="4" cn="机构码长度">
|
||||
公钥加密的密钥格式3所需机构码长度,仅当格式3以及'P'存在时存在
|
||||
</orgCodeLen>
|
||||
|
||||
<orgCode :len="orgCodeLen()" cn="机构码长度">
|
||||
公钥加密的密钥格式3所需机构码长度,仅当格式3以及'P'存在时存在
|
||||
</orgCode>
|
||||
|
||||
<tailSep len="1" required="false" cn="尾分隔">
|
||||
可选项。如果显示消息尾域,则该域必须显示。值为 “X’19”。
|
||||
<hex>19</hex>
|
||||
@@ -133,32 +141,37 @@
|
||||
|
||||
|
||||
</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()
|
||||
}
|
||||
}
|
||||
<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 keyLen() {
|
||||
return $packet.data.key.length()
|
||||
}
|
||||
|
||||
|
||||
function getKeyLen() {
|
||||
return Util.a2i( $final.getSection('data').getSection('keyLen') )
|
||||
}
|
||||
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>
|
||||
function lmkLen() {
|
||||
if( Arrays.equals("L".getBytes(),
|
||||
$final.getSection('data').getSection('lmkHead').getValue()
|
||||
) ){
|
||||
return 64
|
||||
}else{
|
||||
return 32
|
||||
}
|
||||
}
|
||||
function orgCodeLen() {
|
||||
return Util.a2i( $final.getSection('data').getSection('orgCodeLen') )
|
||||
}
|
||||
</script>
|
||||
</packet>
|
||||
|
||||
Reference in New Issue
Block a user