Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
BUILD.bazel | D | 04-Jul-2025 | 1.1 KiB | 36 | 31 | |
README.md | D | 04-Jul-2025 | 1 KiB | 44 | 31 | |
StreamingAeadExample.java | D | 04-Jul-2025 | 5.5 KiB | 150 | 105 | |
streaming_aead_example_test.sh | D | 04-Jul-2025 | 4.3 KiB | 142 | 81 | |
streaming_aead_test_keyset.json | D | 04-Jul-2025 | 262 | 2 | 1 |
README.md
1# Java Streaming AEAD example 2 3This example shows how to encrypt files with Tink using Streaming Authenticated 4Encryption with Associated Data (Streaming 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 AES128_GCM_HKDF_4KB --out-format JSON \ 13 --out streaming_aead_test_keyset.json 14``` 15 16## Build and Run 17 18### Bazel 19 20```shell 21git clone https://github.com/tink-crypto/tink-java 22cd examples 23bazel build ... 24``` 25 26Encrypt a file: 27 28```shell 29echo "some data" > testdata.txt 30./bazel-bin/streamingaead/streamingaead_example encrypt \ 31 ./streamingaead/streaming_aead_test_keyset.json \ 32 testdata.txt testdata.txt.encrypted 33``` 34 35Decrypt a file: 36 37```shell 38./bazel-bin/streamingaead/streamingaead_example decrypt \ 39 ./streamingaead/streaming_aead_test_keyset.json \ 40 testdata.txt.encrypted testdata.txt.decrypted 41 42diff testdata.txt testdata.txt.decrypted 43``` 44