Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
BUILD.bazel | H A D | 25-Apr-2025 | 1.1 KiB | 33 | 28 | |
DeterministicAeadExample.java | H A D | 25-Apr-2025 | 3.5 KiB | 94 | 50 | |
README.md | H A D | 25-Apr-2025 | 1.1 KiB | 45 | 31 | |
deterministic_aead_test.sh | H A D | 25-Apr-2025 | 5.4 KiB | 172 | 98 | |
deterministic_aead_test_keyset.json | H A D | 25-Apr-2025 | 302 | 2 | 1 |
README.md
1# Java Deterministic AEAD example 2 3This example shows how to encrypt files with Tink using Deterministic 4Authenticated Encryption with Associated Data (Deterministic AEAD). 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 Tinkey: 10 11```shell 12tinkey create-keyset --key-template AES256_SIV --out-format JSON \ 13 --out deterministic_aead_test_keyset.json 14``` 15 16## Build and run 17 18### Bazel 19 20```shell 21git clone https://github.com/google/tink 22cd tink/examples/java_src 23bazel build ... 24``` 25 26Encrypt a file: 27 28```shell 29echo "some data" > testdata.txt 30 31./bazel-bin/deterministicaead/deterministic_aead_example encrypt \ 32 ./deterministicaead/deterministic_aead_test_keyset.json \ 33 testdata.txt testdata.txt.encrypted 34``` 35 36Decrypt a file: 37 38```shell 39./bazel-bin/deterministicaead/deterministic_aead_example decrypt \ 40 ./deterministicaead/deterministic_aead_test_keyset.json \ 41 testdata.txt.encrypted testdata.txt.decrypted 42 43diff testdata.txt testdata.txt.decrypted 44``` 45