Skip to content

Commit 198aab7

Browse files
authored
remove CAST5, IDEA, Blowfish, and SEED from cipher module (#12941)
These are still available in the decrepit module.
1 parent 600e300 commit 198aab7

File tree

5 files changed

+8
-150
lines changed

5 files changed

+8
-150
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Changelog
1212
* Removed the deprecated ``get_attribute_for_oid`` method on
1313
:class:`~cryptography.x509.CertificateSigningRequest`. Users should use
1414
:meth:`~cryptography.x509.Attributes.get_attribute_for_oid` instead.
15+
* Removed the deprecated ``CAST5``, ``SEED``, ``IDEA``, and ``Blowfish``
16+
classes from the cipher module. These are still available in
17+
:doc:`/hazmat/decrepit/index`.
1518

1619
.. _v45-0-2:
1720

@@ -188,10 +191,7 @@ Changelog
188191
now emits ASN.1 that more closely follows the recommendations in :rfc:`2315`.
189192
* Added new :doc:`/hazmat/decrepit/index` module which contains outdated and
190193
insecure cryptographic primitives.
191-
:class:`~cryptography.hazmat.primitives.ciphers.algorithms.CAST5`,
192-
:class:`~cryptography.hazmat.primitives.ciphers.algorithms.SEED`,
193-
:class:`~cryptography.hazmat.primitives.ciphers.algorithms.IDEA`, and
194-
:class:`~cryptography.hazmat.primitives.ciphers.algorithms.Blowfish`, which were
194+
``CAST5``, ``SEED``, ``IDEA``, and ``Blowfish``, which were
195195
deprecated in 37.0.0, have been added to this module. They will be removed
196196
from the ``cipher`` module in 45.0.0.
197197
* Moved :class:`~cryptography.hazmat.primitives.ciphers.algorithms.TripleDES`
@@ -792,11 +792,7 @@ Changelog
792792
``pip`` will typically get a wheel and not need Rust installed, but check
793793
:doc:`/installation` for documentation on installing a newer ``rustc`` if
794794
required.
795-
* Deprecated
796-
:class:`~cryptography.hazmat.primitives.ciphers.algorithms.CAST5`,
797-
:class:`~cryptography.hazmat.primitives.ciphers.algorithms.SEED`,
798-
:class:`~cryptography.hazmat.primitives.ciphers.algorithms.IDEA`, and
799-
:class:`~cryptography.hazmat.primitives.ciphers.algorithms.Blowfish` because
795+
* Deprecated ``CAST5``, ``SEED``, ``IDEA``, and ``Blowfish`` because
800796
they are legacy algorithms with extremely low usage. These will be removed
801797
in a future version of ``cryptography``.
802798
* Added limited support for distinguished names containing a bit string.
@@ -2600,8 +2596,7 @@ Changelog
26002596
to :class:`~cryptography.hazmat.primitives.asymmetric.padding.PSS`. It will
26012597
be removed from ``MGF1`` in two releases per our :doc:`/api-stability`
26022598
policy.
2603-
* Added :class:`~cryptography.hazmat.primitives.ciphers.algorithms.SEED`
2604-
support.
2599+
* Added ``SEED`` support.
26052600
* Added :class:`~cryptography.hazmat.primitives.cmac.CMAC`.
26062601
* Added decryption support to
26072602
:class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey`
@@ -2620,8 +2615,7 @@ Changelog
26202615

26212616
* Added :class:`~cryptography.hazmat.primitives.twofactor.hotp.HOTP`.
26222617
* Added :class:`~cryptography.hazmat.primitives.twofactor.totp.TOTP`.
2623-
* Added :class:`~cryptography.hazmat.primitives.ciphers.algorithms.IDEA`
2624-
support.
2618+
* Added ``IDEA`` support.
26252619
* Added signature support to
26262620
:class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey`
26272621
and verification support to
@@ -2663,8 +2657,7 @@ Changelog
26632657
* Added :class:`~cryptography.hazmat.primitives.kdf.hkdf.HKDF`.
26642658
* Added ``multibackend``.
26652659
* Set default random for ``openssl`` to the OS random engine.
2666-
* Added :class:`~cryptography.hazmat.primitives.ciphers.algorithms.CAST5`
2667-
(CAST-128) support.
2660+
* Added ``CAST5`` (CAST-128) support.
26682661

26692662

26702663
.. _v0-1:

docs/hazmat/primitives/symmetric-encryption.rst

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -208,43 +208,6 @@ Algorithms
208208
to produce the full key.
209209
:type key: :term:`bytes-like`
210210

211-
.. class:: CAST5(key)
212-
213-
.. versionadded:: 0.2
214-
215-
.. warning::
216-
217-
This algorithm has been deprecated and moved to the :doc:`/hazmat/decrepit/index`
218-
module. If you need to continue using it then update your code to
219-
use the new module path. It will be removed from this namespace in 45.0.0.
220-
221-
CAST5 (also known as CAST-128) is a block cipher approved for use in the
222-
Canadian government by the `Communications Security Establishment`_. It is
223-
a variable key length cipher and supports keys from 40-128 :term:`bits` in
224-
length.
225-
226-
:param key: The secret key, This must be kept secret. 40 to 128
227-
:term:`bits` in length in increments of 8 bits.
228-
:type key: :term:`bytes-like`
229-
230-
.. class:: SEED(key)
231-
232-
.. versionadded:: 0.4
233-
234-
.. warning::
235-
236-
This algorithm has been deprecated and moved to the :doc:`/hazmat/decrepit/index`
237-
module. If you need to continue using it then update your code to
238-
use the new module path. It will be removed from this namespace in 45.0.0.
239-
240-
SEED is a block cipher developed by the Korea Information Security Agency
241-
(KISA). It is defined in :rfc:`4269` and is used broadly throughout South
242-
Korean industry, but rarely found elsewhere.
243-
244-
:param key: The secret key. This must be kept secret. ``128``
245-
:term:`bits` in length.
246-
:type key: :term:`bytes-like`
247-
248211
.. class:: SM4(key)
249212

250213
.. versionadded:: 35.0.0
@@ -269,22 +232,6 @@ Weak ciphers
269232
applications should avoid their use and existing applications should
270233
strongly consider migrating away.
271234

272-
.. class:: Blowfish(key)
273-
274-
.. warning::
275-
276-
This algorithm has been deprecated and moved to the :doc:`/hazmat/decrepit/index`
277-
module. If you need to continue using it then update your code to
278-
use the new module path. It will be removed from this namespace in 45.0.0.
279-
280-
Blowfish is a block cipher developed by Bruce Schneier. It is known to be
281-
susceptible to attacks when using weak keys. The author has recommended
282-
that users of Blowfish move to newer algorithms such as :class:`AES`.
283-
284-
:param key: The secret key. This must be kept secret. 32 to 448
285-
:term:`bits` in length in increments of 8 bits.
286-
:type key: :term:`bytes-like`
287-
288235
.. class:: ARC4(key)
289236

290237
.. warning::
@@ -313,24 +260,6 @@ Weak ciphers
313260
>>> decryptor.update(ct)
314261
b'a secret message'
315262

316-
.. class:: IDEA(key)
317-
318-
.. warning::
319-
320-
This algorithm has been deprecated and moved to the :doc:`/hazmat/decrepit/index`
321-
module. If you need to continue using it then update your code to
322-
use the new module path. It will be removed from this namespace in 45.0.0.
323-
324-
IDEA (`International Data Encryption Algorithm`_) is a block cipher created
325-
in 1991. It is an optional component of the `OpenPGP`_ standard. This cipher
326-
is susceptible to attacks when using weak keys. It is recommended that you
327-
do not use this cipher for new applications.
328-
329-
:param key: The secret key. This must be kept secret. ``128``
330-
:term:`bits` in length.
331-
:type key: :term:`bytes-like`
332-
333-
334263
.. _symmetric-encryption-modes:
335264

336265
Modes

src/cryptography/hazmat/primitives/ciphers/algorithms.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -100,53 +100,6 @@ def key_size(self) -> int:
100100
name="TripleDES",
101101
)
102102

103-
utils.deprecated(
104-
Blowfish,
105-
__name__,
106-
"Blowfish has been moved to "
107-
"cryptography.hazmat.decrepit.ciphers.algorithms.Blowfish and "
108-
"will be removed from "
109-
"cryptography.hazmat.primitives.ciphers.algorithms in 45.0.0.",
110-
utils.DeprecatedIn37,
111-
name="Blowfish",
112-
)
113-
114-
115-
utils.deprecated(
116-
CAST5,
117-
__name__,
118-
"CAST5 has been moved to "
119-
"cryptography.hazmat.decrepit.ciphers.algorithms.CAST5 and "
120-
"will be removed from "
121-
"cryptography.hazmat.primitives.ciphers.algorithms in 45.0.0.",
122-
utils.DeprecatedIn37,
123-
name="CAST5",
124-
)
125-
126-
127-
utils.deprecated(
128-
IDEA,
129-
__name__,
130-
"IDEA has been moved to "
131-
"cryptography.hazmat.decrepit.ciphers.algorithms.IDEA and "
132-
"will be removed from "
133-
"cryptography.hazmat.primitives.ciphers.algorithms in 45.0.0.",
134-
utils.DeprecatedIn37,
135-
name="IDEA",
136-
)
137-
138-
139-
utils.deprecated(
140-
SEED,
141-
__name__,
142-
"SEED has been moved to "
143-
"cryptography.hazmat.decrepit.ciphers.algorithms.SEED and "
144-
"will be removed from "
145-
"cryptography.hazmat.primitives.ciphers.algorithms in 45.0.0.",
146-
utils.DeprecatedIn37,
147-
name="SEED",
148-
)
149-
150103

151104
class ChaCha20(CipherAlgorithm):
152105
name = "ChaCha20"

src/cryptography/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class CryptographyDeprecationWarning(UserWarning):
2222
# ubiquity of their use. They should not be removed until we agree on when that
2323
# cycle ends.
2424
DeprecatedIn36 = CryptographyDeprecationWarning
25-
DeprecatedIn37 = CryptographyDeprecationWarning
2625
DeprecatedIn40 = CryptographyDeprecationWarning
2726
DeprecatedIn41 = CryptographyDeprecationWarning
2827
DeprecatedIn42 = CryptographyDeprecationWarning

tests/hazmat/primitives/test_ciphers.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,6 @@
2323

2424

2525
def test_deprecated_ciphers_import_with_warning():
26-
with pytest.warns(utils.CryptographyDeprecationWarning):
27-
from cryptography.hazmat.primitives.ciphers.algorithms import (
28-
Blowfish, # noqa: F401
29-
)
30-
with pytest.warns(utils.CryptographyDeprecationWarning):
31-
from cryptography.hazmat.primitives.ciphers.algorithms import (
32-
CAST5, # noqa: F401
33-
)
34-
with pytest.warns(utils.CryptographyDeprecationWarning):
35-
from cryptography.hazmat.primitives.ciphers.algorithms import (
36-
IDEA, # noqa: F401
37-
)
38-
with pytest.warns(utils.CryptographyDeprecationWarning):
39-
from cryptography.hazmat.primitives.ciphers.algorithms import (
40-
SEED, # noqa: F401
41-
)
4226
with pytest.warns(utils.CryptographyDeprecationWarning):
4327
from cryptography.hazmat.primitives.ciphers.algorithms import (
4428
ARC4, # noqa: F401

0 commit comments

Comments
 (0)