Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RS256 message too long for RSA public key size #61

Open
lggomez opened this issue Aug 3, 2021 · 2 comments
Open

RS256 message too long for RSA public key size #61

lggomez opened this issue Aug 3, 2021 · 2 comments

Comments

@lggomez
Copy link
Member

lggomez commented Aug 3, 2021

Migrated from dgrijalva/jwt-go#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?

@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

ajoyac commented on Sep 17, 2020

Not sure if still open, but it seams its related to #213 (dgrijalva/jwt-go#213) the rsa pem size it dosent have to be related to the signing method some how...

@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

I'll leave up to debate if we want to define this as a documentation issue or an enhancement

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

No branches or pull requests

1 participant