| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| BUILD.bazel | D | 04-Jul-2025 | 2.5 KiB | 69 | 62 | |
| JwtGeneratePublicJwkSet.java | D | 04-Jul-2025 | 2.5 KiB | 69 | 31 | |
| JwtSign.java | D | 04-Jul-2025 | 2.9 KiB | 81 | 40 | |
| JwtVerify.java | D | 04-Jul-2025 | 3.1 KiB | 85 | 45 | |
| README.md | D | 04-Jul-2025 | 873 | 35 | 24 | |
| jwt_signature_example_test.sh | D | 04-Jul-2025 | 4.6 KiB | 150 | 79 | |
| jwt_signature_test_private_keyset.json | D | 04-Jul-2025 | 459 | 17 | 15 |
README.md
1# Java JWT signature example 2 3This is an example showing how to sign and verify JSON Web Tokens (JWT) with 4Tink. 5 6It demonstrates the basic steps of using Tink, namely loading key material, 7obtaining a primitive, and using the primitive to do crypto. 8 9The key material was generated with: 10 11```shell 12$ tinkey create-keyset --key-template JWT_ES256 --out-format JSON \ 13 --out jwt_signature_test_private_keyset.json 14``` 15 16## Build and Run 17 18### Bazel 19 20```shell 21$ git clone https://github.com/tink-crypto/tink-java 22$ cd examples 23$ bazel build ... 24$ touch token.txt 25 26$ ./bazel-bin/jwt/jwt_sign \ 27 ./jwt/jwt_signature_test_private_keyset.json example_audience token.txt 28 29$ ./bazel-bin/jwt/jwt_generate_public_jwk_set \ 30 ./jwt/jwt_signature_test_private_keyset.json public_jwk_set.json 31 32$ ./bazel-bin/jwt/jwt_verify \ 33 public_jwk_set.json example_audience token.txt 34``` 35