diff --git a/gimmecert/crypto.py b/gimmecert/crypto.py index 6fab559d2299cd4c928a635e92130c093a3a8576..88862dfb76678da44f42f488fd42904ad2308830 100644 --- a/gimmecert/crypto.py +++ b/gimmecert/crypto.py @@ -460,12 +460,14 @@ def key_specification_from_public_key(public_key): :type public_key: cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey :returns: Key algorithm and parameter(s) for generating same type of keys as the passed-in public key. - :rtype: tuple(str, int) + :rtype: tuple(str, int or cryptography.hazmat.primitives.asymmetric.ec.EllipticCurve) :raises ValueError: If algorithm/parameters could not be derived from the passed-in public key. """ if isinstance(public_key, cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey): return "rsa", public_key.key_size + elif isinstance(public_key, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey): + return "ecdsa", type(public_key.curve) raise ValueError("Unsupported public key instance passed-in: \"%s\" (%s)" % (str(public_key), type(public_key)))