Skip to content

fix: use canonical RSA-OAEP JWK alg for SHA-1 - #337

Merged
HamdaanAliQuatil merged 1 commit into
google:masterfrom
mfazrinizar:fix/rsa-oaep-sha1-jwk-alg
Jul 24, 2026
Merged

fix: use canonical RSA-OAEP JWK alg for SHA-1#337
HamdaanAliQuatil merged 1 commit into
google:masterfrom
mfazrinizar:fix/rsa-oaep-sha1-jwk-alg

Conversation

@mfazrinizar

Copy link
Copy Markdown
Contributor

Summary

Uses the canonical RSA-OAEP JWK alg identifier for RSA-OAEP with SHA-1 while preserving compatibility with JWKs exported by older FFI releases.

This PR:

  • changes FFI SHA-1 RSA-OAEP exports from RSA-OAEP-1 to RSA-OAEP
  • imports canonical RSA-OAEP private and public JWKs with SHA-1
  • accepts the historical RSA-OAEP-1 value only when importing with SHA-1
  • rejects RSA-OAEP-1 when importing with SHA-256, SHA-384, or SHA-512
  • avoids mutating caller-provided JWK maps
  • adds reusable public API regression coverage across native and browser backends

Testing

  • dart format --output=none --set-exit-if-changed .
  • dart analyze
  • dart test test/webcrypto_test.dart -p vm -n RSA-OAEP
  • dart test test/webcrypto_test.dart -p chrome -c dart2js -n RSA-OAEP
  • dart test test/webcrypto_test.dart -p chrome -c dart2wasm -n RSA-OAEP
  • dart test test/webcrypto_test.dart -p vm
  • dart test test/webcrypto_test.dart -p chrome -c dart2js
  • dart test test/webcrypto_test.dart -p chrome -c dart2wasm

@mfazrinizar
mfazrinizar marked this pull request as ready for review July 23, 2026 14:35
@HamdaanAliQuatil
HamdaanAliQuatil merged commit 8a84b9b into google:master Jul 24, 2026
15 checks passed
HamdaanAliQuatil added a commit that referenced this pull request Jul 24, 2026
* Move Flutter demo app into example/webcrypto_demo_flutter_app/ (#284)

* refactor: move Flutter demo app into example/webcrypto_demo_flutter_app/ (#283)

* chore: fix references to the relocated example app (#283)

* chore: ignore unknown dartdoc example directive (#294)

* refactor: replace runtime symbol lookup with direct FFI  bindings (#279)

* refactor: replace runtime symbol lookup with direct FFI  bindings

* refactor: replace runtime symbol lookup with direct FFI
  bindings

* refactor: generate direct FFI bindings with ffigen

* refactor: remove stale symbol table files

* refactor: use Native.addressOf for EVP_PKEY finalizer

* Reject imported EC and RSA keys with trailing bytes (#251)

* Reject imported EC and RSA keys with trailing bytes

* Add regression tests for issue 60 (trailing bytes in key imports)

* Finalize regression tests for issue 60: hardcoded keys and browser compatibility

* Update lib/src/testing/regression/issue_60_trailing_bytes.dart

Co-authored-by: Jonas Finnemann Jensen <jopsen@gmail.com>

* Update lib/src/testing/regression/issue_60_trailing_bytes.dart

Co-authored-by: Jonas Finnemann Jensen <jopsen@gmail.com>

* Fix trailing bytes regression fixture

* Minimize trailing bytes fixture diff

* Fix trailing bytes regression on web wasm

* fix: FFI key import memory leaks and make trailing bytes tests

---------

Co-authored-by: Jonas Finnemann Jensen <jopsen@gmail.com>

* ci: add FFI memory-safety test lane (#295)

* ci: add FFI memory-safety test lane

* test: separate Valgrind runner from FFI workload

* ci: run Valgrind in existing Linux job

* refactor(js): fix JSDomException checks for wasm compatibility (#306)

* refactor(js): fix JSDomException checks for wasm compatibility

Resolve invalid_runtime_check_with_js_interop_types warnings for JSDomException.

Instead of directly catching the extension type JSDomException or checking e is JSObject, we catch generic objects, cast them to JSAny?, and check if they are JSDomException instances using isA<subtle.JSDomException>().

This avoids platform-inconsistent runtime checks that behave incorrectly under dart2wasm where extension types are runtime-erased.

* fix libraries

* refactor(js): fix JSDomException type-checking crash under WASM

Resolve _TypeError when casting generic exceptions to JSAny? under dart2wasm.

* fix(testing): wire AES-GCM tagLength vectors (#312)

* Fix AES-CTR large chunk handling (#309)

* fix(aes-ctr): handle partial chunks larger than buffer

* test(aes-ctr): refine large chunk coverage

* fix(derive-bits): support zero-length results (#321)

* docs: update RFC links to use the official RFC editor URLs (#245)

Co-authored-by: Moritz <27859082+mosuem@users.noreply.github.com>

* docs: move HMAC importRawKey example to file (#293)

* chore: mark unsupported code paths with coverage:ignore (#327)

* chore: mark unsupported code paths with coverage:ignore

* test: mark impl_stub as coverage:ignore-file

* test: ignore unreachable curve fallbacks in EC helpers

* docs: correct JWK use value for AES keys (#330)

* correct JWK use value for AES keys

* correct JWK use value for AES keys

* correct JWK use value for AES keys

* Document maximum deriveBits length for ECDH curves (#289)

Updates documentation on EcdhPrivateKey.deriveBits to include
the maximum number of bits that can be derived for each curve:

  * EllipticCurve.p256 — up to 256 bits
  * EllipticCurve.p384 — up to 384 bits
  * EllipticCurve.p521 — up to 528 bits

Also adds test coverage for all three curves at their maximum
derive lengths in the ECDH test runner.

Fixes #130

* Upgrade native_toolchain_cmake to v0.3 (#336)

This new version improves Android SDK detection:
rainyl/native_toolchain_cmake#31

* fix: use canonical RSA-OAEP JWK alg for SHA-1 (#337)

---------

Co-authored-by: Samar Borkar <128998523+Samarborkar@users.noreply.github.com>
Co-authored-by: Musharaf Khan Pathan <135562339+Apple-beep@users.noreply.github.com>
Co-authored-by: HamdaanAliQuatil <96776914+HamdaanAliQuatil@users.noreply.github.com>
Co-authored-by: Harshita Yadav <seemayadavanuj123@gmail.com>
Co-authored-by: Jonas Finnemann Jensen <jopsen@gmail.com>
Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
Co-authored-by: Berkay Çatak <34205493+berkaycatak@users.noreply.github.com>
Co-authored-by: Moritz <27859082+mosuem@users.noreply.github.com>
Co-authored-by: AquibAquil <96966923+AquibAquil@users.noreply.github.com>
Co-authored-by: w1boost1889M <63419938+w1boost1889M@users.noreply.github.com>
Co-authored-by: Syed Moiz Ali <100577359+Syed-Moiz-Ali@users.noreply.github.com>
Co-authored-by: Simon Ser <contact@emersion.fr>
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.

2 participants