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/google/tink 22cd tink/examples/java_src 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