Skip to content

Commit

Permalink
fix: use 'int.to_bytes' rather than deprecated crypto wrapper (#848)
Browse files Browse the repository at this point in the history
Follow-on to #773, #846.
  • Loading branch information
tseaver committed Aug 23, 2021
1 parent 466aed9 commit b79b554
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions google/auth/crypt/es256.py
Expand Up @@ -15,7 +15,6 @@
"""ECDSA (ES256) verifier and signer that use the ``cryptography`` library.
"""

from cryptography import utils
import cryptography.exceptions
from cryptography.hazmat import backends
from cryptography.hazmat.primitives import hashes
Expand Down Expand Up @@ -121,7 +120,7 @@ def sign(self, message):

# Convert ASN1 encoded signature to (r||s) raw signature.
(r, s) = decode_dss_signature(asn1_signature)
return utils.int_to_bytes(r, 32) + utils.int_to_bytes(s, 32)
return r.to_bytes(32, byteorder="big") + s.to_bytes(32, byteorder="big")

@classmethod
def from_string(cls, key, key_id=None):
Expand Down

0 comments on commit b79b554

Please sign in to comment.