From 969a84aa4560234b79e1e90772eba9ab6f99759a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eystein=20M=C3=A5l=C3=B8y=20Stenberg?= Date: Tue, 15 May 2018 17:10:54 -0700 Subject: [PATCH] Support prefixing key names in keygen script. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: None Signed-off-by: Eystein Måløy Stenberg (cherry picked from commit d667992ae1b8b63c7b5e39e990e449ae3dcfc2ce) --- support/keygen-client | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/support/keygen-client b/support/keygen-client index 10b7a99e0..8e5cfdb7f 100755 --- a/support/keygen-client +++ b/support/keygen-client @@ -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; }