#!/bin/sh ALGO=$1 set -e # Exit on error # --- echo echo "----------------------------" echo echo "Test run with algorithm: $ALGO" echo # Use token export SERIAL=$(cargo run -- list|grep Serial|sed s/Serial\ //|sed s/\:.*//) cp cli/ci/keys/"$ALGO".key /tmp/janus.key rm --force /tmp/janus.cert && sq key extract-cert --output /tmp/janus.cert /tmp/janus.key echo echo "--- uploading keys" echo cargo run -- upload --serial $SERIAL --slot sig --key /tmp/janus.key cargo run -- upload --serial $SERIAL --slot dec --key /tmp/janus.key echo echo "--- signing test" echo echo "hello world" | cargo run -- sign --serial $SERIAL --cert /tmp/janus.cert > /tmp/detached-sig echo "hello world" | sq verify --signer-cert /tmp/janus.cert --detached /tmp/detached-sig echo echo "--- decryption test" echo echo "hello world" | sq encrypt --recipient-cert /tmp/janus.cert > /tmp/encrypted cat /tmp/encrypted | cargo run -- decrypt --serial $SERIAL --cert /tmp/janus.cert | grep -q "hello world"