Skip to content

Commit

Permalink
Support prefixing key names in keygen script.
Browse files Browse the repository at this point in the history
Changelog: None

Signed-off-by: Eystein Måløy Stenberg <[email protected]>
(cherry picked from commit d667992)
  • Loading branch information
estenberg committed May 25, 2018
1 parent 520c938 commit 969a84a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions support/keygen-client
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/bash
set -e

FILE_NAME_PRIVATE_KEY="private.key"
FILE_NAME_PUBLIC_KEY="public.key"
if [[ $PREFIX_KEY = *"/"* ]]; then
echo "ERROR: Environment variable PREFIX_KEY contains path separators: $PREFIX_KEY"
echo "Example: PREFIX_KEY=\"0001-\" $0"
exit 1
fi

PRIVATE_KEY="private.key"
PUBLIC_KEY="public.key"

FILE_NAME_PRIVATE_KEY="$PREFIX_KEY$PRIVATE_KEY"
FILE_NAME_PUBLIC_KEY="$PREFIX_KEY$PUBLIC_KEY"

# verify openssl is present and sufficiently recent (genpkey seems to require openssl 1.0+)
command -v openssl >/dev/null 2>&1 || { echo >&2 "ERROR: Please install the openssl utility version 1.0.0 or newer to generate keys."; exit 1; }
Expand Down

0 comments on commit 969a84a

Please sign in to comment.