Would it be possible to sign a jwt token with a RSA public key?

I can sign the token with the private key. see the code below. I would like to change it and make it sign with the public key.

return Jwts.builder()
.setExpiration(from(now().plusDays(EXP_DAYS).atZone(ZONE_ID).toInstant()))
.setIssuedAt(from(now().atZone(ZONE_ID).toInstant()))
.setAudience(input.getAud())
.setIssuer(input.getIss())
.setNotBefore(from(now().atZone(ZONE_ID).toInstant()))
.setHeaderParams(headers)
.addClaims(claims)
.signWith(RS256, this.jwtKeyPrivateProvider.getPrivateKey())
.compact();

Hi @cvfelipeoliveira,

Welcome to the Auth0 Community!

Not really…technically you could use the public key to make a signed JWT, but it wont work the same way as a JWT signed with the private key. Can you explain why you want to do this?