From e62dd3a30480d401ab35c176ee99cd59f5023909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Dvo=C5=99=C3=A1k?= Date: Fri, 18 Mar 2022 12:43:27 +0100 Subject: [PATCH] Fix auth0/java-jwt#554 (#555) --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0f847cca..a26170d2 100644 --- a/README.md +++ b/README.md @@ -137,10 +137,9 @@ You'll first need to create a `JWTCreator` instance by calling `JWT.create()`. U * Example using `RS256` ```java - RSAPublicKey publicKey = //Get the key instance - RSAPrivateKey privateKey = //Get the key instance + RSAPrivateKey privateKey = //Get the private key instance try { - Algorithm algorithm = Algorithm.RSA256(publicKey, privateKey); + Algorithm algorithm = Algorithm.RSA256(null, privateKey); // only the private key is used for signing String token = JWT.create() .withIssuer("auth0") .sign(algorithm); @@ -176,9 +175,8 @@ You'll first need to create a `JWTVerifier` instance by calling `JWT.require()` ```java String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9.AbIJTDMFc7yUa5MhvcP03nJPyCPzZtQcGEp-zWfOkEE"; RSAPublicKey publicKey = //Get the key instance - RSAPrivateKey privateKey = //Get the key instance try { - Algorithm algorithm = Algorithm.RSA256(publicKey, privateKey); + Algorithm algorithm = Algorithm.RSA256(publicKey, null); // only the public key is used during verification JWTVerifier verifier = JWT.require(algorithm) .withIssuer("auth0") .build(); //Reusable verifier instance