Conversation
RSAPrivateKey no longer implements PublicKey. Instead, RSAPublicKey::from(RSAPrivateKey) should be used to obtain a public key.
|
Note that |
|
A subsequent refactor would either modify |
| //! let bits = 2048; | ||
| //! let key = RSAPrivateKey::new(&mut rng, bits).expect("failed to generate a key"); | ||
| //! let private_key = RSAPrivateKey::new(&mut rng, bits).expect("failed to generate a key"); | ||
| //! let public_key = RSAPublicKey::from(private_key.clone()); |
There was a problem hiding this comment.
This should probably work without calling clone, as this means duplicating a bunch of secrets, when we actually only want the public parts
|
Merged in #42 |
This is part of #32, and a precursor for #34.
The new trait structure:
PublicKeyParts- provides access to the modulus, exponent, and size.EncryptionPrimitive- raw RSA encryption, for implementers.DecryptionPrimitive- raw RSA decryption, for implementers.PublicKey: EncryptionPrimitive + PublicKeyParts- the public key API for users. Home toencryptandverifyfunctions.PrivateKey: DecryptionPrimitive + PublicKeyParts- the private key API for users. Will eventually be home todecryptandsignfunctions.