All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ofdrw.gm.sm2strut.builder.CertSigHolder Maven / Gradle / Ivy

Go to download

符合《GMT 0031-2014 安全电子签章密码技术规范》与 《GB/T 38540-2020 信息安全技术 安全电子签章密码技术规范》的ASN1数据结构。

The newest version!
package org.ofdrw.gm.sm2strut.builder;

import org.ofdrw.gm.cert.CertTools;

import java.io.IOException;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;

/**
 * 证书和签名值封装
 * 

* 更加便于理解和操作 * * @author 权观宇 * @since 2021-08-05 18:39:48 */ public class CertSigHolder { /** * 签名值 */ byte[] signature; /** * 证书对象 */ Certificate certificate; /** * ASN1证书对象结构 */ private org.bouncycastle.asn1.x509.Certificate asn1Obj; public CertSigHolder(byte[] signature, Certificate certificate) { this.signature = signature; this.certificate = certificate; this.asn1Obj = null; } public byte[] getSignature() { return signature; } public void setSignature(byte[] signature) { this.signature = signature; } public Certificate getCertificate() { return certificate; } public void setCertificate(Certificate certificate) { this.certificate = certificate; } /** * 转换证书对象为ASN1结构对象 * * @return 证书 ASN1结构 * @throws CertificateEncodingException 证书编码异常 * @throws IOException IO读写异常 */ public org.bouncycastle.asn1.x509.Certificate getAsn1Cert() throws CertificateEncodingException, IOException { if (this.certificate == null) { throw new IllegalArgumentException("证书对象(certificate)为空"); } if (asn1Obj != null) { return asn1Obj; } asn1Obj = CertTools.asn1(this.certificate); return asn1Obj; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy