Deprecate Diffie-Hellman over finite fields (FFDH)#15171
Open
alex wants to merge 3 commits into
Open
Conversation
Member
Author
|
@gpotter2 We plan to deprecate FFDH (though we do not have a timeline for removal and it's likely to be a while), it looks like the act of emitting the warning causes the scapy tests to fail. Are you able to take a look at that? |
Contributor
|
Hi ! Sure I can take a look. As long as it remains in the decrepit folder it shouldn't be much of an issue on our side.
By removal do you mean entirely or just the move to decrepit ? Have a good sunday |
Member
Author
|
We weren't planning to migrate to decreptic, just deprecate (for a long time) and then remove. Thanks so much for taking a look at this! |
Accessing any of the classes or functions in
cryptography.hazmat.primitives.asymmetric.dh now emits a
CryptographyDeprecationWarning, as does loading a DH key or DH
parameters via load_{pem,der}_{private,public}_key and
load_{pem,der}_parameters. Users should migrate to X25519 or ECDH.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017iUUcywCCXL51sy4WUGqbM
- Shorten the deprecation messages and docs: don't name the warning class, and point users open-endedly at more modern key exchange algorithms such as ML-KEM. - Deprecate load_pem_parameters/load_der_parameters themselves (they can only load FFDH parameters) instead of warning inside the Rust parameter parsing path. - Drop the new deprecation-assertion tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017iUUcywCCXL51sy4WUGqbM
- Don't name a specific replacement algorithm in the deprecation
messages and docs.
- Use pytest.warns() at each load_{pem,der}_parameters callsite in
test_dh.py instead of binding the functions at module scope.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017iUUcywCCXL51sy4WUGqbM
alex
force-pushed
the
claude/deprecate-ffdh-zuly6g
branch
from
July 5, 2026 21:04
f15ce95 to
d403d8f
Compare
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.
Deprecates everything FFDH, per the request:
cryptography.hazmat.primitives.asymmetric.dh(the key/parameters classes, the numbers classes, theWithSerializationaliases, andgenerate_parameters) is deprecated viautils.deprecatedwith a newDeprecatedIn50, so any attribute access warns.load_{pem,der}_{private,public}_key(including PKCS#12 and certificate/CSRpublic_key()for DH SPKIs) emits the same warning from the Rust side, after the key passes validation, so failed loads raise their normal errors without a spurious warning. Non-DH key loads are unaffected.load_pem_parameters/load_der_parameterscan only load FFDH parameters, so the functions themselves are deprecated.types.pyuses private non-warning aliases for the DH entries inPublicKeyTypes/PrivateKeyTypesso thatimport cryptography.x509stays warning-free.test_dh.pyignores the warning module-wide viapytestmark, withpytest.warnsat the parameter-loader callsites; the handful of DH touchpoints intest_serialization.py/test_x509.pyusepytest.warns. The suite runs warning-free... deprecated:: 50.0.0notes in the docs.🤖 Generated with Claude Code
https://claude.ai/code/session_017iUUcywCCXL51sy4WUGqbM
Generated by Claude Code