Open thomaseizinger opened 1 year ago
ring
doesn't seem to provide a way to "serialize" RSA keys. Should we implement it ourselves?
ring
doesn't seem to provide a way to "serialize" RSA keys. Should we implement it ourselves?
That is a bit unfortunate. There is only one way to construct the keypair, using from_pkcs8
. We can store the original bytes next to the decoded key and use that when required. I don't see another solution unfortunately.
ring
doesn't seem to provide a way to "serialize" RSA keys. Should we implement it ourselves?That is a bit unfortunate. There is only one way to construct the keypair, using
from_pkcs8
. We can store the original bytes next to the decoded key and use that when required. I don't see another solution unfortunately.
We've discovered in https://github.com/libp2p/rust-libp2p/pull/3681 that our spec requires PKCS#1 and ring
only supports decoding from PKCS#8.
If we were to use the rsa
crate, this issue would go away.
@mxinden What is your opinion on switching to the rsa
crate to finish this issue? One of the practical implications is that the function for encoding to protobuf cannot be infallible because we need to return an error if somebody attempts to serialize an RSA keypair.
For others to follow along, past discussion: https://github.com/libp2p/rust-libp2p/issues/1133
I don't have an opinion on this issue. Overall I would deem anything RSA related low priority. That said, I see the advantages that the gained consistency would bring us (see comment by @thomaseizinger above).
Maybe @dignifiedquire since you are one of the main authors and since you know libp2p well, do you have an opinion?
Description
The spec is here: https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#key-types
Related: https://github.com/libp2p/rust-libp2p/pull/3350#issuecomment-1474048757.
Motivation
Being feature-complete and compliant with libp2p specs.
Are you planning to do it yourself in a pull request?
No.