diff options
| author | Alex Klyubin <klyubin@google.com> | 2015-04-02 15:53:46 -0700 |
|---|---|---|
| committer | Alex Klyubin <klyubin@google.com> | 2015-04-02 15:57:27 -0700 |
| commit | b4834ae3fa09e8013f7ab743a12def063ae999e3 (patch) | |
| tree | d9985a4927997a3fd00f25132a4f5579aec39272 /keystore/java/android/security/KeymasterUtils.java | |
| parent | 3cc9e5d68d89ea1ffa79ad6981585bc46362c4a7 (diff) | |
| download | frameworks_base-b4834ae3fa09e8013f7ab743a12def063ae999e3.zip frameworks_base-b4834ae3fa09e8013f7ab743a12def063ae999e3.tar.gz frameworks_base-b4834ae3fa09e8013f7ab743a12def063ae999e3.tar.bz2 | |
Rename KeymasterException to KeyStoreException.
The code in question talks to KeyStore which returns error codes
which are a mix of keystore and keymaster error codes. To better
match the layering of KeyStore on top of keystore and keymaster,
this CL renames KeymasterException into KeyStoreException. It also
adds human-readable error messages to exceptions raised by keystore
rather than keymaster (e.g., key not found).
Bug: 18088752
Change-Id: I4cd1235e16518c9f2e8c5557a457774c6e687b88
Diffstat (limited to 'keystore/java/android/security/KeymasterUtils.java')
| -rw-r--r-- | keystore/java/android/security/KeymasterUtils.java | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/keystore/java/android/security/KeymasterUtils.java b/keystore/java/android/security/KeymasterUtils.java index c426a34..3143d4d 100644 --- a/keystore/java/android/security/KeymasterUtils.java +++ b/keystore/java/android/security/KeymasterUtils.java @@ -17,7 +17,6 @@ package android.security; import android.security.keymaster.KeyCharacteristics; -import android.security.keymaster.KeymasterDefs; import java.util.ArrayList; import java.util.Date; @@ -29,36 +28,6 @@ import java.util.List; public abstract class KeymasterUtils { private KeymasterUtils() {} - public static KeymasterException getKeymasterException(int keymasterErrorCode) { - switch (keymasterErrorCode) { - case KeymasterDefs.KM_ERROR_INVALID_AUTHORIZATION_TIMEOUT: - // The name of this parameter significantly differs between Keymaster and framework - // APIs. Use the framework wording to make life easier for developers. - return new KeymasterException(keymasterErrorCode, - "Invalid user authentication validity duration"); - default: - return new KeymasterException(keymasterErrorCode, - KeymasterDefs.getErrorMessage(keymasterErrorCode)); - } - } - - public static CryptoOperationException getCryptoOperationException(KeymasterException e) { - switch (e.getErrorCode()) { - case KeymasterDefs.KM_ERROR_KEY_EXPIRED: - return new KeyExpiredException(); - case KeymasterDefs.KM_ERROR_KEY_NOT_YET_VALID: - return new KeyNotYetValidException(); - case KeymasterDefs.KM_ERROR_KEY_USER_NOT_AUTHENTICATED: - return new UserNotAuthenticatedException(); - default: - return new CryptoOperationException("Crypto operation failed", e); - } - } - - public static CryptoOperationException getCryptoOperationException(int keymasterErrorCode) { - return getCryptoOperationException(getKeymasterException(keymasterErrorCode)); - } - public static Integer getInt(KeyCharacteristics keyCharacteristics, int tag) { if (keyCharacteristics.hwEnforced.containsTag(tag)) { return keyCharacteristics.hwEnforced.getInt(tag, -1); |
