From 80c77449756c102381278d7ebeeb7b448cd6a16a Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Tue, 3 Nov 2020 20:10:54 +0100 Subject: removed obsolete test scripts --- server/testdata/cmd/add-entry | 36 ------------------ server/testdata/entry/README.md | 21 ----------- server/testdata/entry/main.go | 44 ---------------------- server/testdata/entry/stitem/foobar-0.0.1 | Bin 48 -> 0 bytes server/testdata/entry/stitem/foobar-0.0.1.b64 | 1 - server/testdata/entry/stitem/foobar-0.0.1.sig | 3 -- server/testdata/entry/stitem/foobar-0.0.1.sig.b64 | 1 - 7 files changed, 106 deletions(-) delete mode 100755 server/testdata/cmd/add-entry delete mode 100644 server/testdata/entry/README.md delete mode 100644 server/testdata/entry/main.go delete mode 100644 server/testdata/entry/stitem/foobar-0.0.1 delete mode 100644 server/testdata/entry/stitem/foobar-0.0.1.b64 delete mode 100644 server/testdata/entry/stitem/foobar-0.0.1.sig delete mode 100644 server/testdata/entry/stitem/foobar-0.0.1.sig.b64 (limited to 'server/testdata') diff --git a/server/testdata/cmd/add-entry b/server/testdata/cmd/add-entry deleted file mode 100755 index 853dd97..0000000 --- a/server/testdata/cmd/add-entry +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -eo pipefail -source config - -algo=ecdsa -signature_scheme=1027 -key_path="../chain/rgdd-$algo.key" -cert_path="../chain/rgdd-$algo.pem" -name="foobar-1.2.3" - -if [[ ! -z $1 ]]; then - name=$1 -fi -info "package name: $name" - -pushd ../entry >/dev/null - info "generating base64-encoded StItem and signature" - go run . --dir stitem --name $name - openssl dgst -sha256 -sign $key_path -out stitem/$name.sig stitem/$name - openssl base64 -A -in stitem/$name -out stitem/$name.b64 - openssl base64 -A -in stitem/$name.sig -out stitem/$name.sig.b64 - json=$(printf '{"item":"%s","signature":"%s","signature_scheme":%s,"chain":["%s"]}'\ - $(cat stitem/$name.b64)\ - $(cat stitem/$name.sig.b64)\ - $signature_scheme\ - $(cat $cert_path |\ - sed '1,1d;$ d' |\ - xargs |\ - sed 's/ //g')) - rm -f stitem/$name{,.sig,.b64,.sig.b64} -popd >/dev/null - -info "sending add-entry request" -curl --header "application/json" --request POST --data $json $base_url/add-entry -newline diff --git a/server/testdata/entry/README.md b/server/testdata/entry/README.md deleted file mode 100644 index 0d26ca3..0000000 --- a/server/testdata/entry/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Create `item` and `signature` for the add-entry endpoint - -## Create a serialized `checksum_v1` entry -The following creates a serialized `checksum_v1` StItem, such that the package -name is `foobar-0.0.1` and the checksum `SHA256(foobar-0.0.1)`. The result is -stored in the `stitem` directory as `foobar-0.0.1`. -``` -$ go run . --logtostderr --name foobar-0.0.1 --dir stitem -``` - -## Sign the generated file using an end-entity certificate -Let's use our ECDSA end-entity certificate using SHA256 as the hash function. -``` -$ openssl dgst -sha256 -sign "../chain/rgdd-ecdsa.key" -out stitem/foobar-0.0.1.sig stitem/foobar-0.0.1 -``` - -## Encode the resulting StItem and its signature as base-64 -``` -$ openssl base64 -A -in stitem/foobar-0.0.1 -out stitem/foobar-0.0.1.b64 -$ openssl base64 -A -in stitem/foobar-0.0.1.sig -out stitem/foobar-0.0.1.sig.b64 -``` diff --git a/server/testdata/entry/main.go b/server/testdata/entry/main.go deleted file mode 100644 index 7ab6d4d..0000000 --- a/server/testdata/entry/main.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -import ( - "flag" - "os" - - "crypto/sha256" - "io/ioutil" - - "github.com/golang/glog" - "github.com/system-transparency/stfe" -) - -var ( - name = flag.String("name", "foobar-1.2.3", "a package identifier") - dir = flag.String("dir", "stitem", "directory path where output is stored") -) - -func main() { - flag.Parse() - - // Use H(name) as a dummy checksum - hasher := sha256.New() - hasher.Write([]byte(*name)) - checksum := hasher.Sum(nil) - - // Create and serialize an StItem of type checksum_v1 - serialized, err := stfe.NewChecksumV1([]byte(*name), checksum).Marshal() - if err != nil { - glog.Fatalf("%v", err) - } - - // Store the serialized item in *dir/name - if err := os.MkdirAll(*dir, 0755); err != nil { - glog.Fatalf("creating directory %s failed: %v", *dir, err) - } - path := *dir + "/" + *name - if err := ioutil.WriteFile(path, serialized, 0644); err != nil { - glog.Fatalf("writing to %s failed: %v", path, err) - } - - glog.Infof("Created serialized checksum_v1 StItem: %s", path) - glog.Flush() -} diff --git a/server/testdata/entry/stitem/foobar-0.0.1 b/server/testdata/entry/stitem/foobar-0.0.1 deleted file mode 100644 index c667a36..0000000 Binary files a/server/testdata/entry/stitem/foobar-0.0.1 and /dev/null differ diff --git a/server/testdata/entry/stitem/foobar-0.0.1.b64 b/server/testdata/entry/stitem/foobar-0.0.1.b64 deleted file mode 100644 index be3c14e..0000000 --- a/server/testdata/entry/stitem/foobar-0.0.1.b64 +++ /dev/null @@ -1 +0,0 @@ -AAUMZm9vYmFyLTAuMC4xIHGVn/IR9o8GWqaDg88B65mgmWaY4+5EvQD12+c6/zgQ \ No newline at end of file diff --git a/server/testdata/entry/stitem/foobar-0.0.1.sig b/server/testdata/entry/stitem/foobar-0.0.1.sig deleted file mode 100644 index 12062a4..0000000 --- a/server/testdata/entry/stitem/foobar-0.0.1.sig +++ /dev/null @@ -1,3 +0,0 @@ -Kqx0||:YnYwڳQL1MV f7 h,##Pq)fZ<6JǗ;59h.'FLBW<:qJg^(>X i<Í=D]U. n7#T?UuΖW:BY'牛 *j:Bj]ȍE:.>Fg᭻ǰ 9=>`*|R Ǔ"{*ΠqÛF>27fSGzms`D=ч]S%$.lc_GHXbsB!=mLg?eJt6c[ΧD7nEdlRzV֔^9al%8H e -x&L -}-~,?Mz}Ni^˫,0)pz"w p'"!Z.xCc` ]Eb \ No newline at end of file diff --git a/server/testdata/entry/stitem/foobar-0.0.1.sig.b64 b/server/testdata/entry/stitem/foobar-0.0.1.sig.b64 deleted file mode 100644 index d31c0d3..0000000 --- a/server/testdata/entry/stitem/foobar-0.0.1.sig.b64 +++ /dev/null @@ -1 +0,0 @@ -A0uScXiGF4yusRyaMHx8+OSfOoua8Fnlblnf63fas/HTUUwxkE1W/Q0E1PjtymY3CcCXGK+WaJMslPeCIyPaUHEBnSnWZpHBGFrMCDzrNpCMmOjGGUrIx5c7CDU5l4xoxS4S/7Qa5CdGTPUQFYlCV80dPDpxSme3Xg6o3yipxT6OjhTw21gJaTzdA8ONPejvRBVdlgNVLgt/bqSCo+039SP/zFQOuD/uVXXOlp1XOkLaz1nPJ+eJmwwqagY6Qmpd/siNhkXROpXtLsU+RqSPZ+Gtu9AIB8ewCTk9wD66YCqmfLNSDceTiwIie7gUm60qmdXOoPCrFHGR0QQPD4D2l5eaHK/Dm0Y+F5UC4IkyN8cfqmYaU0eyem25wZnRc2DGy0Q9t9GHXapTJbQkLgVsY19HSJCOFpIfoVi6BmIWB8P8c0KgjrUWIT1tTL7V52cD6D9lpfZKl4J0NpmximO0w1vhkNj4kv7Op79E8jfjpv36mhdusbJFoGS7wGwIUnqk9oJWjPfWlJ//Xq05wwGvzmFsJYKe/DhIDJIXZQrJeCb+TAp9LeHH1H4ZiSzO5H/lmdY/TXod7YB9np7z6LrpTuRpXsurLPuCMPbMASmKkxlwetEigncgkQTH/ARwwK2/HieCIoAhWgEunbF4Q2NgC/T1DOLaXRNFF+TK4Pn+52I= \ No newline at end of file -- cgit v1.2.3