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

What to paste for the public key or certificate is vague #551

Open
heaths opened this issue Sep 10, 2021 · 3 comments · Fixed by #553
Open

What to paste for the public key or certificate is vague #551

heaths opened this issue Sep 10, 2021 · 3 comments · Fixed by #553
Assignees

Comments

@heaths
Copy link

heaths commented Sep 10, 2021

In the placeholder text for https://jwt.io, the public key states,

Public key or certificate. Enter it in plain text only if you want to verify a token.

As to what "plain text" is in this context isn't clear.

While trying to help a Key Vault customer, I originally tried a base64url-encoded key would work since everything else was base64url-encoded. When that didn't work and I was sure my sample was correct, I tried both base64 and PEM using the common "PUBLIC KEY" label for PKCS#8-encoded keys. It wasn't until I switched over to using a certificate with the "CERTIFICATE" PEM label that worked when I thought to try the PKCS1, RSA-only "RSA PUBLIC KEY".

It would be great if either the placeholder text or some link to more info could clarify this. I spent more time than I care to admit trying to figure out what to paste in that textarea or if my code was wrong.

@panva
Copy link
Contributor

panva commented Sep 29, 2021

@heaths #553 updated the placeholder texts for both public and private key inputs

Public Key: Public Key in SPKI, PKCS #1, X.509 Certificate, or JWK string format.
Private Key: Private Key in PKCS #8, PKCS #1, or JWK string format.

That means

Public Key with labels "PUBLIC KEY", "RSA PUBLIC KEY", "CERTIFICATE"
Private Key with labels "PRIVATE KEY", "RSA PRIVATE KEY"

#553 also adds support for JSON Web Key (JWK) format, it expects a JSON String such as

// public key

{"crv":"P-256","x":"EVs_o5-uQbTjL3chynL4wXgUg2R9q9UU8I5mEovUf84","y":"kGe5DgSIycKp8w9aJmoHhB1sB3QTugfnRWm5nU_TzsY","kty":"EC"}

// private key

{"crv":"P-256","x":"EVs_o5-uQbTjL3chynL4wXgUg2R9q9UU8I5mEovUf84","y":"kGe5DgSIycKp8w9aJmoHhB1sB3QTugfnRWm5nU_TzsY","d":"evZzL1gdAFr88hb2OF_2NxApJCzGCEDdfSp6VQO30hw","kty":"EC"}

newlines for readability are allowed, likewise, for PEM format newlines in the base64 portion are allowed. newlines after the opening label and before closing label for PEM formats are required.

@heaths
Copy link
Author

heaths commented Sep 29, 2021

Looks great. Thanks!

@DanOnCall DanOnCall self-assigned this Jun 18, 2024
@DanOnCall DanOnCall reopened this Jun 18, 2024
@DanOnCall
Copy link
Contributor

Re-opening this issue to include this guidance in the next version of jwt.io :)

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

Successfully merging a pull request may close this issue.

3 participants