abuild/tests/bin/openssl

45 lines
635 B
Bash
Executable File

#!/bin/sh
# fake openssl
while [ $# -gt 0 ]; do
case "$1" in
genrsa|rsa|req)
cmd="$1"
;;
-config)
shift
config="$1"
;;
-out)
shift
outfile="$1"
;;
-in)
shift
infile="$1"
esac
shift
done
case "$cmd" in
genrsa)
cat "$FAKEKEY" > "$outfile"
;;
rsa)
echo "writing RSA key" >&2
cat "$FAKEKEYPUB" > "$outfile"
;;
req)
echo "Using configuration from $config" >&2
echo "Generating RSA key with 4096 bits" >&2
echo "Writing private key to '$outfile'" >&2
cat "$FAKEKEY" "$FAKEKEYPUB" > "$outfile"
;;
*)
echo "unimplemented fake openssl command: $cmd" >&2
exit 1
;;
esac