tree: 269863b46647f877e7d0ba73e2777fe74d5f53fa [path history] [tgz]
  1. BUILD.bazel
  2. hybrid_cli.cc
  3. hybrid_cli_test.sh
  4. hybrid_encryption_cli.cc
  5. hybrid_encryption_cli_test.sh
  6. hybrid_test_private_keyset.json
  7. hybrid_test_public_keyset.json
  8. README.md
  9. util.cc
  10. util.h
cc/examples/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.

Build and Run

Bazel

git clone https://github.com/google/tink
cd tink/cc/examples
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