From 917feb9f88f761a6d3bca2ae992a68cce99b505d Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Mon, 30 Oct 2023 11:50:26 -0400 Subject: [PATCH] Clarify error messages in Android Keystore Secure Area. (#399) The current text assumes the failure has to do with key purpose, but this is not the case and we're actively running into this error message in the context of brokenness in Android Keystore wrt. Ed25519 and X25519 support. With this fix, it's clear what the error is. Test: Manually test. --- .../android/securearea/AndroidKeystoreSecureArea.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/identity-android/src/main/java/com/android/identity/android/securearea/AndroidKeystoreSecureArea.java b/identity-android/src/main/java/com/android/identity/android/securearea/AndroidKeystoreSecureArea.java index cd24f54b0..e8a9c383a 100644 --- a/identity-android/src/main/java/com/android/identity/android/securearea/AndroidKeystoreSecureArea.java +++ b/identity-android/src/main/java/com/android/identity/android/securearea/AndroidKeystoreSecureArea.java @@ -444,7 +444,7 @@ static String getSignatureAlgorithmName(@Algorithm int signatureAlgorithm) { } throw new IllegalStateException(e.getMessage(), e); } catch (InvalidKeyException e) { - throw new IllegalArgumentException("Key does not have purpose KEY_PURPOSE_SIGN", e); + throw new IllegalArgumentException(e); } } @@ -484,7 +484,7 @@ static String getSignatureAlgorithmName(@Algorithm int signatureAlgorithm) { } throw new IllegalStateException(e.getMessage(), e); } catch (InvalidKeyException e) { - throw new IllegalArgumentException("Key does not have purpose KEY_PURPOSE_AGREE_KEY", e); + throw new IllegalArgumentException(e); } }