Skip to content

fix(impl_jni): configure RSA-PSS parameters after initialization - #375

Open
mfazrinizar wants to merge 1 commit into
google:android-jca-branchfrom
mfazrinizar:fix/impl-jni-rsapss-parameter-order
Open

fix(impl_jni): configure RSA-PSS parameters after initialization#375
mfazrinizar wants to merge 1 commit into
google:android-jca-branchfrom
mfazrinizar:fix/impl-jni-rsapss-parameter-order

Conversation

@mfazrinizar

Copy link
Copy Markdown
Contributor

Summary

  • Configure PSSParameterSpec after Signature.initSign or Signature.initVerify.
  • Preserve the requested digest, MGF1 digest, salt length, and trailer field.
  • Fix verification of externally generated signatures that use non-default salt lengths on the tested Android provider.

Root Cause

The tested Android JCA provider resets its active RSA-PSS parameters during signature initialization. The previous order configured PSSParameterSpec before initialization, so the provider replaced the requested values with its defaults.

The backend now obtains and initializes Signature before applying the requested parameters. This PR does not change generated bindings or persistent key ownership.

Issue #371 tracks API 24-26 providers that return non-CRT private-key wrappers and block the shared RSA tests before the PSS operation runs.

Testing

Desktop JNI setup, if needed:

  • dart run jni:setup

Verified with:

  • dart format --output=none --set-exit-if-changed lib/src/impl_jni/impl_jni.rsapss.dart
  • git diff --check
  • dart analyze lib/src/impl_jni/impl_jni.rsapss.dart test/impl_jni_rsapss_test.dart
  • dart test test/impl_jni_rsapss_test.dart
  • dart test test/webcrypto_test.dart -p vm -n 'RSA-PSS'
  • flutter test integration_test/webcrypto_test.dart -d emulator-name --name 'RSA-PSS' from example/webcrypto_demo_flutter_app

The focused desktop suite passes 3 cases, the shared desktop RSA-PSS selection passes 366 cases, and the tested Android API 36 x86_64 provider passes all 366 shared RSA-PSS cases. API 24-26 remain blocked by the separate RSA private-key import issue.

Follow-up to #341.

@mfazrinizar
mfazrinizar marked this pull request as ready for review August 23, 2026 18:35
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.

1 participant