Skip to content

Commit

Permalink
Require cryptography >= 1.0, replace deprecated function
Browse files Browse the repository at this point in the history
The functions `decode_rfc6979_signature` and `encode_rfc6979_signature`
were deprecated in cryptography 1.0:
    https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst#10---2015-08-12
and raise a DeprecationWarning now. The replacements are exactly the same.
  • Loading branch information
bluetech committed Dec 17, 2016
1 parent 7dd3d4a commit aaf2ac3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions jwt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

try:
from cryptography.hazmat.primitives.asymmetric.utils import (
decode_rfc6979_signature, encode_rfc6979_signature
decode_dss_signature, encode_dss_signature
)
except ImportError:
pass
Expand Down Expand Up @@ -95,7 +95,7 @@ def der_to_raw_signature(der_sig, curve):
num_bits = curve.key_size
num_bytes = (num_bits + 7) // 8

r, s = decode_rfc6979_signature(der_sig)
r, s = decode_dss_signature(der_sig)

return number_to_bytes(r, num_bytes) + number_to_bytes(s, num_bytes)

Expand All @@ -110,4 +110,4 @@ def raw_to_der_signature(raw_sig, curve):
r = bytes_to_number(raw_sig[:num_bytes])
s = bytes_to_number(raw_sig[num_bytes:])

return encode_rfc6979_signature(r, s)
return encode_dss_signature(r, s)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_version(package):
tests_require=tests_require,
extras_require=dict(
test=tests_require,
crypto=['cryptography'],
crypto=['cryptography >= 1.0'],
flake8=[
'flake8',
'flake8-import-order',
Expand Down

0 comments on commit aaf2ac3

Please sign in to comment.