jwt
jwt copied to clipboard
RS256 message too long for RSA public key size
Migrated from https://github.com/dgrijalva/jwt-go/issues/408:
shobhitsrivastava commented on Jun 11, 2020 •
I'm using a 256-bit private PEM to build a JWT with signing method RSA 256, similar to the example code:
signBytes, _ := ioutil.ReadFile(privKeyPath)
signKey, err := jwt.ParseRSAPrivateKeyFromPEM(signBytes)
token := jwt.NewWithClaims(jwt.SigningMethodRS256, middleware.CognitoAccessTokenClaim{
CustomArray: []string{"testString"},
StandardClaims: jwt.StandardClaims{
ExpiresAt: 1500,
},
})
jwtString, err := token.SignedString(signKey)
When I try to sign the token, I'm getting the error crypto/rsa: message too long for RSA public key size. Does anyone know what could be causing this?
ajoyac commented on Sep 17, 2020
Not sure if still open, but it seams its related to #213 (https://github.com/dgrijalva/jwt-go/issues/213) the rsa pem size it dosent have to be related to the signing method some how...
I'll leave up to debate if we want to define this as a documentation issue or an enhancement