File tree 1 file changed +0
-20
lines changed
1 file changed +0
-20
lines changed Original file line number Diff line number Diff line change @@ -94,28 +94,8 @@ public void sm2_certificate_test() throws Exception{
94
94
SM2Certificate sm2Cert = new SM2Certificate ();
95
95
sm2Cert .importPem ("D:\\ cert.pem" );
96
96
System .out .println ("NotAfter:" +sm2Cert .getNotAfter ());
97
-
98
- //TODO SM2Certificate继承Certificate,获取tbsCertificate解析cert实现verify方法。创建SM2CertificateFactory用以生成SM2Certificate
99
- CertificateFactory certFactory = CertificateFactory .getInstance ("SM2" , "GmSSL" );
100
- X509Certificate cert = (X509Certificate ) certFactory .generateCertificate (new java .io .ByteArrayInputStream (sm2Cert .getEncoded ()));
101
- // 提取证书的所有字段
102
- System .out .println ("版本号: " + cert .getVersion ());
103
- System .out .println ("序列号: " + cert .getSerialNumber ());
104
- System .out .println ("签名算法: " + cert .getSigAlgName ());
105
- System .out .println ("颁发者: " + cert .getIssuerX500Principal ().getName ());
106
- System .out .println ("主体: " + cert .getSubjectX500Principal ().getName ());
107
- System .out .println ("有效期开始: " + cert .getNotBefore ());
108
- System .out .println ("有效期结束: " + cert .getNotAfter ());
109
- System .out .println ("公钥算法: " + cert .getPublicKey ().getAlgorithm ());
110
- System .out .println ("公钥格式: " + cert .getPublicKey ().getFormat ());
111
- System .out .println ("公钥: " + cert .getPublicKey ());
112
- System .out .println ("签名值: " + byteToHex (cert .getSignature ()));
113
- // 可选字段
114
- System .out .println ("扩展字段是否存在: " + cert .getCriticalExtensionOIDs ());
115
97
}
116
98
117
-
118
-
119
99
@ Test
120
100
public void SM3Test () throws Exception {
121
101
String text ="Hello, GmSSL" ;
You can’t perform that action at this time.
0 commit comments