aboutsummaryrefslogtreecommitdiff
path: root/server/testdata/cmd/add-entry
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-10-26 23:48:36 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-10-26 23:48:36 +0100
commit550f7878bf509cc825726e6d95506e62857d48c9 (patch)
treecd8799f666e905e86c5292063685ab961d7e0ffd /server/testdata/cmd/add-entry
parentace94cc001e51ef52aebf34c1fe39ad0f3501981 (diff)
tested certificate chain code path further
Added more documentation and quick helper scripts for now. We need to specify which signature schemes we expect/support from submitters.
Diffstat (limited to 'server/testdata/cmd/add-entry')
-rwxr-xr-xserver/testdata/cmd/add-entry34
1 files changed, 34 insertions, 0 deletions
diff --git a/server/testdata/cmd/add-entry b/server/testdata/cmd/add-entry
new file mode 100755
index 0000000..d7346bb
--- /dev/null
+++ b/server/testdata/cmd/add-entry
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -eo pipefail
+
+algo=ecdsa
+key_path="../chain/rgdd-$algo.key"
+cert_path="../chain/rgdd-$algo.pem"
+name="foobar-0.0.1"
+
+if [[ ! -z $1 ]]; then
+ name=$1
+fi
+echo "[Info] package name: $name" >&2
+
+
+echo "[Info] generating StItem and signature..." >&2
+pushd ../entry >/dev/null
+ 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","certificate":"%s"}'\
+ $(cat stitem/$name.b64)\
+ $(cat stitem/$name.sig.b64)\
+ $(cat $cert_path |\
+ sed '1,1d;$ d' |\
+ xargs |\
+ sed 's/ //g'))
+ rm -f stitem/$name{,.sig,.b64,.sig.b64}
+popd >/dev/null
+
+echo "[Info] doing add-entry request"
+curl --header "application/json" --request POST --data $json\
+ localhost:6965/st/v1/add-entry