• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.security;
18 
19 import android.annotation.IntDef;
20 import android.annotation.Nullable;
21 import android.annotation.TestApi;
22 import android.security.keymaster.KeymasterDefs;
23 import android.system.keystore2.ResponseCode;
24 import android.util.Log;
25 
26 import java.lang.annotation.Retention;
27 import java.lang.annotation.RetentionPolicy;
28 import java.util.HashMap;
29 import java.util.Map;
30 
31 /**
32  * Exception containing information about the failure at the Keystore / KeyMint layer while
33  * generating or using a key.
34  *
35  * The public error codes indicate the cause of the error and the methods indicate whether
36  * it's a system/key issue and whether re-trying the operation (with the same key or a new key)
37  * is likely to succeed.
38  */
39 public class KeyStoreException extends Exception {
40     private static final String TAG = "KeyStoreException";
41 
42     /**
43      * This error code is for mapping errors that the caller will not know about. If the caller is
44      * targeting an API level earlier than the one the error was introduced in, then the error will
45      * be mapped to this one.
46      * In API level 33 no errors map to this error.
47      */
48     public static final int ERROR_OTHER = 1;
49     /**
50      * Indicating the key could not be used because the user needs to authenticate first.
51      * See
52      * {@link android.security.keystore.KeyGenParameterSpec.Builder#setUserAuthenticationRequired(boolean)}.
53      */
54     public static final int ERROR_USER_AUTHENTICATION_REQUIRED = 2;
55     /**
56      * Indicating that {@code load()} has not been called on the Keystore instance, or an attempt
57      * has been made to generate an authorization bound key while the user has not set a lock
58      * screen knowledge factor (LSKF). Instruct the user to set an LSKF and retry.
59      */
60     public static final int ERROR_KEYSTORE_UNINITIALIZED = 3;
61     /**
62      * An internal system error - refer to {@link #isTransientFailure()} to determine whether
63      * re-trying the operation is likely to yield different results.
64      */
65     public static final int ERROR_INTERNAL_SYSTEM_ERROR = 4;
66     /**
67      * The caller has requested key parameters or operation which are only available to system
68      * or privileged apps.
69      */
70     public static final int ERROR_PERMISSION_DENIED = 5;
71     /**
72      * The key the operation refers to doesn't exist.
73      */
74     public static final int ERROR_KEY_DOES_NOT_EXIST = 6;
75     /**
76      * The key is corrupted and could not be recovered.
77      */
78     public static final int ERROR_KEY_CORRUPTED = 7;
79     /**
80      * The error related to inclusion of device identifiers in the attestation record.
81      */
82     public static final int ERROR_ID_ATTESTATION_FAILURE = 8;
83     /**
84      * The attestation challenge specified is too large.
85      */
86     public static final int ERROR_ATTESTATION_CHALLENGE_TOO_LARGE = 9;
87     /**
88      * General error in the KeyMint layer.
89      */
90     public static final int ERROR_KEYMINT_FAILURE = 10;
91     /**
92      * Failure in the Keystore layer.
93      */
94     public static final int ERROR_KEYSTORE_FAILURE = 11;
95     /**
96      * The feature the caller is trying to use is not implemented by the underlying
97      * KeyMint implementation.
98      * This could happen when an unsupported algorithm is requested, or when trying to import
99      * a key in a format other than raw or PKCS#8.
100      */
101     public static final int ERROR_UNIMPLEMENTED = 12;
102     /**
103      * The feature the caller is trying to use is not compatible with the parameters used to
104      * generate the key. For example, trying to use a key generated for a different signature
105      * algorithm, or a digest not specified during key creation.
106      * Another case is the attempt to generate a symmetric AES key and requesting key attestation.
107      */
108     public static final int ERROR_INCORRECT_USAGE = 13;
109     /**
110      * The key is not currently valid: Either at has expired or it will be valid for use in the
111      * future.
112      */
113     public static final int ERROR_KEY_NOT_TEMPORALLY_VALID = 14;
114     /**
115      * The crypto object the caller has been using held a reference to a KeyMint operation that
116      * has been evacuated (likely due to other concurrent operations taking place).
117      * The caller should re-create the crypto object and try again.
118      */
119     public static final int ERROR_KEY_OPERATION_EXPIRED = 15;
120     /**
121      * There are no keys available for attestation.
122      * This error is returned only on devices that rely solely on remotely-provisioned keys (see
123      * <a href=
124      * "https://android-developers.googleblog.com/2022/03/upgrading-android-attestation-remote.html"
125      * >Remote Key Provisioning</a>).
126      *
127      * <p>On such a device, if the caller requests key generation and includes an attestation
128      * challenge (indicating key attestation is required), the error will be returned in one of
129      * the following cases:
130      * <ul>
131      *     <li>The pool of remotely-provisioned keys has been exhausted.</li>
132      *     <li>The device is not registered with the key provisioning server.</li>
133      * </ul>
134      * </p>
135      *
136      * <p>This error is a transient one if the pool of remotely-provisioned keys has been
137      * exhausted. However, if the device is not registered with the server, or the key
138      * provisioning server refuses key issuance, this is a permanent error.</p>
139      */
140     public static final int ERROR_ATTESTATION_KEYS_UNAVAILABLE = 16;
141 
142     /** @hide */
143     @Retention(RetentionPolicy.SOURCE)
144     @IntDef(flag = true, prefix = {"ERROR_"}, value = {
145             ERROR_OTHER,
146             ERROR_USER_AUTHENTICATION_REQUIRED,
147             ERROR_KEYSTORE_UNINITIALIZED,
148             ERROR_INTERNAL_SYSTEM_ERROR,
149             ERROR_PERMISSION_DENIED,
150             ERROR_KEY_DOES_NOT_EXIST,
151             ERROR_KEY_CORRUPTED,
152             ERROR_ID_ATTESTATION_FAILURE,
153             ERROR_ATTESTATION_CHALLENGE_TOO_LARGE,
154             ERROR_KEYMINT_FAILURE,
155             ERROR_KEYSTORE_FAILURE,
156             ERROR_UNIMPLEMENTED,
157             ERROR_INCORRECT_USAGE,
158             ERROR_KEY_NOT_TEMPORALLY_VALID,
159             ERROR_KEY_OPERATION_EXPIRED,
160             ERROR_ATTESTATION_KEYS_UNAVAILABLE
161     })
162     public @interface PublicErrorCode {
163     }
164 
165     /**
166      * Never re-try the operation that led to this error, since it's a permanent error.
167      *
168      * This value is always returned when {@link #isTransientFailure()} is {@code false}.
169      */
170     public static final int RETRY_NEVER = 1;
171     /**
172      * Re-try the operation that led to this error with an exponential back-off delay.
173      * The first delay should be between 5 to 30 seconds, and each subsequent re-try should double
174      * the delay time.
175      *
176      * This value is returned when {@link #isTransientFailure()} is {@code true}.
177      */
178     public static final int RETRY_WITH_EXPONENTIAL_BACKOFF = 2;
179     /**
180      * Re-try the operation that led to this error when the device regains connectivity.
181      * Remote provisioning of keys requires reaching the remote server, and the device is
182      * currently unable to due that due to lack of network connectivity.
183      *
184      * This value is returned when {@link #isTransientFailure()} is {@code true}.
185      */
186     public static final int RETRY_WHEN_CONNECTIVITY_AVAILABLE = 3;
187 
188     /** @hide */
189     @Retention(RetentionPolicy.SOURCE)
190     @IntDef(flag = true, prefix = {"RETRY_"}, value = {
191             RETRY_NEVER,
192             RETRY_WITH_EXPONENTIAL_BACKOFF,
193             RETRY_WHEN_CONNECTIVITY_AVAILABLE,
194     })
195     public @interface RetryPolicy {
196     }
197 
198     // RKP-specific error information.
199     /**
200      * Remote provisioning of attestation keys has completed successfully.
201      * @hide */
202     public static final int RKP_SUCCESS = 0;
203     /**
204      * Remotely-provisioned keys are temporarily unavailable. This could be because of RPC
205      * error when talking to the remote provisioner or keys are being currently fetched and will
206      * be available soon.
207      * @hide */
208     public static final int RKP_TEMPORARILY_UNAVAILABLE = 1;
209     /**
210      * Permanent failure: The RKP server has declined issuance of keys to this device. Either
211      * because the device is not registered with the server or the server considers the device
212      * not to be trustworthy.
213      * @hide */
214     public static final int RKP_SERVER_REFUSED_ISSUANCE = 2;
215     /**
216      * The RKP server is unavailable due to lack of connectivity. The caller should re-try
217      * when the device has connectivity again.
218      * @hide */
219     public static final int RKP_FETCHING_PENDING_CONNECTIVITY = 3;
220 
221     // Constants for encoding information about the error encountered:
222     // Whether the error relates to the system state/implementation as a whole, or a specific key.
223     private static final int IS_SYSTEM_ERROR = 1 << 1;
224     // Whether the error is permanent.
225     private static final int IS_TRANSIENT_ERROR = 1 << 2;
226     // Whether the cause of the error is the user not having authenticated recently.
227     private static final int REQUIRES_USER_AUTHENTICATION = 1 << 3;
228 
229     // The internal error code. NOT to be returned directly to callers or made part of the
230     // public API.
231     private final int mErrorCode;
232     // The Remote Key Provisioning status. Applicable if and only if {@link #mErrorCode} is equal
233     // to {@link ResponseCode.OUT_OF_KEYS}.
234     private final int mRkpStatus;
235 
initializeRkpStatusForRegularErrors(int errorCode)236     private static int initializeRkpStatusForRegularErrors(int errorCode) {
237         // Check if the system code mistakenly called a constructor of KeyStoreException with
238         // the OUT_OF_KEYS error code but without RKP status.
239         if (errorCode == ResponseCode.OUT_OF_KEYS) {
240             Log.e(TAG, "RKP error code without RKP status");
241             // Set RKP status to RKP_SERVER_REFUSED_ISSUANCE so that the caller never retries.
242             return RKP_SERVER_REFUSED_ISSUANCE;
243         } else {
244             return RKP_SUCCESS;
245         }
246     }
247 
248     /**
249      * @hide
250      */
KeyStoreException(int errorCode, @Nullable String message)251     public KeyStoreException(int errorCode, @Nullable String message) {
252         super(message);
253         mErrorCode = errorCode;
254         mRkpStatus = initializeRkpStatusForRegularErrors(errorCode);
255     }
256 
257     /**
258      * @hide
259      */
KeyStoreException(int errorCode, @Nullable String message, @Nullable String keystoreErrorMessage)260     public KeyStoreException(int errorCode, @Nullable String message,
261             @Nullable String keystoreErrorMessage) {
262         super(message + " (internal Keystore code: " + errorCode + " message: "
263                 + keystoreErrorMessage + ")");
264         mErrorCode = errorCode;
265         mRkpStatus = initializeRkpStatusForRegularErrors(errorCode);
266     }
267 
268     /**
269      * @hide
270      */
KeyStoreException(int errorCode, @Nullable String message, int rkpStatus)271     public KeyStoreException(int errorCode, @Nullable String message, int rkpStatus) {
272         super(message);
273         mErrorCode = errorCode;
274         mRkpStatus = rkpStatus;
275         if (mErrorCode != ResponseCode.OUT_OF_KEYS) {
276             Log.e(TAG, "Providing RKP status for error code " + errorCode + " has no effect.");
277         }
278     }
279 
280     /**
281      * Returns the internal error code. Only for use by the platform.
282      *
283      * @hide
284      */
285     @TestApi
getErrorCode()286     public int getErrorCode() {
287         return mErrorCode;
288     }
289 
290     /**
291      * Returns one of the error codes exported by the class.
292      *
293      * @return a public error code, one of the values in {@link PublicErrorCode}.
294      */
295     @PublicErrorCode
getNumericErrorCode()296     public int getNumericErrorCode() {
297         PublicErrorInformation failureInfo = getErrorInformation(mErrorCode);
298         return failureInfo.errorCode;
299     }
300 
301     /**
302      * Returns true if the failure is a transient failure - that is, performing the same operation
303      * again at a late time is likely to succeed.
304      *
305      * If {@link #isSystemError()} returns true, the transient nature of the failure relates to the
306      * device, otherwise relates to the key (so a permanent failure with an existing key likely
307      * requires creating another key to repeat the operation with).
308      */
isTransientFailure()309     public boolean isTransientFailure() {
310         PublicErrorInformation failureInfo = getErrorInformation(mErrorCode);
311         // Special-case handling for RKP failures:
312         if (mRkpStatus != RKP_SUCCESS && mErrorCode == ResponseCode.OUT_OF_KEYS) {
313             switch (mRkpStatus) {
314                 case RKP_TEMPORARILY_UNAVAILABLE:
315                 case RKP_FETCHING_PENDING_CONNECTIVITY:
316                     return true;
317                 case RKP_SERVER_REFUSED_ISSUANCE:
318                 default:
319                     return false;
320             }
321         }
322         return (failureInfo.indicators & IS_TRANSIENT_ERROR) != 0;
323     }
324 
325     /**
326      * Indicates whether the failure is due to the device being locked.
327      *
328      * @return true if the key operation failed because the user has to authenticate
329      * (e.g. by unlocking the device).
330      */
requiresUserAuthentication()331     public boolean requiresUserAuthentication() {
332         PublicErrorInformation failureInfo = getErrorInformation(mErrorCode);
333         return (failureInfo.indicators & REQUIRES_USER_AUTHENTICATION) != 0;
334     }
335 
336     /**
337      * Indicates whether the error related to the Keystore/KeyMint implementation and not
338      * a specific key.
339      *
340      * @return true if the error is related to the system, not the key in use. System
341      * errors indicate a feature isn't working, whereas key-related errors are likely
342      * to succeed with a new key.
343      */
isSystemError()344     public boolean isSystemError() {
345         PublicErrorInformation failureInfo = getErrorInformation(mErrorCode);
346         return (failureInfo.indicators & IS_SYSTEM_ERROR) != 0;
347     }
348 
349     /**
350      * Returns the re-try policy for transient failures. Valid only if
351      * {@link #isTransientFailure()} returns {@code True}.
352      */
353     @RetryPolicy
getRetryPolicy()354     public int getRetryPolicy() {
355         PublicErrorInformation failureInfo = getErrorInformation(mErrorCode);
356         // Special-case handling for RKP failures:
357         if (mRkpStatus != RKP_SUCCESS) {
358             switch (mRkpStatus) {
359                 case RKP_TEMPORARILY_UNAVAILABLE:
360                     return RETRY_WITH_EXPONENTIAL_BACKOFF;
361                 case RKP_FETCHING_PENDING_CONNECTIVITY:
362                     return RETRY_WHEN_CONNECTIVITY_AVAILABLE;
363                 case RKP_SERVER_REFUSED_ISSUANCE:
364                     return RETRY_NEVER;
365                 default:
366                     return (failureInfo.indicators & IS_TRANSIENT_ERROR) != 0
367                             ? RETRY_WITH_EXPONENTIAL_BACKOFF : RETRY_NEVER;
368             }
369         }
370         if ((failureInfo.indicators & IS_TRANSIENT_ERROR) != 0) {
371             return RETRY_WITH_EXPONENTIAL_BACKOFF;
372         } else {
373             return RETRY_NEVER;
374         }
375     }
376 
377     @Override
toString()378     public String toString() {
379         String errorCodes = String.format(" (public error code: %d internal Keystore code: %d)",
380                 getNumericErrorCode(), mErrorCode);
381         return super.toString() + errorCodes;
382     }
383 
getErrorInformation(int internalErrorCode)384     private static PublicErrorInformation getErrorInformation(int internalErrorCode) {
385         PublicErrorInformation errorInfo = sErrorCodeToFailureInfo.get(internalErrorCode);
386         if (errorInfo != null) {
387             return errorInfo;
388         }
389 
390         /**
391          * KeyStore/keymaster exception with positive error codes coming from the KeyStore and
392          * negative ones from keymaster.
393          * This is a safety fall-back: All error codes should be present in the map.
394          */
395         if (internalErrorCode > 0) {
396             return GENERAL_KEYSTORE_ERROR;
397         } else {
398             return GENERAL_KEYMINT_ERROR;
399         }
400     }
401 
402     private static final class PublicErrorInformation {
403         public final int indicators;
404         public final int errorCode;
405 
PublicErrorInformation(int indicators, @PublicErrorCode int errorCode)406         PublicErrorInformation(int indicators, @PublicErrorCode int errorCode) {
407             this.indicators = indicators;
408             this.errorCode = errorCode;
409         }
410     }
411 
412     private static final PublicErrorInformation GENERAL_KEYMINT_ERROR =
413             new PublicErrorInformation(0, ERROR_KEYMINT_FAILURE);
414 
415     private static final PublicErrorInformation GENERAL_KEYSTORE_ERROR =
416             new PublicErrorInformation(0, ERROR_KEYSTORE_FAILURE);
417 
418     private static final PublicErrorInformation KEYMINT_UNIMPLEMENTED_ERROR =
419             new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_UNIMPLEMENTED);
420 
421     private static final PublicErrorInformation KEYMINT_RETRYABLE_ERROR =
422             new PublicErrorInformation(IS_SYSTEM_ERROR | IS_TRANSIENT_ERROR,
423                     ERROR_KEYMINT_FAILURE);
424 
425     private static final PublicErrorInformation KEYMINT_INCORRECT_USAGE_ERROR =
426             new PublicErrorInformation(0, ERROR_INCORRECT_USAGE);
427 
428     private static final PublicErrorInformation KEYMINT_TEMPORAL_VALIDITY_ERROR =
429             new PublicErrorInformation(0, ERROR_KEY_NOT_TEMPORALLY_VALID);
430 
431 
432     private static final Map<Integer, PublicErrorInformation> sErrorCodeToFailureInfo =
433             new HashMap();
434 
435     /**
436      * @hide
437      */
438     @TestApi
hasFailureInfoForError(int internalErrorCode)439     public static boolean hasFailureInfoForError(int internalErrorCode) {
440         return sErrorCodeToFailureInfo.containsKey(internalErrorCode);
441     }
442 
443     static {
444         // KeyMint error codes
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_OK, GENERAL_KEYMINT_ERROR)445         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_OK, GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ROOT_OF_TRUST_ALREADY_SET, GENERAL_KEYMINT_ERROR)446         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ROOT_OF_TRUST_ALREADY_SET,
447                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_PURPOSE, KEYMINT_INCORRECT_USAGE_ERROR)448         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_PURPOSE,
449                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_PURPOSE, KEYMINT_INCORRECT_USAGE_ERROR)450         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_PURPOSE,
451                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_ALGORITHM, KEYMINT_UNIMPLEMENTED_ERROR)452         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_ALGORITHM,
453                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_ALGORITHM, KEYMINT_INCORRECT_USAGE_ERROR)454         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_ALGORITHM,
455                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KEY_SIZE, KEYMINT_UNIMPLEMENTED_ERROR)456         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KEY_SIZE,
457                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_BLOCK_MODE, KEYMINT_UNIMPLEMENTED_ERROR)458         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_BLOCK_MODE,
459                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_BLOCK_MODE, KEYMINT_INCORRECT_USAGE_ERROR)460         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_BLOCK_MODE,
461                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_MAC_LENGTH, KEYMINT_UNIMPLEMENTED_ERROR)462         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_MAC_LENGTH,
463                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_PADDING_MODE, KEYMINT_INCORRECT_USAGE_ERROR)464         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_PADDING_MODE,
465                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_PADDING_MODE, KEYMINT_INCORRECT_USAGE_ERROR)466         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_PADDING_MODE,
467                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_DIGEST, KEYMINT_UNIMPLEMENTED_ERROR)468         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_DIGEST,
469                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_DIGEST, KEYMINT_INCORRECT_USAGE_ERROR)470         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_DIGEST,
471                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_EXPIRATION_TIME, KEYMINT_INCORRECT_USAGE_ERROR)472         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_EXPIRATION_TIME,
473                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_USER_ID, GENERAL_KEYMINT_ERROR)474         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_USER_ID,
475                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_AUTHORIZATION_TIMEOUT, KEYMINT_INCORRECT_USAGE_ERROR)476         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_AUTHORIZATION_TIMEOUT,
477                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KEY_FORMAT, KEYMINT_INCORRECT_USAGE_ERROR)478         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KEY_FORMAT,
479                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_KEY_FORMAT, KEYMINT_INCORRECT_USAGE_ERROR)480         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_KEY_FORMAT,
481                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM, KEYMINT_UNIMPLEMENTED_ERROR)482         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM,
483                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KEY_VERIFICATION_ALGORITHM, KEYMINT_UNIMPLEMENTED_ERROR)484         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KEY_VERIFICATION_ALGORITHM,
485                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_INPUT_LENGTH, KEYMINT_INCORRECT_USAGE_ERROR)486         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_INPUT_LENGTH,
487                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_EXPORT_OPTIONS_INVALID, KEYMINT_INCORRECT_USAGE_ERROR)488         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_EXPORT_OPTIONS_INVALID,
489                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_DELEGATION_NOT_ALLOWED, GENERAL_KEYMINT_ERROR)490         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_DELEGATION_NOT_ALLOWED,
491                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_NOT_YET_VALID, KEYMINT_TEMPORAL_VALIDITY_ERROR)492         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_NOT_YET_VALID,
493                 KEYMINT_TEMPORAL_VALIDITY_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_EXPIRED, KEYMINT_TEMPORAL_VALIDITY_ERROR)494         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_EXPIRED,
495                 KEYMINT_TEMPORAL_VALIDITY_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_USER_NOT_AUTHENTICATED, new PublicErrorInformation(REQUIRES_USER_AUTHENTICATION, ERROR_USER_AUTHENTICATION_REQUIRED))496         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_USER_NOT_AUTHENTICATED,
497                 new PublicErrorInformation(REQUIRES_USER_AUTHENTICATION,
498                         ERROR_USER_AUTHENTICATION_REQUIRED));
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_OUTPUT_PARAMETER_NULL, GENERAL_KEYMINT_ERROR)499         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_OUTPUT_PARAMETER_NULL,
500                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_OPERATION_HANDLE, new PublicErrorInformation(IS_SYSTEM_ERROR | IS_TRANSIENT_ERROR, ERROR_KEY_OPERATION_EXPIRED))501         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_OPERATION_HANDLE,
502                 new PublicErrorInformation(IS_SYSTEM_ERROR | IS_TRANSIENT_ERROR,
503                         ERROR_KEY_OPERATION_EXPIRED));
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INSUFFICIENT_BUFFER_SPACE, GENERAL_KEYMINT_ERROR)504         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INSUFFICIENT_BUFFER_SPACE,
505                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_VERIFICATION_FAILED, GENERAL_KEYMINT_ERROR)506         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_VERIFICATION_FAILED,
507                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_TOO_MANY_OPERATIONS, GENERAL_KEYMINT_ERROR)508         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_TOO_MANY_OPERATIONS,
509                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNEXPECTED_NULL_POINTER, GENERAL_KEYMINT_ERROR)510         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNEXPECTED_NULL_POINTER,
511                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_KEY_BLOB, GENERAL_KEYMINT_ERROR)512         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_KEY_BLOB,
513                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORTED_KEY_NOT_ENCRYPTED, KEYMINT_INCORRECT_USAGE_ERROR)514         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORTED_KEY_NOT_ENCRYPTED,
515                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORTED_KEY_DECRYPTION_FAILED, KEYMINT_INCORRECT_USAGE_ERROR)516         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORTED_KEY_DECRYPTION_FAILED,
517                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORTED_KEY_NOT_SIGNED, KEYMINT_INCORRECT_USAGE_ERROR)518         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORTED_KEY_NOT_SIGNED,
519                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORTED_KEY_VERIFICATION_FAILED, KEYMINT_INCORRECT_USAGE_ERROR)520         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORTED_KEY_VERIFICATION_FAILED,
521                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_ARGUMENT, GENERAL_KEYMINT_ERROR)522         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_ARGUMENT,
523                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_TAG, KEYMINT_UNIMPLEMENTED_ERROR)524         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_TAG,
525                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_TAG, KEYMINT_INCORRECT_USAGE_ERROR)526         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_TAG,
527                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MEMORY_ALLOCATION_FAILED, GENERAL_KEYMINT_ERROR)528         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MEMORY_ALLOCATION_FAILED,
529                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORT_PARAMETER_MISMATCH, GENERAL_KEYMINT_ERROR)530         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_IMPORT_PARAMETER_MISMATCH,
531                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_SECURE_HW_ACCESS_DENIED, GENERAL_KEYMINT_ERROR)532         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_SECURE_HW_ACCESS_DENIED,
533                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_OPERATION_CANCELLED, GENERAL_KEYMINT_ERROR)534         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_OPERATION_CANCELLED,
535                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_CONCURRENT_ACCESS_CONFLICT, GENERAL_KEYMINT_ERROR)536         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_CONCURRENT_ACCESS_CONFLICT,
537                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_SECURE_HW_BUSY, KEYMINT_RETRYABLE_ERROR)538         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_SECURE_HW_BUSY,
539                 KEYMINT_RETRYABLE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_SECURE_HW_COMMUNICATION_FAILED, KEYMINT_RETRYABLE_ERROR)540         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_SECURE_HW_COMMUNICATION_FAILED,
541                 KEYMINT_RETRYABLE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_EC_FIELD, KEYMINT_UNIMPLEMENTED_ERROR)542         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_EC_FIELD,
543                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_NONCE, KEYMINT_INCORRECT_USAGE_ERROR)544         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_NONCE,
545                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_NONCE, KEYMINT_INCORRECT_USAGE_ERROR)546         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_NONCE,
547                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_MAC_LENGTH, KEYMINT_INCORRECT_USAGE_ERROR)548         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_MAC_LENGTH,
549                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_RATE_LIMIT_EXCEEDED, KEYMINT_RETRYABLE_ERROR)550         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_RATE_LIMIT_EXCEEDED,
551                 KEYMINT_RETRYABLE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_CALLER_NONCE_PROHIBITED, GENERAL_KEYMINT_ERROR)552         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_CALLER_NONCE_PROHIBITED,
553                 GENERAL_KEYMINT_ERROR);
554         // Error related to MAX_USES_PER_BOOT, restricting the number of uses per boot.
555         // It is not re-tryable.
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_MAX_OPS_EXCEEDED, GENERAL_KEYMINT_ERROR)556         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEY_MAX_OPS_EXCEEDED,
557                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_MAC_LENGTH, KEYMINT_INCORRECT_USAGE_ERROR)558         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_MAC_LENGTH,
559                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_MIN_MAC_LENGTH, KEYMINT_INCORRECT_USAGE_ERROR)560         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_MIN_MAC_LENGTH,
561                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_MIN_MAC_LENGTH, KEYMINT_INCORRECT_USAGE_ERROR)562         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_MIN_MAC_LENGTH,
563                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KDF, KEYMINT_UNIMPLEMENTED_ERROR)564         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_KDF,
565                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_EC_CURVE, KEYMINT_UNIMPLEMENTED_ERROR)566         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_EC_CURVE,
567                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ATTESTATION_CHALLENGE_MISSING, KEYMINT_INCORRECT_USAGE_ERROR)568         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ATTESTATION_CHALLENGE_MISSING,
569                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEYMINT_NOT_CONFIGURED, new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_KEYMINT_FAILURE))570         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_KEYMINT_NOT_CONFIGURED,
571                 new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_KEYMINT_FAILURE));
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ATTESTATION_APPLICATION_ID_MISSING, KEYMINT_RETRYABLE_ERROR)572         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ATTESTATION_APPLICATION_ID_MISSING,
573                 KEYMINT_RETRYABLE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_CANNOT_ATTEST_IDS, new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_ID_ATTESTATION_FAILURE))574         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_CANNOT_ATTEST_IDS,
575                 new PublicErrorInformation(IS_SYSTEM_ERROR,
576                         ERROR_ID_ATTESTATION_FAILURE));
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ROLLBACK_RESISTANCE_UNAVAILABLE, KEYMINT_UNIMPLEMENTED_ERROR)577         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ROLLBACK_RESISTANCE_UNAVAILABLE,
578                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_TYPE_UNAVAILABLE, KEYMINT_UNIMPLEMENTED_ERROR)579         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_TYPE_UNAVAILABLE,
580                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_DEVICE_LOCKED, new PublicErrorInformation(IS_SYSTEM_ERROR | REQUIRES_USER_AUTHENTICATION, ERROR_USER_AUTHENTICATION_REQUIRED))581         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_DEVICE_LOCKED,
582                 new PublicErrorInformation(IS_SYSTEM_ERROR | REQUIRES_USER_AUTHENTICATION,
583                         ERROR_USER_AUTHENTICATION_REQUIRED));
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_STORAGE_KEY_UNSUPPORTED, KEYMINT_UNIMPLEMENTED_ERROR)584         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_STORAGE_KEY_UNSUPPORTED,
585                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_MGF_DIGEST, KEYMINT_INCORRECT_USAGE_ERROR)586         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_MGF_DIGEST,
587                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_MGF_DIGEST, KEYMINT_UNIMPLEMENTED_ERROR)588         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNSUPPORTED_MGF_DIGEST,
589                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_NOT_BEFORE, KEYMINT_INCORRECT_USAGE_ERROR)590         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_NOT_BEFORE,
591                 KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_NOT_AFTER, KEYMINT_INCORRECT_USAGE_ERROR)592         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_NOT_AFTER,
593                 KEYMINT_INCORRECT_USAGE_ERROR);
594         // This should not be exposed to apps as it's handled by Keystore.
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_NOT_YET_AVAILABLE, GENERAL_KEYMINT_ERROR)595         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_NOT_YET_AVAILABLE,
596                 GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNIMPLEMENTED, KEYMINT_UNIMPLEMENTED_ERROR)597         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNIMPLEMENTED,
598                 KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNKNOWN_ERROR, new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_KEYMINT_FAILURE))599         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_UNKNOWN_ERROR,
600                 new PublicErrorInformation(IS_SYSTEM_ERROR,
601                         ERROR_KEYMINT_FAILURE));
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_VERSION_MISMATCH, GENERAL_KEYMINT_ERROR)602         sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_VERSION_MISMATCH, GENERAL_KEYMINT_ERROR);
603 
604         // Keystore error codes
sErrorCodeToFailureInfo.put(ResponseCode.LOCKED, new PublicErrorInformation(REQUIRES_USER_AUTHENTICATION, ERROR_USER_AUTHENTICATION_REQUIRED))605         sErrorCodeToFailureInfo.put(ResponseCode.LOCKED,
606                 new PublicErrorInformation(REQUIRES_USER_AUTHENTICATION,
607                         ERROR_USER_AUTHENTICATION_REQUIRED));
sErrorCodeToFailureInfo.put(ResponseCode.UNINITIALIZED, new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_KEYSTORE_UNINITIALIZED))608         sErrorCodeToFailureInfo.put(ResponseCode.UNINITIALIZED,
609                 new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_KEYSTORE_UNINITIALIZED));
sErrorCodeToFailureInfo.put(ResponseCode.SYSTEM_ERROR, new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_INTERNAL_SYSTEM_ERROR))610         sErrorCodeToFailureInfo.put(ResponseCode.SYSTEM_ERROR,
611                 new PublicErrorInformation(IS_SYSTEM_ERROR,
612                         ERROR_INTERNAL_SYSTEM_ERROR));
sErrorCodeToFailureInfo.put(ResponseCode.PERMISSION_DENIED, new PublicErrorInformation(0, ERROR_PERMISSION_DENIED))613         sErrorCodeToFailureInfo.put(ResponseCode.PERMISSION_DENIED,
614                 new PublicErrorInformation(0, ERROR_PERMISSION_DENIED));
sErrorCodeToFailureInfo.put(ResponseCode.KEY_NOT_FOUND, new PublicErrorInformation(0, ERROR_KEY_DOES_NOT_EXIST))615         sErrorCodeToFailureInfo.put(ResponseCode.KEY_NOT_FOUND,
616                 new PublicErrorInformation(0, ERROR_KEY_DOES_NOT_EXIST));
sErrorCodeToFailureInfo.put(ResponseCode.VALUE_CORRUPTED, new PublicErrorInformation(0, ERROR_KEY_CORRUPTED))617         sErrorCodeToFailureInfo.put(ResponseCode.VALUE_CORRUPTED,
618                 new PublicErrorInformation(0, ERROR_KEY_CORRUPTED));
sErrorCodeToFailureInfo.put(ResponseCode.KEY_PERMANENTLY_INVALIDATED, new PublicErrorInformation(0, ERROR_KEY_DOES_NOT_EXIST))619         sErrorCodeToFailureInfo.put(ResponseCode.KEY_PERMANENTLY_INVALIDATED,
620                 new PublicErrorInformation(0, ERROR_KEY_DOES_NOT_EXIST));
sErrorCodeToFailureInfo.put(ResponseCode.OUT_OF_KEYS, new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_ATTESTATION_KEYS_UNAVAILABLE))621         sErrorCodeToFailureInfo.put(ResponseCode.OUT_OF_KEYS,
622                 new PublicErrorInformation(IS_SYSTEM_ERROR, ERROR_ATTESTATION_KEYS_UNAVAILABLE));
623     }
624 }
625