Skip to content

Fix rich consent signing with Android Keystore keys - #150

Closed
lucas-heidihealth wants to merge 1 commit into
auth0:masterfrom
lucas-heidihealth:fix/android-keystore-rich-consent-signing
Closed

Fix rich consent signing with Android Keystore keys#150
lucas-heidihealth wants to merge 1 commit into
auth0:masterfrom
lucas-heidihealth:fix/android-keystore-rich-consent-signing

Conversation

@lucas-heidihealth

Copy link
Copy Markdown

Summary

  • Fix rich-consent DPoP signing for Android Keystore-backed RSA keys.
  • Use JCA Signature with the existing PrivateKey abstraction instead of casting to RSAPrivateKey.

Root cause

RichConsentsAPIClient casts the enrollment PrivateKey to RSAPrivateKey before signing. Android Keystore provides AndroidKeyStoreRSAPrivateKey, which can sign through Signature but does not implement java.security.interfaces.RSAPrivateKey. This causes Guardian.fetchConsent to crash before the request is sent.

This is the same failure reported in #149.

Verification

ANDROID_HOME=/Users/lucas/Library/Android/sdk ./gradlew :guardian:testDebugUnitTest
BUILD SUCCESSFUL

The existing rich-consent client tests pass, and the signing implementation now follows the same SHA256withRSA/PrivateKey approach already used by the SDK's allow/reject request path.

@ionutmanolache-okta
ionutmanolache-okta marked this pull request as ready for review August 26, 2026 17:01

@cgcladeraokta cgcladeraokta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tests well 👍

@anirudh3997

Copy link
Copy Markdown
Contributor

Merged the changes in #151 as Signatures in this commit and not verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants