-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use RSAPublicKey in 0x1205 #233
Conversation
If we can find a way to do more compact RSA key representations, I'm all for it. After doing a little homework, I think @clehner's PR merits real consideration. @rvagg a few points to help clarify the origin of this conversation: As far as I can tell the only people who need this multicodec entry are all working on implementing the I'm working on a go implementation of Doing some digging through git history, it seems this chosen RSA representation has been part of the IPFS & Libp2p stack since at least the year 2015: libp2p/go-libp2p-crypto@b9038a3#diff-b4d8ce31e2465acb394fd7738faba5981e07e516bd5e406fc808fdd00f1f388cR35 I'm not going to drag Juan into this conversation to clarify why this representation was chosen, but I'm sure there's a reason. But in this case a more compact representation of public keys that is also removing an unused layer of normalization ( @expede I'd welcome your input here as well. |
Awesome; thanks @clehner 🎉
Nope! I have a WIP branch for this, but "luckily" keep getting pulled away, so no conflicts on my side! Further, our previous "just get it working, we'll use a placeholder prefix code for now" version was also a 2048-bit
Fission has implementations in TypeScript and Haskell. We have access to lots of key format support. No strong preference here, I just want it to interop and not be filled with long certificate header data 😛 |
Oh, to be explicit: I'm strongly in favour of this change 👍 |
I'm happy to defer to you three if you reach agreement that this is the right way to go. Since it was only added less than a month ago we should be pretty safe adjusting it.
So is the intention here to use this to support both @b5 do you want to give an explicit 👍 on this first? It seems like @clehner and @expede are good to go. |
yep explicit 👍 from me. I think @clehner's steering us all in the right direction.
I'm under the impression the intention here is to switch the multicodec to only support
We don't need to teach With that said, the lessons learned here also apply to |
@b5 @expede Edit: thanks @b5 for the interesting backstory as well.
Right. I think |
This PR is to change the
rsa-x509-pub
(0x1205
) entry to useRSAPublicKey
(instead ofSubjectPublicKeyInfo
), and to rename it torsa-pub
.This is to have a more compact and unambiguous key representation, and greater consistency with the other public key types, by removing the wrapper data structure that includes an algorithm identifier.
@b5, @expede (and anyone else): are you already using the current
rsa-x509-pub
/0x1205
, such that this would break your existing installations and credentials?If so, we could probably use a new code instead of changing this one. But I think it would be useful to have somewhat of a canonical representation of the key type in the table. Also, backwards compatibility with the previous usage would be possible, as these two representations are distuinguishable by their data structure, either by inspecting the bytes, inspecting the parsed data structure, or using libraries and a try-parse approach as mentioned by @rvagg in #230 (comment). See below for two examples of
RSAPublicKey
, for potential test vector purposes (#232), followed by an example ofSubjectPublicKeyInfo
, for comparison.Example 1
Base64-encoded value for
RSAPublicKey
with a 2048-bit modulus:ASN.1 object dump (using dumpasn1):
JWK:
Example 2
Base64-encoded value for
RSAPublicKey
with a 4096-bit modulus:ASN.1 structure:
JWK:
Previous representation
A
SubjectPublicKeyInfo
ASN.1 data structure with RSAPublicKey (andrsaEncryption
for the algorithm) looks like the following. This encapsulated the public key from Example A above: