Skip to content

Conversation

@alex
Copy link
Member

@alex alex commented Nov 26, 2025

TripleDES now only accepts 24-byte (192-bit) keys. Users needing single DES (1-key) or two-key Triple DES compatibility must expand the key themselves:

  • Single DES (8 bytes): key + key + key
  • Two-key 3DES (16 bytes): key + key[:8]

This change removes the automatic key expansion that was previously done in the TripleDES constructor, making the key length requirement explicit and preventing accidental use of weaker key configurations.

TripleDES now emits a deprecation warning when 8-byte (single DES) or
16-byte (two-key) keys are passed. In a future release, only 24-byte
(192-bit) keys will be accepted.

Users needing single DES or two-key Triple DES compatibility should
expand the key themselves:
- Single DES (8 bytes): key + key + key
- Two-key 3DES (16 bytes): key + key[:8]
@alex alex force-pushed the claude/enforce-tripledes-key-length-016zncCxwMyqoMNViGQ3a9JQ branch from f0177b0 to 1937220 Compare November 26, 2025 15:06
@reaperhulk
Copy link
Member

Have we tagged our downstreams to let them know about this?

@alex
Copy link
Member Author

alex commented Nov 30, 2025

No, I was going to let the warning play that role. (Since this is a warning and not an immediate breakage.)

@alex
Copy link
Member Author

alex commented Nov 30, 2025

FYI @glyph, @gpotter2 -- this appears to trigger warnings in twisted and scapy.

For twisted I think there's some tests that just use a short key for no reason. For scapy I think there's code that really does want Single DES (in which case this behavior can be obtained by concatting the key 3x).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants