Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
BUILD.bazel | H A D | 25-Apr-2025 | 2.4 KiB | 67 | 60 | |
JwtGeneratePublicJwkSet.java | H A D | 25-Apr-2025 | 2.5 KiB | 69 | 31 | |
JwtSign.java | H A D | 25-Apr-2025 | 2.8 KiB | 80 | 39 | |
JwtVerify.java | H A D | 25-Apr-2025 | 3.1 KiB | 83 | 43 | |
README.md | H A D | 25-Apr-2025 | 877 | 35 | 24 | |
jwt_signature_example_test.sh | H A D | 25-Apr-2025 | 4.6 KiB | 150 | 79 | |
jwt_signature_test_private_keyset.json | H A D | 25-Apr-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/google/tink 22$ cd tink/examples/java_src 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