Skip to main content

Vault | Java SDK | JWT Endpoints

JWT Endpoints

JWT Sign

jwtSign(String id, String payload)

Sign a JSON Web Token (JWT) using a key.

required parameters

String
  • key id to sign payload
String
  • message to sign

Response Object

JWTSignResponse

JWTSignResponse

 String payload = """
      {'message': 'message to sign', 'data': 'Some extra data'}
       """;
 JWTSignResponse signResponse1 = client.jwtSign("keyid", payload);

JWT Verify

jwtVerify(String jws)

Verify the signature of a JSON Web Token (JWT).

required parameters

String
  • signature to verify

Response Object

JWTVerifyResponse

JWTVerifyResponse

 JWTVerifyResponse verifyResponse = client.jwtVerify(signResponse.getResult().getJws());

JWT Retrieve

jwkGet(String id)

Retrieve a key in JWK format.

required parameters

String
  • item id to get

Response Object

JWKGetResponse

GetResponse

 JWKGetResponse getResponse = client.jwkGet("jwkid");

JWT Retrieve

jwkGet(String id, String version)

Retrieve a key in JWK format.

required parameters

String
  • item id to get
String
  • item version/versions to get

Response Object

JWKGetResponse

GetResponse

 JWKGetResponse getResponse = client.jwkGet("jwkid", 2);