-
I am importing the key using importPKCS and i will obtain a keylike how can i generate a public key keylike using the private key in keylike format? In additional question: is there any differences in jwt verify and jws verify? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
KeyLike is just an interface, it's either a KeyObject (in node runtime), or CryptoKey (in web-api runtimes like the browser). See KeyLike Furthermore you don't generate a public key when you have a private one, you just extract or derive it from it. You can extract the public key out of a private one in node using the KeyObject apis (see node crypto doc). You cannot do the same with CryptoKey, the WebCrypto API does not have affordances for that.
Yes. JWT can take the form of a JWE or JWS and the JWT API also verifies and parses the respective payloads to be JWT json objects and when present validates the present claims from RFC7519. JWS/JWE just returns the payload as Uint8Array. As a rule of thumb, if you have to ask this question, you likely want to use JWT. |
Beta Was this translation helpful? Give feedback.
KeyLike is just an interface, it's either a KeyObject (in node runtime), or CryptoKey (in web-api runtimes like the browser). See KeyLike Furthermore you don't generate a public key when you have a private one, you just extract or derive it from it. You can extract the public key out of a private one in node using the KeyObject apis (see node crypto doc). You cannot do the same with CryptoKey, the WebCrypto API does not have affordances for that.
Yes. JWT can take the form of a JWE or JWS and the JWT API also verifies and parse…