Skip to content

Commit

Permalink
Build and distribute a single Tinkey binary for Linux, macOS and Wind…
Browse files Browse the repository at this point in the history
…ows.

PiperOrigin-RevId: 337258756
  • Loading branch information
thaidn authored and copybara-github committed Oct 15, 2020
1 parent 56963ab commit 1683213
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 8 additions & 0 deletions docs/TINKEY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ decrypt keysets with master keys residing in a remote key management service
(KMS). Out of the box it supports AWS KMS and Google Cloud KMS. Adding support
for other KMS is easy, and doesn't require modifying Tinkey.

Tinkey requires Java 8 or later to run.

## Install from prebuilt binaries

Download the latest version of Tinkey from
https://storage.googleapis.com/tinkey/tinkey-1.5.0.tar.gz. This version should
work well on Linux, macOS and Windows.

## Install with Homebrew

```sh
Expand Down
9 changes: 2 additions & 7 deletions tinkey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@
class Tinkey < Formula
desc "A command line tool to generate and manipulate keysets for the Tink cryptography library"
homepage "https://github.com/google/tink/tree/master/tools/tinkey"
url "https://storage.googleapis.com/tinkey/tinkey-darwin-x86_64-1.4.0.tar.gz"
sha256 "cd4a79a3c78084e6d0b4d82cc0e2f903cb0f18d6d75c7c897512f7804be50dba"

on_linux do
url "https://storage.googleapis.com/tinkey/tinkey-linux-x86_64-1.4.0.tar.gz"
sha256 "b36521a05fc59b6541bd4119df9f1cc392a509ed914efe763b92c50b87f4159f"
end
url "https://storage.googleapis.com/tinkey/tinkey-1.5.0.tar.gz"
sha256 "bd148e684ffba85b8499bcfe29c8ed1e9dedef52eddd35dabb0a34e396790b90"

bottle :unneeded

Expand Down
12 changes: 7 additions & 5 deletions tools/release_tinkey.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ fi

readonly GCS_LOCATION="gs://tinkey/"

readonly PLATFORM="$(uname -ms | tr '[:upper:]' '[:lower:]' | tr ' ' '-')"

readonly TMP_DIR="$(mktemp -dt tinkey.XXXXXX)"

do_command() {
Expand Down Expand Up @@ -95,19 +93,23 @@ build_tinkey() {
#!/usr/bin/env sh
java -jar "\$(dirname \$0)/tinkey_deploy.jar" "\$@"
EOF

cat <<EOF > tinkey.bat
java -jar "%~dp0\tinkey_deploy.jar" %*
EOF

chmod 755 tinkey

print_and_do tar -czvpf "tinkey-${PLATFORM}-${VERSION}.tar.gz" tinkey_deploy.jar tinkey
print_and_do tar -czvpf "tinkey-${VERSION}.tar.gz" tinkey_deploy.jar tinkey tinkey.bat
}

upload_to_gcs() {
print_and_do cd "${TMP_DIR}"

shasum -a 256 "tinkey-${PLATFORM}-${VERSION}.tar.gz"
shasum -a 256 "tinkey-${VERSION}.tar.gz"

do_if_not_dry_run gsutil cp "tinkey-${PLATFORM}-${VERSION}.tar.gz" "${GCS_LOCATION}"
do_if_not_dry_run gsutil cp "tinkey-${VERSION}.tar.gz" "${GCS_LOCATION}"
}

main() {
Expand Down

0 comments on commit 1683213

Please sign in to comment.