diff --git a/securesystemslib/signer/_crypto_signer.py b/securesystemslib/signer/_crypto_signer.py index 4ddef2b4..4bba130c 100644 --- a/securesystemslib/signer/_crypto_signer.py +++ b/securesystemslib/signer/_crypto_signer.py @@ -2,7 +2,7 @@ import logging from dataclasses import astuple, dataclass -from typing import Any, Dict, Optional, Union +from typing import Optional, Union from urllib import parse from securesystemslib.exceptions import UnsupportedLibraryError @@ -189,28 +189,6 @@ def __init__( def public_key(self) -> Key: return self._public_key - @classmethod - def from_securesystemslib_key( - cls, key_dict: Dict[str, Any] - ) -> "CryptoSigner": - """Factory to create CryptoSigner from securesystemslib private key dict.""" - private = key_dict["keyval"]["private"] - public_key = SSlibKey.from_securesystemslib_key(key_dict) - - private_key: PrivateKeyTypes - if public_key.keytype in ["rsa"] + _ECDSA_KEYTYPES: - private_key = load_pem_private_key(private.encode(), password=None) - - elif public_key.keytype == "ed25519": - private_key = Ed25519PrivateKey.from_private_bytes( - bytes.fromhex(private) - ) - - else: - raise ValueError(f"unsupported keytype: {public_key.keytype}") - - return CryptoSigner(private_key, public_key) - @classmethod def from_priv_key_uri( cls, diff --git a/securesystemslib/signer/_key.py b/securesystemslib/signer/_key.py index acbf646b..11ceb3f0 100644 --- a/securesystemslib/signer/_key.py +++ b/securesystemslib/signer/_key.py @@ -198,34 +198,6 @@ def verify_signature(self, signature: Signature, data: bytes) -> None: class SSlibKey(Key): """Key implementation for RSA, Ed25519, ECDSA keys""" - def to_securesystemslib_key(self) -> Dict[str, Any]: - """Internal helper, returns a classic securesystemslib keydict. - - .. deprecated:: 0.28.0 - Please use ``CryptoSigner`` instead of securesystemslib keydicts. - """ - return { - "keyid": self.keyid, - "keytype": self.keytype, - "scheme": self.scheme, - "keyval": self.keyval, - } - - @classmethod - def from_securesystemslib_key(cls, key_dict: Dict[str, Any]) -> "SSlibKey": - """Constructor from classic securesystemslib keydict - - .. deprecated:: 0.28.0 - Please use ``CryptoSigner`` instead of securesystemslib keydicts. - """ - # ensure possible private keys are not included in keyval - return SSlibKey( - key_dict["keyid"], - key_dict["keytype"], - key_dict["scheme"], - {"public": key_dict["keyval"]["public"]}, - ) - @classmethod def from_dict(cls, keyid: str, key_dict: Dict[str, Any]) -> "SSlibKey": keytype, scheme, keyval = cls._from_dict(key_dict)