summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2016-01-11 15:11:15 -0800
committerKenny Root <kroot@google.com>2016-01-11 15:42:49 -0800
commitf11bf8a0ffd68f584a9413d295a408e57fe811e5 (patch)
tree982b29ffdfe42286618608af4a81b91afc6dd14c
parentcf10adecdc9cb1b20a207fdb4b4bf581f2160048 (diff)
downloadnist-pkits-f11bf8a0ffd68f584a9413d295a408e57fe811e5.tar.gz
Allow separation of path and certs
Some tests were listed with multiple apparent intermediates in the documentation, but they were actually one CA to sign the cert and one CA to sign the CRL. This change allows the fixing of the tests to be able to assert separate path from general cert collections. Bug: 8030138 Change-Id: I6dab5be846650c26ed0ed9eb9d8194d93fc85908
-rw-r--r--src/libcore/java/security/cert/X509CertificateNistPkitsTest.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libcore/java/security/cert/X509CertificateNistPkitsTest.java b/src/libcore/java/security/cert/X509CertificateNistPkitsTest.java
index 5171a64..b3562d3 100644
--- a/src/libcore/java/security/cert/X509CertificateNistPkitsTest.java
+++ b/src/libcore/java/security/cert/X509CertificateNistPkitsTest.java
@@ -152,6 +152,12 @@ public class X509CertificateNistPkitsTest extends TestCase {
private void assertInvalidPath(String trustAnchor, String[] certs, String[] crls)
throws Exception, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
+ assertInvalidPath(trustAnchor, certs, certs, crls);
+ }
+
+ private void assertInvalidPath(String trustAnchor, String[] path, String[] certs,
+ String[] crls) throws Exception, NoSuchAlgorithmException,
+ InvalidAlgorithmParameterException {
CertificateFactory f = CertificateFactory.getInstance("X.509");
PKIXParameters params = getTestPathParams(f, trustAnchor, certs, crls);
@@ -169,10 +175,16 @@ public class X509CertificateNistPkitsTest extends TestCase {
private void assertValidPath(String trustAnchor, String[] certs, String[] crls)
throws Exception, NoSuchAlgorithmException, CertPathValidatorException,
InvalidAlgorithmParameterException {
+ assertValidPath(trustAnchor, certs, certs, crls);
+ }
+
+ private void assertValidPath(String trustAnchor, String[] path, String[] certs, String[] crls)
+ throws Exception, NoSuchAlgorithmException, CertPathValidatorException,
+ InvalidAlgorithmParameterException {
CertificateFactory f = CertificateFactory.getInstance("X.509");
PKIXParameters params = getTestPathParams(f, trustAnchor, certs, crls);
- CertPath cp = getTestPath(f, certs);
+ CertPath cp = getTestPath(f, path);
CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
PKIXCertPathValidatorResult cpvResult = (PKIXCertPathValidatorResult) cpv.validate(cp,