From b4834ae3fa09e8013f7ab743a12def063ae999e3 Mon Sep 17 00:00:00 2001 From: Alex Klyubin Date: Thu, 2 Apr 2015 15:53:46 -0700 Subject: 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 --- keystore/java/android/security/KeyStoreCipherSpi.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'keystore/java/android/security/KeyStoreCipherSpi.java') diff --git a/keystore/java/android/security/KeyStoreCipherSpi.java b/keystore/java/android/security/KeyStoreCipherSpi.java index afb5e36..ec358d6 100644 --- a/keystore/java/android/security/KeyStoreCipherSpi.java +++ b/keystore/java/android/security/KeyStoreCipherSpi.java @@ -224,7 +224,7 @@ public abstract class KeyStoreCipherSpi extends CipherSpi implements KeyStoreCry if (opResult == null) { throw new KeyStoreConnectException(); } else if (opResult.resultCode != KeyStore.NO_ERROR) { - throw KeymasterUtils.getCryptoOperationException(opResult.resultCode); + throw KeyStore.getCryptoOperationException(opResult.resultCode); } if (opResult.token == null) { @@ -250,8 +250,8 @@ public abstract class KeyStoreCipherSpi extends CipherSpi implements KeyStoreCry byte[] output; try { output = mMainDataStreamer.update(input, inputOffset, inputLen); - } catch (KeymasterException e) { - throw KeymasterUtils.getCryptoOperationException(e); + } catch (KeyStoreException e) { + throw KeyStore.getCryptoOperationException(e); } if (output.length == 0) { @@ -285,7 +285,7 @@ public abstract class KeyStoreCipherSpi extends CipherSpi implements KeyStoreCry byte[] output; try { output = mMainDataStreamer.doFinal(input, inputOffset, inputLen); - } catch (KeymasterException e) { + } catch (KeyStoreException e) { switch (e.getErrorCode()) { case KeymasterDefs.KM_ERROR_INVALID_INPUT_LENGTH: throw new IllegalBlockSizeException(); @@ -294,7 +294,7 @@ public abstract class KeyStoreCipherSpi extends CipherSpi implements KeyStoreCry case KeymasterDefs.KM_ERROR_VERIFICATION_FAILED: throw new AEADBadTagException(); default: - throw KeymasterUtils.getCryptoOperationException(e); + throw KeyStore.getCryptoOperationException(e); } } -- cgit v1.1