添加证书类型判断

This commit is contained in:
cheney
2022-10-13 15:23:55 +08:00
parent 01f7ac1f31
commit d7fe309b08
5 changed files with 116 additions and 1 deletions
@@ -1,5 +1,6 @@
package com.sunyard.sydapi.test;
import com.sunyard.constant.CertUsage;
import com.sunyard.util.CertUtil;
import org.junit.Assert;
import org.junit.Test;
@@ -70,4 +71,40 @@ public class TestCertUtil {
);
}
@Test
public void certtype1() throws CertificateException, NoSuchProviderException {
Assert.assertTrue(
CertUtil.certUsageCheck( readCert("/x509/c1.crt") , CertUsage.digitalSignature , CertUsage.nonRepudiation )
);
}
@Test
public void certtype2() throws CertificateException, NoSuchProviderException {
Assert.assertTrue(
CertUtil.certUsageCheck( readCert("/x509/c2.crt") , CertUsage.keyEncipherment )
);
}
@Test
public void certtype4() throws CertificateException, NoSuchProviderException {
Assert.assertTrue(
CertUtil.certUsageCheck( readCert("/x509/c4.crt") , CertUsage.keyEncipherment )
);
}
@Test
public void certtype5() throws CertificateException, NoSuchProviderException {
Assert.assertTrue(
CertUtil.certUsageCheck( readCert("/x509/c5.crt") )
);
}
@Test
public void certtype6() throws CertificateException, NoSuchProviderException {
Assert.assertTrue(
CertUtil.certUsageCheck( readCert("/x509/c6.crt") , CertUsage.digitalSignature , CertUsage.nonRepudiation)
);
}
}