aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorjuerg <juerg@google.com>2023-03-28 03:33:13 -0700
committerCopybara-Service <copybara-worker@google.com>2023-03-28 03:34:18 -0700
commit1bbd79ba61f19fd9509b10e43349d5622c74ef60 (patch)
tree3e643e452fbb151f000861e0eaa7c2ae9ba4c6a5 /tools
parentba66646448633ac3cc251dce760b4146cee23ff3 (diff)
downloadtink-1bbd79ba61f19fd9509b10e43349d5622c74ef60.tar.gz
Remove unused aead_cli.go.
PiperOrigin-RevId: 519979374
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/go/BUILD.bazel16
-rw-r--r--tools/testing/go/aead_cli.go126
2 files changed, 0 insertions, 142 deletions
diff --git a/tools/testing/go/BUILD.bazel b/tools/testing/go/BUILD.bazel
index 22b483d1c..b7a30b775 100644
--- a/tools/testing/go/BUILD.bazel
+++ b/tools/testing/go/BUILD.bazel
@@ -5,22 +5,6 @@ package(default_visibility = ["//:__subpackages__"])
licenses(["notice"])
go_binary(
- name = "aead_cli_go",
- testonly = 1, # keep
- srcs = ["aead_cli.go"],
- out = "aead_cli_go",
- data = ["//testdata/gcp:credentials"],
- deps = [
- "@tink_go//aead",
- "@tink_go//core/registry",
- "@tink_go//integration/awskms",
- "@tink_go//integration/gcpkms",
- "@tink_go//keyset",
- "@tink_go//testkeyset",
- ],
-)
-
-go_binary(
name = "public_key_sign_cli_go",
testonly = 1, # keep
srcs = ["public_key_sign_cli.go"],
diff --git a/tools/testing/go/aead_cli.go b/tools/testing/go/aead_cli.go
deleted file mode 100644
index 4a1c53e94..000000000
--- a/tools/testing/go/aead_cli.go
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2019 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-// A command-line utility for testing AEAD-primitives.
-// It requires 5 arguments:
-//
-// keyset-file: name of the file with the keyset to be used for encryption
-// operation: the actual AEAD-operation, i.e. "encrypt" or "decrypt"
-// input-file: name of the file with input (plaintext for encryption, or
-// or ciphertext for decryption)
-// associated-data-file: name of the file containing associated data
-// output-file: name of the file for the resulting output
-package main
-
-import (
- "io/ioutil"
- "log"
- "os"
- "path/filepath"
-
- "github.com/google/tink/go/aead"
- "github.com/google/tink/go/core/registry"
- "github.com/google/tink/go/integration/awskms"
- "github.com/google/tink/go/integration/gcpkms"
- "github.com/google/tink/go/keyset"
- "github.com/google/tink/go/testkeyset"
-)
-
-var (
- gcpURI = "gcp-kms://projects/tink-test-infrastructure/locations/global/keyRings/unit-and-integration-testing/cryptoKeys/aead-key"
- gcpCredFile = filepath.Join(os.Getenv("TEST_SRCDIR"), "tools/testdata/gcp/credential.json")
- awsURI = "aws-kms://arn:aws:kms:us-east-2:235739564943:key/3ee50705-5a82-4f5b-9753-05c4f473922f"
- awsCredFile = filepath.Join(os.Getenv("TEST_SRCDIR"), "tools/testdata/aws/credentials.csv")
-)
-
-func init() {
- gcpclient, err := gcpkms.NewClientWithCredentials(gcpURI, gcpCredFile)
- if err != nil {
- log.Fatal(err)
- }
- registry.RegisterKMSClient(gcpclient)
-
- awsclient, err := awskms.NewClientWithCredentials(awsURI, awsCredFile)
- if err != nil {
- log.Fatal(err)
- }
- registry.RegisterKMSClient(awsclient)
-}
-
-func main() {
- if len(os.Args) != 6 {
- log.Fatalf("Usage: %s keyset-file operation input-file associated-data-file output-file\n", os.Args[0])
- }
-
- keysetFilename := os.Args[1]
- operation := os.Args[2]
- inputFilename := os.Args[3]
- associatedDataFile := os.Args[4]
- outputFilename := os.Args[5]
-
- if !(operation == "encrypt" || operation == "decrypt") {
- log.Fatalf("Unknown operation %q. Expected 'encrypt' or 'decrypt'", operation)
- }
-
- log.Printf("Using keyset from file %q to-AEAD-%s file %q with associated data from file %q.",
- keysetFilename, operation, inputFilename, associatedDataFile)
- log.Printf("The result will be written to %q\n", outputFilename)
-
- // Read the keyset.
- f, err := os.Open(keysetFilename)
- if err != nil {
- log.Fatalf("Opening the keyset file failed: %v\n", err)
- }
- reader := keyset.NewBinaryReader(f)
- handle, err := testkeyset.Read(reader)
- if err != nil {
- log.Fatalf("Reading the keyset failed: %v\n", err)
- }
-
- // Get Primitive
- cipher, err := aead.New(handle)
- if err != nil {
- log.Fatalf("Failed to create primitive: %v\n", err)
- }
-
- // Read input
- content, err := ioutil.ReadFile(inputFilename)
- if err != nil {
- log.Fatalf("Failed to read input: %v", err)
- }
-
- // Read associated data
- associatedData, err := ioutil.ReadFile(associatedDataFile)
- if err != nil {
- log.Fatalf("Failed to read associated data file: %v", err)
- }
-
- // Compute output
- var result []byte
- if operation == "encrypt" {
- result, err = cipher.Encrypt(content, associatedData)
- } else if operation == "decrypt" {
- result, err = cipher.Decrypt(content, associatedData)
- }
- if err != nil {
- log.Fatalf("Failed to %s input file. Error: %v", operation, err)
- }
-
- // Write to output file
- if err := ioutil.WriteFile(outputFilename, result, 0644); err != nil {
- log.Fatalf("Failed to write result to output file. Error: %v", err)
- }
-}