fix: support legacy RSA-* hash name aliases#929
Merged
Conversation
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.
Contributor
🤖 End-to-End Test Results - iOSStatus: ✅ Passed 📸 Final Test ScreenshotScreenshot automatically captured from End-to-End tests and will expire in 30 days This comment is automatically updated on each test run. |
Contributor
🤖 End-to-End Test Results - AndroidStatus: ✅ Passed 📸 Final Test ScreenshotScreenshot automatically captured from End-to-End tests and will expire in 30 days This comment is automatically updated on each test run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Fixes the
Unsupported hash algorithm: RSA-SHA256error when using legacy OpenSSL algorithm names likeRSA-SHA256,RSA-SHA1, etc. These names are accepted by Node.js and commonly used in existing codebases.Changes
getDigestByName: Merged two separate implementations (fromSignUtils.hppandHybridRsaCipher.cpp) into a single shared function inQuickCryptoUtils.hpptoLower()normalization so any casing works (RSA-SHA256,rsa-sha256,Rsa-Sha256, etc.)RSA-prefix before looking up the digest (e.g.RSA-SHA256→sha256)hashnames.test.tsprimeLengthfrom 2048 to 512 in generateKeyPair test for faster executionTesting
bun tscpassesbun testpasses for new RSA-* alias testsFixes #909