tree: dcc037cf2728c7792eeda2d5e05759a0d30be463 [path history] [tgz]
  1. BUILD.bazel
  2. CMakeLists.txt
  3. CMakeLists_for_CMakeBuildTest.txt
  4. README.md
  5. aes128_gcm_test_keyset_json.txt
  6. cmake_build_test.sh
  7. hello_world.cc
  8. hello_world_test.sh
  9. non_bazel_build_test.sh
examples/helloworld/cc/README.md

C++ Hello World

This is a command-line tool that can encrypt and decrypt small files using AEAD (Authenticated Encryption with Associated Data).

It demonstrates the basic steps of using Tink, namely loading key material, obtaining a primitive, and using the primitive to do crypto.

Moreover, since this app shares the same Bazel WORKSPACE with Tink, its BUILD file can directly depend on Tink.

Build and Run

Bazel

git clone https://github.com/google/tink
cd tink
bazel build ...
echo "some plaintext" > foo.txt
./bazel-bin/examples/helloworld/cc/hello_world ./examples/helloworld/cc/aes128_gcm_test_keyset_json.txt\
    encrypt foo.txt "some aad" bar.encrypted
./bazel-bin/examples/helloworld/cc/hello_world ./examples/helloworld/cc/aes128_gcm_test_keyset_json.txt\
    decrypt bar.encrypted "some aad" foo-decrypted.txt
cat foo-decrypted.txt

TODO: copy this app to tink-examples and add instructions on how to build it there.