samples: Escape the GnuTLS PKCS11 URL before using in command line

GnuTLS PKCS11 URLs have ';' in the string that we need to preserve for
passing to GnuTLS. So we escape the semicolons before using them on the
command line.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2018-10-22 18:17:00 -04:00 committed by Stefan Berger
parent eaf2a1db22
commit ccb00a55cd

View File

@ -114,6 +114,12 @@ get_config_value() {
return 0
}
# Escape the GnuTLS PKCS11 URL
# @param1: The string with the GnuTLS PKCS11 URL
escape_pkcs11_url() {
echo "$1" | sed 's/;/\\;/g'
}
make_dir() {
local dir="$1"
@ -232,7 +238,7 @@ create_cert() {
$options \
$tpm_spec_params \
$tpm_attr_params \
--signkey ${SIGNKEY} \
--signkey "$(escape_pkcs11_url ${SIGNKEY})" \
--issuercert ${ISSUERCERT} \
--out-cert ${dir}/ek.cert \
$keyparms \