Skip to content
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

Can RSA keys be expressed as did:key ? #33

Open
bblfish opened this issue Mar 21, 2021 · 9 comments
Open

Can RSA keys be expressed as did:key ? #33

bblfish opened this issue Mar 21, 2021 · 9 comments

Comments

@bblfish
Copy link

bblfish commented Mar 21, 2021

It's a bit difficult to work out from the spec if this is possible or not.
If there is a way to express an RSA key as a did:key is there any other information in that key?
In particular the Signing HTTP Messages requires one not just to pass a keyId for a key but for it to refer to a subset of the product
cryptographic key × signatureAlgorithm where the second part involves the hashing function needed.
This would suggest that a did:key could not be used directly as a URL for Signing HTTP Messages as discussed in Issue 31.

@clehner
Copy link
Member

clehner commented Mar 22, 2021

I think it depends on this issue to assign a multicodec entry for RSA keys:
multiformats/multicodec#195
That should allow using a RSA public key encoded as DER in a did:key.

@bblfish
Copy link
Author

bblfish commented Mar 22, 2021

Thanks.
Would that then also contain information about the hashing algorithm to use? ie. rsaSha512, rsaSha384, etc... see RsaTest.

@clehner
Copy link
Member

clehner commented Mar 22, 2021

@bblfish
If the DID just has the RSA public key, I don't think that would include the hash algorithm, or whether to use PSS or PKCS1-v1_5. did:key could specify some specific algorithm, or to represent it in the DID with some additional fields.

There is also a question of what linked data signature suite to use for the verification methods in the resulting DID document.
If the key size is 2048, for JWS algorithm RS256 (PKCS1-v1_5 + SHA256) there is RSA Signature Suite 2018; for PS256 (PSS and SHA256), there is JSON Web Signature 2020. For other parameters, I'm not aware of existing linked data proof signature suite that could be used.

@clehner
Copy link
Member

clehner commented Sep 2, 2021

RSA public key (X.509 encoded) is now in multicodec: multiformats/multicodec#226

@OR13
Copy link
Contributor

OR13 commented Sep 23, 2021

@clehner you should provide test vectors for RSA here.

@clehner clehner mentioned this issue Sep 23, 2021
@clehner
Copy link
Member

clehner commented Sep 24, 2021

@OR13
Test vector proposed in #41.

I'm unsure, however, if it is the correct use of the registered multicodec value. Feedback on that and/or here would be welcome: multiformats/multicodec#230.

I assumed that like the other listed did:key types, the DID should encode the public key value. However it does result in a somewhat long DID (381 chars for a 2048-bit key). But if the value is a digest, we could not use simply use JsonWebKey2020 in the DID document, right?

@OR13
Copy link
Contributor

OR13 commented Sep 28, 2021

@clehner your test vectors look correct, and as long as you provide the JWK values for the multiformat encoding, they will be sufficient for proving interop.

You should add a 4096 key for the sake of completness.

@clehner
Copy link
Member

clehner commented Sep 29, 2021

@OR13 thanks for reviewing it.
A 4096 key has been added. The PR is still in draft, pending changes in multicodec.

@clehner
Copy link
Member

clehner commented May 25, 2022

This was done in #41, multiformats/multicodec#233, and #45.

@bblfish does this answer you question(s)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants