Skip to content

Commit

Permalink
Clarify error messages in Android Keystore Secure Area. (#399)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davidz25 authored Oct 30, 2023
1 parent 1c0d838 commit 917feb9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 917feb9

Please sign in to comment.