Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

RS256 message too long for RSA public key size #408

Open
shobhitsrivastava opened this issue Jun 11, 2020 · 1 comment
Open

RS256 message too long for RSA public key size #408

shobhitsrivastava opened this issue Jun 11, 2020 · 1 comment

Comments

@shobhitsrivastava
Copy link

shobhitsrivastava commented 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
Copy link

ajoyac commented Sep 17, 2020

Not sure if still open, but it seams its related to #213 the rsa pem size it dosent have to be related to the signing method some how...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants