File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ Changelog
1010
1111* Added :meth: `~cryptography.fernet.Fernet.extract_timestamp ` to get the
1212 authenticated timestamp of a :doc: `Fernet </fernet >` token.
13+ * Support for Python 2.7.x without ``hmac.compare_digest `` has been deprecated.
14+ We will require Python 2.7.7 or higher (or 2.7.6 on Ubuntu) in the next
15+ ``cryptography `` release.
1316
1417.. _v2-2-2 :
1518
Original file line number Diff line number Diff line change 55from __future__ import absolute_import , division , print_function
66
77import hmac
8+ import warnings
89
10+ from cryptography import utils
911from cryptography .hazmat .bindings ._constant_time import lib
1012
1113
@@ -17,6 +19,12 @@ def bytes_eq(a, b):
1719 return hmac .compare_digest (a , b )
1820
1921else :
22+ warnings .warn (
23+ "Support for your Python version is deprecated. The next version of "
24+ "cryptography will remove support. Please upgrade to a 2.7.x "
25+ "release that supports hmac.compare_digest as soon as possible." ,
26+ utils .DeprecatedIn23 ,
27+ )
2028 def bytes_eq (a , b ):
2129 if not isinstance (a , bytes ) or not isinstance (b , bytes ):
2230 raise TypeError ("a and b must be bytes." )
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ class CryptographyDeprecationWarning(UserWarning):
2222# cycle ends.
2323PersistentlyDeprecated = CryptographyDeprecationWarning
2424DeprecatedIn21 = CryptographyDeprecationWarning
25+ DeprecatedIn23 = CryptographyDeprecationWarning
2526
2627
2728def _check_bytes (name , value ):
You can’t perform that action at this time.
0 commit comments