Name Date Size #Lines LOC

..--

BUILD.bazelH A D25-Apr-20251.1 KiB3328

DeterministicAeadExample.javaH A D25-Apr-20253.5 KiB9450

README.mdH A D25-Apr-20251.1 KiB4531

deterministic_aead_test.shH A D25-Apr-20255.4 KiB17298

deterministic_aead_test_keyset.jsonH A D25-Apr-2025302 21

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