tree: 0e3201797dd8c1aa2cbf0854a849011841b445fa [path history] [tgz]
  1. BUILD.bazel
  2. hybrid_encryption_cli.cc
  3. hybrid_encryption_cli_test.sh
  4. README.md
  5. util.cc
  6. util.h
examples/cc/hybrid_encryption/README.md

C++ Hybrid Encryption CLI

This is a command-line tool that can generate Hybrid Encryption keys, and encrypt and decrypt using Hybrid encryption.

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/examples/cc
bazel build ...
echo "a message" > message.txt
echo "context" > context_info.txt
./bazel-bin/hybrid_encryption/hybrid_encryption_cli gen-private-key private_keyset.bin
./bazel-bin/hybrid_encryption/hybrid_encryption_cli get-public-key private_keyset.bin \
    public_keyset.bin
./bazel-bin/hybrid_encryption/hybrid_encryption_cli encrypt public_keyset.bin \
    message.txt context_info.txt encrypted_message.bin
./bazel-bin/hybrid_encryption/hybrid_encryption_cli decrypt private_keyset.bin \
    encrypted_message.bin context_info.txt decrypted_message.txt