summaryrefslogtreecommitdiff
path: root/core/java/android/security
diff options
context:
space:
mode:
authorAseem Kumar <aseemk@google.com>2018-04-03 11:35:51 -0700
committerAseem Kumar <aseemk@google.com>2018-04-03 12:15:11 -0700
commit23174b7eaeb93918451c36bbbfad94bafd44bdd6 (patch)
tree599799ad4b2ff018844a15dfe8884a53cbd3e810 /core/java/android/security
parent6ae58e0d161b7250c1223f0a263d1871304044f4 (diff)
Throw ServiceSpecificException if calling app tries to initialize
certificates with lower version. Earlier, the code just returned silently, giving no indication that updating certs failed. Change-Id: I3eb1b9f423791a655b47b3e76c20a170e2b632c0 Bug: 77533356 Test: runtest frameworks-services -p com.android.server.locksettings.recoverablekeystore
Diffstat (limited to 'core/java/android/security')
-rw-r--r--core/java/android/security/keystore/recovery/RecoveryController.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/security/keystore/recovery/RecoveryController.java b/core/java/android/security/keystore/recovery/RecoveryController.java
index 281822a342f9..f351c5afa579 100644
--- a/core/java/android/security/keystore/recovery/RecoveryController.java
+++ b/core/java/android/security/keystore/recovery/RecoveryController.java
@@ -250,6 +250,16 @@ public class RecoveryController {
*/
public static final int ERROR_INVALID_CERTIFICATE = 28;
+
+ /**
+ * Failed because the provided certificate contained serial version which is lower that the
+ * version device is already initialized with. It is not possible to downgrade serial version of
+ * the provided certificate.
+ *
+ * @hide
+ */
+ public static final int ERROR_DOWNGRADE_CERTIFICATE = 29;
+
private final ILockSettings mBinder;
private final KeyStore mKeyStore;
@@ -340,6 +350,10 @@ public class RecoveryController {
|| e.errorCode == ERROR_INVALID_CERTIFICATE) {
throw new CertificateException("Invalid certificate for recovery service", e);
}
+ if (e.errorCode == ERROR_DOWNGRADE_CERTIFICATE) {
+ throw new CertificateException(
+ "Downgrading certificate serial version isn't supported.", e);
+ }
throw wrapUnexpectedServiceSpecificException(e);
}
}