增加签名数字信封、解签名数字信封接口
This commit is contained in:
+50
-5
@@ -72,6 +72,30 @@
|
||||
公钥加密的密钥格式3所需机构码长度,仅当格式3以及'P'存在时存在
|
||||
</orgCode>
|
||||
|
||||
<!-- 新增功能-->
|
||||
<pSignFlag len="1" required="false" cn="可选字段">
|
||||
签名数字信封标识符,存在则为P
|
||||
</pSignFlag>
|
||||
|
||||
<signCertificateLen len="4" :value="signCertificateLen()" cn="签名证书DN长度">
|
||||
可选项,只针对"可选字段"为P时存在。
|
||||
</signCertificateLen>
|
||||
|
||||
<signCertificateDn :len="strlen()" :if="hasOrgCN()" cn="签名证书DN">
|
||||
可选项,只针对“证书模式”为1时有,只针对"可选字段"为P时存在。
|
||||
</signCertificateDn>
|
||||
<signCertificateModel len="1" cn="是否附带公钥信息">
|
||||
<options>
|
||||
<option cn="无需附带">
|
||||
<hex>0</hex>
|
||||
</option>
|
||||
<option cn="附带公钥信息">
|
||||
<hex>1</hex>
|
||||
</option>
|
||||
</options>
|
||||
</signCertificateModel>
|
||||
|
||||
|
||||
<tailSep len="1" :if=" null != $packet.data.tail " cn="尾分隔">
|
||||
可选项。如果显示消息尾域,则该域必须显示。值为
|
||||
“X’19”。
|
||||
@@ -172,17 +196,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
function signCertificateLen(){
|
||||
var data = $packet.data;
|
||||
if( 'P' == $packet.data.pSignFlag ){
|
||||
return data.signCertificateDn.length
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function getKeyLen() {
|
||||
return Util.a2i( $final.getSection('data').getSection('keyLen') )
|
||||
return Util.a2i( $final.getSection('data').getSection('keyLen') );
|
||||
}
|
||||
|
||||
function lmkLen() {
|
||||
if( Arrays.equals("L".getBytes(),
|
||||
$final.getSection('data').getSection('lmkHead').getValue()
|
||||
) ){
|
||||
return 64
|
||||
return 64;
|
||||
}else{
|
||||
return 32
|
||||
return 32;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,6 +223,8 @@
|
||||
return $packet.data.orgData.length
|
||||
}
|
||||
|
||||
|
||||
|
||||
<![CDATA[
|
||||
function hasOrgCode() {
|
||||
if(2 == $packet.data.alg$option && 'P' == $packet.data.pFlag) {
|
||||
@@ -199,11 +234,21 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function hasOrgCN() {
|
||||
if(1 == $packet.data.certificateModel$option && 'P' == $packet.data.pSignFlag) {
|
||||
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)
|
||||
data[0] = (byte)(len >> 8 & 0xFF);
|
||||
data[1] = (byte)(len & 0xFF);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
+40
-9
@@ -11,6 +11,18 @@
|
||||
可选,如果输入P代表使用PKCS7_SM2_SM4_ECB模式解密数字信封
|
||||
</pFlag>
|
||||
|
||||
|
||||
<!--新增-->
|
||||
<pSignFlag len="1" required="false" if="'P' == $packet.data.pFlag" cn="可选字段2">
|
||||
如果输入P代表进行解封签名数字信封模式,必须当可选字段1为P时才可选
|
||||
</pSignFlag>
|
||||
<signCertificateLen len="4" :value="signCertificateLen()" if="'P' == $packet.data.pSignFlag" cn="签名证书内容长度">
|
||||
根据证书模式,需要输入内容项的长度n,只针对可选字段2为P时存在
|
||||
</signCertificateLen>
|
||||
<signCertificateDn :if="hasSign()" cn="签名证书DN">
|
||||
X509证书的subject可选项,只针对“证书模式”为1时有,只针对可选字段2为P时存在
|
||||
</signCertificateDn>
|
||||
|
||||
<certificateModel len="1" cn="证书模式">
|
||||
<options>
|
||||
<option cn="证书序号">
|
||||
@@ -36,14 +48,16 @@
|
||||
可选项,只针对“证书模式”为 1时有。
|
||||
</certificateDn>
|
||||
|
||||
|
||||
|
||||
<keyLen len="4" :value="keyLen()" cn="密钥密文长度">
|
||||
公钥加密的密钥密文长度
|
||||
</keyLen>
|
||||
|
||||
<key :len="getKeyLen()" cn="密钥密文">
|
||||
公钥加密的密钥密文的 BASE64 编码
|
||||
</key>
|
||||
|
||||
|
||||
<keyType len="1" cn="加密密钥方案">
|
||||
LMK 下加密密钥的方案。
|
||||
</keyType>
|
||||
@@ -57,6 +71,8 @@
|
||||
<tail maxLen="32" required="false" cn="尾部">
|
||||
可选项。最大长度为 32个字符。
|
||||
</tail>
|
||||
|
||||
|
||||
</data>
|
||||
|
||||
</req>
|
||||
@@ -126,7 +142,7 @@
|
||||
对称密钥的密文,由 LMK30-31 保护。
|
||||
</lmk>
|
||||
|
||||
<keyCheck len="16" cn="密钥校验值">
|
||||
<keyCheck len="32" cn="密钥校验值">
|
||||
密钥校验值
|
||||
</keyCheck>
|
||||
|
||||
@@ -155,15 +171,30 @@
|
||||
function certificateLen(){
|
||||
var data = $packet.data;
|
||||
if( 0 == data.certificateModel$option ){
|
||||
return data.certificateSn.length()
|
||||
return data.certificateSn.length
|
||||
}
|
||||
if( 1 == data.certificateModel$option ){
|
||||
return data.certificateDn.length()
|
||||
return data.certificateDn.length
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function signCertificateLen(){
|
||||
var data = $packet.data;
|
||||
return data.signCertificateDn.length
|
||||
}
|
||||
<![CDATA[
|
||||
function hasSign() {
|
||||
if(1 == $packet.data.certificateModel$option && 'P' == $packet.data.pSignFlag) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
]]>
|
||||
|
||||
|
||||
function keyLen() {
|
||||
return $packet.data.key.length()
|
||||
return $packet.data.key.length;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,17 +206,17 @@
|
||||
if( Arrays.equals("L".getBytes(),
|
||||
$final.getSection('data').getSection('lmkHead').getValue()
|
||||
) ){
|
||||
return 64
|
||||
return 64;
|
||||
}else{
|
||||
return 32
|
||||
return 32;
|
||||
}
|
||||
}
|
||||
function orgCodeLen() {
|
||||
return Util.a2i( $final.getSection('data').getSection('orgCodeLen') )
|
||||
return Util.a2i( $final.getSection('data').getSection('orgCodeLen') );
|
||||
}
|
||||
|
||||
function oDataLen() {
|
||||
return Util.a2i( $final.getSection('data').getSection('oDataLen') )
|
||||
return Util.a2i( $final.getSection('data').getSection('oDataLen') );
|
||||
}
|
||||
</script>
|
||||
</packet>
|
||||
|
||||
Reference in New Issue
Block a user