feat: implement generateKeyPair DSA and DH key types#925
Merged
Conversation
Add DSA and DH support to crypto.generateKeyPair() and crypto.generateKeyPairSync(), completing all 9 key types. DSA: EVP paramgen with modulusLength + optional divisorLength, then keygen. Keys exported as SPKI/PKCS8 DER. DH: Three modes — custom prime (binary ArrayBuffer), random prime (primeLength + generator), or named group (resolved in TS from dh-groups.ts). Uses deprecated DH_* APIs matching Node.js ncrypto. New Nitro specs, C++ implementations, TS wrappers, dispatcher wiring, 10 tests, and coverage doc updated (generateKeyPair 🚧→✅).
- Convert HybridDsaKeyPair from raw EVP_PKEY* to RAII unique_ptr - Remove dead setGroupName/groupName_ from DH Nitro spec and C++ - Replace duplicate DH test with primeLength coverage - Simplify always-true ternaries in DSA/DH format helpers - Delegate DSA modulusLength validation to OpenSSL
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
Adds DSA and DH key type support to
crypto.generateKeyPair()andcrypto.generateKeyPairSync(), completing all key types for these APIs.Changes
HybridDsaKeyPairNitro Module with OpenSSL EVP paramgen/keygen flow, supportingmodulusLengthand optionaldivisorLengthHybridDhKeyPairNitro Module supporting named groups (resolved to primes on JS side viadh-groups.ts), custom primes, andprimeLength-based generationdsa.tsanddhKeyPair.tswith format helpers wired into the existinggenerateKeyPairdispatchergenerateKeyPair/generateKeyPairSyncnow ✅ for all key types; also markedgenerateKeySyncas ✅Code Quality
unique_ptrin both DSA and DH)setGroupNamefrom DH Nitro spec since JS resolves named groups)