I'm using https://github.com/dgrijalva/jwt-go to build a JWT using a 256-bit private PEM key. I'm using SigningMethodRS256 to sign the JWT:
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)
On the last line, I get an error when signing the jwt: crypto/rsa: message too long for RSA public key size. Does anyone know what causes this? The size of the pem file seems correct.