Implement Keypair trait for the RSA keys
This is rather intrusive implementation. It reworks the way RsaPrivateKey is organized. Unfortunately it also meant that default Serialize an Deserilialize derivations provide a list of tokens that are not backwards-compatible. Thus I had to implement those traits manually.
@lumag I'm confused why you need to change RsaPublicKey/RsaPrivateKey at all
@lumag I'm confused why you need to change
RsaPublicKey/RsaPrivateKeyat all
@tarcieri because I have to embed a VerifyingKey as a field into the SigningKey. Otherwise as_ref() will fail with the returning a reference for temp variable error. And putting VerifyingKey next to RsaPrivateKey results in information duplication. So...I ended up with RsaPrivateKeyParts,
@lumag I opened a tracking issue for problems with Keypair and suggested a possible alternative: https://github.com/RustCrypto/traits/issues/1124
@tarcieri as a side note:
While this PR is intrusive, it removes the required usage of RsaPrivateKey, making all SigningKey implementations first class citizens. Also note, that ECDSA signing keys also incorporate VerifyingKey as a field.
I have rebased this PR on top of RSA 0.7.0. Note, I had to disable AsRef<RsaPrivateKey> for SigningKey<D> implementations. Since RsaPrivateKey is not a field of SigningKey, I don't see a way to implement AsRef
@lumag PTAL at the Keypair changes to the signature crate here:
https://github.com/RustCrypto/traits/pull/1141/files#diff-1eb80c5452df3ad684ce36b4bfb4590a600978c10f0135bcba713ca18617d9bc
It makes the AsRef support an optional optimization, and changes the default Keypair trait to return the public key by value.
This is a proposed breaking change which I think would help simplify this use case.