Skip to content

fix: support legacy RSA-* hash name aliases#929

Merged
boorad merged 2 commits intomainfrom
fix/legacy-rsa-hash-aliases
Feb 15, 2026
Merged

fix: support legacy RSA-* hash name aliases#929
boorad merged 2 commits intomainfrom
fix/legacy-rsa-hash-aliases

Conversation

@boorad
Copy link
Collaborator

@boorad boorad commented Feb 15, 2026

Summary

Fixes the Unsupported hash algorithm: RSA-SHA256 error when using legacy OpenSSL algorithm names like RSA-SHA256, RSA-SHA1, etc. These names are accepted by Node.js and commonly used in existing codebases.

Changes

  • Consolidate duplicate getDigestByName: Merged two separate implementations (from SignUtils.hpp and HybridRsaCipher.cpp) into a single shared function in QuickCryptoUtils.hpp
  • Case-insensitive algorithm matching: Uses toLower() normalization so any casing works (RSA-SHA256, rsa-sha256, Rsa-Sha256, etc.)
  • RSA- prefix stripping*: Strips the legacy RSA- prefix before looking up the digest (e.g. RSA-SHA256sha256)
  • RIPEMD-160 support: Added to both C++ digest lookup and TypeScript RSA-* alias mapping
  • Unit tests: Added tests for RSA-* alias normalization in hashnames.test.ts
  • Test optimization: Reduced DH primeLength from 2048 to 512 in generateKeyPair test for faster execution

Testing

  • bun tsc passes
  • bun test passes for new RSA-* alias tests
  • CI will validate native builds

Fixes #909

Strip RSA- prefix in C++ getDigestByName() so createSign('RSA-SHA256')
resolves correctly. Add rsa-sha* aliases in TypeScript hashnames.ts for
createHash() and WebCrypto normalization paths.

Also reduce DH primeLength test from 2048 to 512 to avoid ~39s runtime
on mobile. The modp14 named group test already covers 2048-bit DH.
Consolidate duplicate getDigestByName functions from SignUtils.hpp and
HybridRsaCipher.cpp into a single shared implementation in
QuickCryptoUtils.hpp. The consolidated version uses toLower() for
fully case-insensitive algorithm matching, adds RIPEMD-160 support,
and handles legacy RSA-* prefixes for all hash algorithms.

Also adds ripemd160 to the TypeScript RSA-* alias mapping and unit
tests covering the RSA-* legacy alias normalization.
@boorad boorad self-assigned this Feb 15, 2026
@github-actions
Copy link
Contributor

🤖 End-to-End Test Results - iOS

Status: ✅ Passed
Platform: iOS
Run: 22039073669

📸 Final Test Screenshot

Maestro Test Results - ios

Screenshot automatically captured from End-to-End tests and will expire in 30 days


This comment is automatically updated on each test run.

@github-actions
Copy link
Contributor

🤖 End-to-End Test Results - Android

Status: ✅ Passed
Platform: Android
Run: 22039073671

📸 Final Test Screenshot

Maestro Test Results - android

Screenshot automatically captured from End-to-End tests and will expire in 30 days


This comment is automatically updated on each test run.

@boorad boorad merged commit e4b63a7 into main Feb 15, 2026
7 checks passed
@boorad boorad deleted the fix/legacy-rsa-hash-aliases branch February 15, 2026 16:40
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.

🐛 Error: SignHandle.init(...): Unsupported hash algorithm: RSA-SHA256

1 participant

Comments