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 --- .../java/android/security/KeyStoreException.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 keystore/java/android/security/KeyStoreException.java (limited to 'keystore/java/android/security/KeyStoreException.java') diff --git a/keystore/java/android/security/KeyStoreException.java b/keystore/java/android/security/KeyStoreException.java new file mode 100644 index 0000000..88e768c --- /dev/null +++ b/keystore/java/android/security/KeyStoreException.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.security; + +/** + * KeyStore/keymaster exception with positive error codes coming from the KeyStore and negative + * ones from keymaster. + * + * @hide + */ +public class KeyStoreException extends Exception { + + private final int mErrorCode; + + public KeyStoreException(int errorCode, String message) { + super(message); + mErrorCode = errorCode; + } + + public int getErrorCode() { + return mErrorCode; + } +} -- cgit v1.1