Skip to content

Commit

Permalink
Move examples for Tink C++ to the project's folder
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 464756776
  • Loading branch information
morambro authored and copybara-github committed Aug 2, 2022
1 parent 2c794f9 commit 777181d
Show file tree
Hide file tree
Showing 44 changed files with 28 additions and 24 deletions.
2 changes: 2 additions & 0 deletions cc/.bazelignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ignore AWS-KMS and Cloud KMS integrations which are in thier own WORKSPACEs.
integration/awskms
integration/gcpkms
# Ignore examples.
examples
File renamed without changes.
3 changes: 1 addition & 2 deletions examples/cc/WORKSPACE → cc/examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ workspace(name = "examples_cc")

local_repository(
name = "tink_cc",
path = "../../cc",
path = "../",
)
# http_archive(
# name = "tink_cc",
# urls = ["https://github.com/google/tink/archive/master.zip"],
# strip_prefix = "tink-master/cc",
# )


# Load Tink dependencies.

load("@tink_cc//:tink_cc_deps.bzl", "tink_cc_deps")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ obtaining a primitive, and using the primitive to do crypto.

```shell
git clone https://github.com/google/tink
cd tink/examples/cc
cd tink/cc/examples
bazel build ...
echo "a message" > message.txt
./bazel-bin/digital_signatures/digital_signatures_cli gen-private-key private_keyset.bin
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
//
///////////////////////////////////////////////////////////////////////////////

#ifndef EXAMPLES_CC_DIGITAL_SIGNATURES_UTIL_H_
#define EXAMPLES_CC_DIGITAL_SIGNATURES_UTIL_H_
#ifndef TINK_EXAMPLES_DIGITAL_SIGNATURES_UTIL_H_
#define TINK_EXAMPLES_DIGITAL_SIGNATURES_UTIL_H_

#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -60,4 +60,4 @@ class Util {
static void Write(const std::string& output, const std::string& filename);
};

#endif // EXAMPLES_CC_DIGITAL_SIGNATURES_UTIL_H_
#endif // TINK_EXAMPLES_DIGITAL_SIGNATURES_UTIL_H_
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ obtaining a primitive, and using the primitive to do crypto.
```shell
# Build the code.
git clone https://github.com/google/tink
cd tink/examples/cc
cd tink/cc/examples
bazel build ...

# Create some input.
Expand Down Expand Up @@ -45,7 +45,7 @@ cat foo-decrypted.txt

# Clone the Tink repository.
git clone https://github.com/google/tink
cd tink/examples/cc/helloworld
cd tink/cc/examples/helloworld

# Build the hello world example.
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fi

# XDG_CACHE_HOME must be set for a successful build of BoringSSL.
export XDG_CACHE_HOME="${TEST_TMPDIR}/cache"
TEST_DATA_DIR="${TEST_SRCDIR}/tink/examples/cc/helloworld"
TEST_DATA_DIR="${TEST_SRCDIR}/tink/cc/examples/helloworld"
CMAKE_LISTS_FILE="${TEST_DATA_DIR}/CMakeLists_for_CMakeBuildTest.txt"
HELLO_WORLD_SRC="${TEST_DATA_DIR}/hello_world.cc"
KEYSET_FILE="${TEST_DATA_DIR}/aes128_gcm_test_keyset_json.txt"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ cc_binary(
"@tink_cc//:keyset_reader",
"@tink_cc//config:tink_config",
"@tink_cc//hybrid:hpke_config",
"@tink_cc//util:status", ],
"@tink_cc//util:status",
],
)

sh_test(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ obtaining a primitive, and using the primitive to do crypto.

```shell
git clone https://github.com/google/tink
cd tink/examples/cc
cd tink/cc/examples
bazel build ...
echo "a message" > message.txt
echo "context" > context_info.txt
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
//
///////////////////////////////////////////////////////////////////////////////

#ifndef EXAMPLES_CC_HYBRID_ENCRYPTION_UTIL_H_
#define EXAMPLES_CC_HYBRID_ENCRYPTION_UTIL_H_
#ifndef TINK_EXAMPLES_HYBRID_ENCRYPTION_UTIL_H_
#define TINK_EXAMPLES_HYBRID_ENCRYPTION_UTIL_H_

#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -60,4 +60,4 @@ class Util {
static void Write(const std::string& output, const std::string& filename);
};

#endif // EXAMPLES_CC_HYBRID_ENCRYPTION_UTIL_H_
#endif // TINK_EXAMPLES_HYBRID_ENCRYPTION_UTIL_H_
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/cc/jwt/README.md → cc/examples/jwt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ obtaining a primitive, and using the primitive to do crypto.

```shell
git clone https://github.com/google/tink
cd tink/examples/cc
cd tink/cc/examples
bazel build ...
./bazel-bin/jwt/jwt_signature_cli gen-private-key private_keyset.bin
./bazel-bin/jwt/jwt_signature_cli get-public-key private_keyset.bin \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions examples/cc/jwt/util.h → cc/examples/jwt/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
//
///////////////////////////////////////////////////////////////////////////////

#ifndef EXAMPLES_CC_JWT_UTIL_H_
#define EXAMPLES_CC_JWT_UTIL_H_
#ifndef TINK_EXAMPLES_JWT_UTIL_H_
#define TINK_EXAMPLES_JWT_UTIL_H_

#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -44,4 +44,4 @@ std::string ReadFile(absl::string_view filename);
// In case of errors writes a log message and aborts.
void WriteFile(absl::string_view output, absl::string_view filename);

#endif // EXAMPLES_CC_JWT_UTIL_H_
#endif // TINK_EXAMPLES_JWT_UTIL_H_
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ fi

export TEST_TMPDIR="$(mktemp -dt examples-cc-cmake.XXXXXX)"
export TEST_SRCDIR="$(cd ..; pwd)"
cd examples/cc/helloworld
cd cc/examples/helloworld
./cmake_build_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ fi
# Only installing CMake; OpenSSL is installed by the example script.
source ./kokoro/testutils/install_cmake.sh

export TEST_TMPDIR="$(mktemp -dt examples-cc-cmake-openssl.XXXXXX)"
export TEST_SRCDIR="$(cd ..; pwd)"
cd examples/cc/helloworld
./cmake_build_test.sh --openssl
(
export TEST_TMPDIR="$(mktemp -dt examples-cc-cmake-openssl.XXXXXX)"
export TEST_SRCDIR="$(cd ..; pwd)"
cd cc/examples/helloworld
./cmake_build_test.sh --openssl
)
2 changes: 1 addition & 1 deletion kokoro/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ run_all_linux_tests() {
fi

run_linux_tests "javascript"
run_linux_tests "examples/cc"
run_linux_tests "cc/examples"

local -a MANUAL_EXAMPLE_JAVA_TARGETS
if [[ -n "${KOKORO_ROOT}" ]]; then
Expand Down

0 comments on commit 777181d

Please sign in to comment.