添加证书类型判断
This commit is contained in:
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user