Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
BUILD.bazel | H A D | 25-Apr-2025 | 1 KiB | 31 | 27 | |
CleartextKeysetExample.java | H A D | 25-Apr-2025 | 4.2 KiB | 107 | 54 | |
README.md | H A D | 25-Apr-2025 | 985 | 43 | 30 | |
cleartext_keyset_example_test.sh | H A D | 25-Apr-2025 | 2.8 KiB | 94 | 44 |
README.md
1# Java cleartext keysets example 2 3This example shows how to generate or load a cleartext keyset, obtain a 4primitive, and use the primitive to do crypto. 5 6WARNING: This is not recommended, consider protecting your keysets with a key 7management system. 8 9## Build and run 10 11### Bazel 12 13```shell 14git clone https://github.com/google/tink 15cd tink/examples/java_src 16bazel build ... 17``` 18 19Generate a cleartext keyset: 20 21```shell 22./bazel-bin/cleartextkeyset/cleartext_keyset_example generate aes128_gcm_test_keyset.json 23``` 24 25Encrypt a file with the resulting keyset: 26 27```shell 28echo "some data" > testdata.txt 29./bazel-bin/cleartextkeyset/cleartext_keyset_example encrypt \ 30 aes128_gcm_test_keyset.json \ 31 testdata.txt testdata.txt.encrypted 32``` 33 34Decrypt the file with the resulting keyset: 35 36```shell 37./bazel-bin/cleartextkeyset/cleartext_keyset_example decrypt \ 38 aes128_gcm_test_keyset.json \ 39 testdata.txt.encrypted testdata.txt.decrypted 40 41diff testdata.txt testdata.txt.decrypted 42``` 43