move to python-cryptography v1.5

version 1.5 (released nearly 3 years ago, on 2016-08-26) introduced
sign() and verify() for all asymmetric algorithms.

Without this change, with modern versions of python-cryptography, we
see warnings like:

/usr/lib/python3/dist-packages/pgpy/packet/fields.py:1177: CryptographyDeprecationWarning: signer and verifier have been deprecated. Please use sign and verify instead.

The version of python-cryptography in debian stretch (oldstable) is
1.7.1, for point of reference.
This commit is contained in:
Daniel Kahn Gillmor
2019-06-05 16:18:41 -04:00
parent d8adc3287f
commit d281d6ec17
3 changed files with 9 additions and 31 deletions

View File

@@ -137,9 +137,8 @@ def test_reg_bug_56():
sig._signature.hash2 = hashlib.new('sha512', hdata).digest()[:2]
# create the signature
signer = sk.__key__.__privkey__().signer(padding.PKCS1v15(), hashes.SHA512())
signer.update(hdata)
sig._signature.signature.from_signer(signer.finalize())
signature = sk.__key__.__privkey__().sign(hdata, padding.PKCS1v15(), hashes.SHA512())
sig._signature.signature.from_signer(signature)
sig._signature.update_hlen()
# check encoding