-
Notifications
You must be signed in to change notification settings - Fork 397
Description
I want to sign my toklens using RSA256. For that I've generated public and private PEM keys, where private key create with x509.MarshalPKCS1PrivateKey
and public key with x509.MarshalPKCS1PublicKey
.
And when I'm using jwt.ParseRSAPublicKeyFromPEM
, I've go an error x509: malformed tbs certificate
. I thought that I did something wrong while generating keys, but I didn't. The answer was inside the jwt.ParseRSAPublicKeyFromPEM
, it's using x509.ParsePKIXPublicKey
istead of x509.ParsePKCS1PublicKey
. So I should change the algorythm to generate public key with x509.MarshalPKIXPublicKey
.
But it's not obvious! Can someone explain to me why is it done in such way(using x509.ParsePKIXPublicKey), but not using x509.ParsePKCS1PublicKey
if name of the function(ParseRSAPublicKeyFromPEM) is telling me to use RSA PUBLIC KEY which will be the pair to my private key?