Using new "to cryptography" APIs.

pull/181/head
jMyles 2018-03-18 00:42:28 -07:00
parent 3712dde087
commit b4e34c0981
3 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,7 @@ def ecdsa_sign(message: bytes, privkey: UmbralPrivateKey) -> bytes:
:return: signature
"""
cryptography_priv_key = privkey.bn_key.to_cryptography_priv_key()
cryptography_priv_key = privkey.to_cryptography_privkey()
signature_der_bytes = cryptography_priv_key.sign(message, ec.ECDSA(BLAKE2B))
return signature_der_bytes
@ -92,7 +92,7 @@ def ecdsa_verify(
:return: True if valid, False if invalid.
"""
cryptography_pub_key = pubkey.point_key.to_cryptography_pub_key()
cryptography_pub_key = pubkey.to_cryptography_pubkey()
try:
cryptography_pub_key.verify(

View File

@ -113,5 +113,5 @@ class SigningKeypair(Keypair):
def generate_self_signed_cert(self, common_name):
# TODO: Let's have a shortcut method for getting the cryptography key(s).
cryptography_key = self._privkey.bn_key.to_cryptography_priv_key()
cryptography_key = self._privkey.to_cryptography_privkey()
return generate_self_signed_certificate(common_name, default_curve(), cryptography_key)

View File

@ -5,5 +5,5 @@ from nkms.crypto.powers import SigningPower
def test_ursula_generates_self_signed_cert():
ursula = Ursula(attach_server=False)
cert, cert_private_key = ursula.generate_self_signed_certificate()
public_key_numbers = ursula.public_key(SigningPower).point_key.to_cryptography_pub_key().public_numbers()
public_key_numbers = ursula.public_key(SigningPower).to_cryptography_pubkey().public_numbers()
assert cert.public_key().public_numbers() == public_key_numbers