Reduce deprecation warnings from cryptography module#445
Open
dkg wants to merge 2 commits intoSecurityInnovation:masterfrom
Open
Reduce deprecation warnings from cryptography module#445dkg wants to merge 2 commits intoSecurityInnovation:masterfrom
dkg wants to merge 2 commits intoSecurityInnovation:masterfrom
Conversation
If someone actually wants to use IDEA, CAST5, or Blowfish, we want to
see the CryptographyDeprecationWarning objects emitted by
cryptography.hazmat.primitives.ciphers. But if we're just looking up
a non-deprecated cipher we should just return it directly.
This avoids the following kinds of warnings:
pgpy/pgpy/constants.py:191: CryptographyDeprecationWarning: IDEA has been deprecated
bs = {SymmetricKeyAlgorithm.IDEA: algorithms.IDEA,
pgpy/pgpy/constants.py:193: CryptographyDeprecationWarning: CAST5 has been deprecated
SymmetricKeyAlgorithm.CAST5: algorithms.CAST5,
pgpy/pgpy/constants.py:194: CryptographyDeprecationWarning: Blowfish has been deprecated
SymmetricKeyAlgorithm.Blowfish: algorithms.Blowfish,
…suite Once CAST5 is deprecated, a deprecation warning might arise in addition to the warnings about already-protected secret keys might not be the first warning. Instead, we have the test look through the warnings and validate the content of any matching warning.
995fd58 to
fb885e6
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.
Modern versions of the python
cryptographymodule deprecate IDEA, CAST5, and Blowfish.These changes ensure that the CryptographyDeprecationWarnings will be produced only when handling or producing material that uses one of those algorithms explicitly.