Merge "Unhide RecoveryController#getRootCertificates()" into pi-dev
This commit is contained in:
@@ -4371,6 +4371,7 @@ package android.security.keystore.recovery {
|
||||
method public int[] getRecoverySecretTypes() throws android.security.keystore.recovery.InternalRecoveryServiceException;
|
||||
method public deprecated int getRecoveryStatus(java.lang.String, java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
|
||||
method public int getRecoveryStatus(java.lang.String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
|
||||
method public java.util.Map<java.lang.String, java.security.cert.X509Certificate> getRootCertificates();
|
||||
method public java.security.Key importKey(java.lang.String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
|
||||
method public deprecated void initRecoveryService(java.lang.String, byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
|
||||
method public void initRecoveryService(java.lang.String, byte[], byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.security.Key;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertPath;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -654,6 +655,11 @@ public class RecoveryController {
|
||||
return RecoverySession.newInstance(this);
|
||||
}
|
||||
|
||||
@RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE)
|
||||
public Map<String, X509Certificate> getRootCertificates() {
|
||||
return TrustedRootCertificates.getRootCertificates();
|
||||
}
|
||||
|
||||
InternalRecoveryServiceException wrapUnexpectedServiceSpecificException(
|
||||
ServiceSpecificException e) {
|
||||
if (e.errorCode == ERROR_SERVICE_INTERNAL_ERROR) {
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.Map;
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class TrustedRootCertificates {
|
||||
public final class TrustedRootCertificates {
|
||||
|
||||
public static final String GOOGLE_CLOUD_KEY_VAULT_SERVICE_V1_ALIAS =
|
||||
"GoogleCloudKeyVaultServiceV1";
|
||||
@@ -83,7 +83,7 @@ public class TrustedRootCertificates {
|
||||
/**
|
||||
* Returns all available root certificates, keyed by alias.
|
||||
*/
|
||||
public static Map<String, X509Certificate> listRootCertificates() {
|
||||
public static Map<String, X509Certificate> getRootCertificates() {
|
||||
return new ArrayMap(ALL_ROOT_CERTIFICATES);
|
||||
}
|
||||
|
||||
@@ -114,4 +114,7 @@ public class TrustedRootCertificates {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// Statics only
|
||||
private TrustedRootCertificates() {}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.security.keystore.recovery;
|
||||
|
||||
import static android.security.keystore.recovery.TrustedRootCertificates.listRootCertificates;
|
||||
import static android.security.keystore.recovery.TrustedRootCertificates.getRootCertificates;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -36,8 +36,8 @@ public class TrustedRootCertificatesTest {
|
||||
"GoogleCloudKeyVaultServiceV1";
|
||||
|
||||
@Test
|
||||
public void listRootCertificates_listsGoogleCloudVaultV1Certificate() {
|
||||
Map<String, X509Certificate> certificates = listRootCertificates();
|
||||
public void getRootCertificates_listsGoogleCloudVaultV1Certificate() {
|
||||
Map<String, X509Certificate> certificates = getRootCertificates();
|
||||
|
||||
assertTrue(certificates.containsKey(GOOGLE_CLOUD_KEY_VAULT_SERVICE_V1_ALIAS));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user