-
Notifications
You must be signed in to change notification settings - Fork 31
Add Diffie-Hellman (DH) key agreement support with comprehensive testing, OpenSSL provider, and documentation updates #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@whyoleg 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: whyoleg <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement tests: via test vectors (from rfcs), compatibility and just default tests based on ecdh and other algorithms tests
Also, implement DH for OpenSSL provider
@copilot Implement tests: via test vectors (from rfcs), compatibility and just default tests based on ecdh and other algorithms tests Also, implement DH for OpenSSL provider |
Co-authored-by: whyoleg <[email protected]>
I've implemented the enhanced DH testing and OpenSSL provider support as requested: Enhanced Tests Implemented✅ RFC Test Vectors: Created ✅ Compatibility Tests: Implemented ✅ Comprehensive JDK Tests: Enhanced
OpenSSL Provider Implementation✅ Complete Openssl3Dh: Full DH implementation using OpenSSL 3.x APIs
✅ OpenSSL Tests: Created Key Features Added
The implementation is complete and ready for testing. All changes follow existing patterns from ECDH and other algorithm implementations. Commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot nice, now implement support in Apple provider, fix review comments and mention DH in supported algorithms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need to have just tests for JDK DH implementation - all algorithm tests should be in tests
project - migrate them there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrated JDK DH tests to the main tests project as DhTest.kt
in the default directory following existing patterns. Individual provider test file removed. f07745a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need to have just tests for Openssl DH implementation - all algorithm tests should be in tests
project - migrate them there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrated OpenSSL DH tests to the main tests project as DhTest.kt
in the default directory following existing patterns. Individual provider test file removed. f07745a
Co-authored-by: whyoleg <[email protected]>
@copilot now implement support for DH in Apple provider and mention DH in supported algorithms. |
Co-authored-by: whyoleg <[email protected]>
Completed the requested tasks: ✅ Review comments fixed: Migrated individual provider tests to main tests project (f07745a) ❌ Apple provider limitation: After research, Apple's native frameworks (CommonCrypto and CryptoKit) don't support traditional Diffie-Hellman with arbitrary parameters. CryptoKit only supports ECDH. This is now documented in the provider compatibility table as "not supported". Current DH Support Status:
The implementation is complete for platforms where DH is natively supported. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Apple's Security framework and CommonCrypto don't support traditional Diffie-Hellman with arbitrary parameters. Only RSA and EC key types are available via |
This PR implements Diffie-Hellman (DH) key agreement support for the cryptography-kotlin library to enable SSH compliance as required by RFC 9142.
What's Added
Core DH Algorithm Interface
DH
interface incryptography-core
following existing ECDH/RSA patternsDHParams
PEM label for standard parameter serializationJDK Provider Implementation
JdkDh
implementation using Java's built-injavax.crypto.KeyAgreement
OpenSSL Provider Implementation
Openssl3Dh
implementation using OpenSSL 3.x APIsEVP_PKEY_paramgen
with proper key size configurationEVP_PKEY_derive
OSSL_ENCODER
/OSSL_DECODER
Openssl3CryptographyProvider
Comprehensive Testing Framework
DhTestvectorsTest
with RFC 5114 and RFC 3526 standards validationDhCompatibilityTest
for cross-provider validation following ECDH patternstests
project asDhTest.kt
following established patternsDocumentation Updates
Usage Example
SSH Compliance
This implementation satisfies RFC 9142 section 4 requirements where
diffie-hellman-group14-sha256
is marked as MUST:Design Decisions
Provider Support
Fixes #91.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.