diff options
author | Chad Brubaker <cbrubaker@google.com> | 2015-12-18 13:43:28 -0800 |
---|---|---|
committer | Chad Brubaker <cbrubaker@google.com> | 2016-01-13 15:19:45 -0800 |
commit | aa6c3c3e252252b80c3900bd4c1ff27d37265c6d (patch) | |
tree | 143c86a6fc3d42adef1b666505651fa7e9fa1043 /tests/NetworkSecurityConfigTest/src | |
parent | 47359e813d28570acb789463403bd9df123aaca6 (diff) |
Support TrustedCertificateStore.findAllIssuers
Change-Id: I176ec42c9907e50ee218e4fb352b530ca797be46
Diffstat (limited to 'tests/NetworkSecurityConfigTest/src')
-rw-r--r-- | tests/NetworkSecurityConfigTest/src/android/security/net/config/TestCertificateSource.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/NetworkSecurityConfigTest/src/android/security/net/config/TestCertificateSource.java b/tests/NetworkSecurityConfigTest/src/android/security/net/config/TestCertificateSource.java index 0c360631c294..4c12c2d5da7c 100644 --- a/tests/NetworkSecurityConfigTest/src/android/security/net/config/TestCertificateSource.java +++ b/tests/NetworkSecurityConfigTest/src/android/security/net/config/TestCertificateSource.java @@ -16,8 +16,9 @@ package android.security.net.config; -import java.util.Set; +import android.util.ArraySet; import java.security.cert.X509Certificate; +import java.util.Set; import com.android.org.conscrypt.TrustedCertificateIndex; @@ -33,10 +34,12 @@ public class TestCertificateSource implements CertificateSource { } } + @Override public Set<X509Certificate> getCertificates() { return mCertificates; } + @Override public X509Certificate findBySubjectAndPublicKey(X509Certificate cert) { java.security.cert.TrustAnchor anchor = mIndex.findBySubjectAndPublicKey(cert); if (anchor == null) { @@ -45,6 +48,7 @@ public class TestCertificateSource implements CertificateSource { return anchor.getTrustedCert(); } + @Override public X509Certificate findByIssuerAndSignature(X509Certificate cert) { java.security.cert.TrustAnchor anchor = mIndex.findByIssuerAndSignature(cert); if (anchor == null) { @@ -52,4 +56,13 @@ public class TestCertificateSource implements CertificateSource { } return anchor.getTrustedCert(); } + + @Override + public Set<X509Certificate> findAllByIssuerAndSignature(X509Certificate cert) { + Set<X509Certificate> certs = new ArraySet<X509Certificate>(); + for (java.security.cert.TrustAnchor anchor : mIndex.findAllByIssuerAndSignature(cert)) { + certs.add(anchor.getTrustedCert()); + } + return certs; + } } |