适配ofd签章SES_CertList
生活随笔
收集整理的這篇文章主要介紹了
适配ofd签章SES_CertList
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
import org.bouncycastle.asn1.*;import java.io.IOException;/*** 簽章者證書信息列表** @author 權觀宇* @since 2020-04-19 17:19:36*/
public class SES_CertList extends ASN1Objectimplements ASN1Choice {/*** 簽章者證書列表*/private final CertInfoList certs;/*** 簽章者證書雜湊值列表*/private final CertDigestList certDigestList;public SES_CertList(CertInfoList certs) {this.certs = certs;this.certDigestList = null;}public SES_CertList(CertDigestList certDigestList) {this.certs = null;this.certDigestList = certDigestList;}public static SES_CertList getInstance(ASN1Integer type, Object obj) {if (obj instanceof SES_CertList) {return (SES_CertList) obj;}if (obj != null) {if (obj instanceof ASN1Encodable) {final int t = type.getValue().intValue();/*if (t == 1) {return new SES_CertList(CertInfoList.getInstance(obj));} else if (t == 2) {return new SES_CertList(CertDigestList.getInstance(obj));} else {throw new IllegalArgumentException("unknown type in getInstance(): " + obj.getClass().getName());}*/if (t == 2) {return new SES_CertList(CertDigestList.getInstance(obj));} else {return new SES_CertList(CertInfoList.getInstance(obj));}}if (obj instanceof byte[]) {try {return getInstance(type, ASN1Primitive.fromByteArray((byte[]) obj));} catch (IOException e) {throw new IllegalArgumentException("unknown encoding in getInstance()");}}throw new IllegalArgumentException("unknown object in getInstance(): " + obj.getClass().getName());}return null;}public ASN1Object get() {if (certs != null) {return certs;} else return certDigestList;}public CertInfoList getCerts() {return certs;}public CertDigestList getCertDigestList() {return certDigestList;}@Overridepublic ASN1Primitive toASN1Primitive() {return get().toASN1Primitive();}
}
總結
以上是生活随笔為你收集整理的适配ofd签章SES_CertList的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux servlet 乱码问题,S
- 下一篇: TeamViewer - 最好用强大的免