-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CryptoSigner: support init from PrivateKeyTypes
Previously CryptoSigner instances could only be created via `from_priv_key_uri` factory method, because: - CryptoSigner was abstract - Subclass implmentations were protected This change makes the CryptoSigner constructor usable directly, so that signers can be created directly from pyca/cryptography private key objects. If a public key is not passed along, it is created from the private key, with default keyid and signing scheme for key type. *Details* Internally, this now (1) uses composition instead of inheritance, and (2) eliminates one level of abstraction: (1) CryptoSigner is no longer an abstract base class for protected rsa, ecdsa and ed25519 "signer" subclasses. It only made creation more difficult, without advantage. Instead CryptoSigner holds references to the "signers" (2) There is no more abstraction over individual pyca/cryptography rsa, ecdsa and ed25519 private key types. cryptography provides a common "PrivateKeyTypes" interface with sign method, which we can use directly. The different additional sign args for the different key types are managed in new internal data classes. Signed-off-by: Lukas Puehringer <[email protected]>
- Loading branch information
Showing
2 changed files
with
136 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters