tree: c5a806f985c56c059d4c64b2a400c9d2602a95ac [path history] [tgz]
  1. src/
  2. BUILD.bazel
  3. pom.xml

Java Hello World

This is a command-line tool that can encrypt and decrypt small files with AES128-GCM.

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

It also shows how to add a dependency on Tink using Maven. Please checkout the pom.xml file.

Build and Run


git clone
cd tink/examples/java_src/
mvn package
echo foo > foo.txt
mvn exec:java -Dexec.args="encrypt --keyset test.cfg --in foo.txt --out bar.encrypted"
mvn exec:java -Dexec.args="decrypt --keyset test.cfg --in bar.encrypted --out foo2.txt"
cat foo2.txt


git clone
cd tink/examples/java_src
bazel build ...
echo foo > foo.txt
./bazel-bin/helloworld/helloworld encrypt --keyset test.cfg --in foo.txt --out bar.encrypted
./bazel-bin/helloworld/helloworld decrypt --keyset test.cfg --in bar.encrypted --out foo2.txt
cat foo2.txt