make-ca: Use get_p11_label() for certificate name in output of local certs.

This commit is contained in:
DJ Lucas 2021-08-04 20:35:31 -05:00
parent 7d263b7491
commit fd033af881

View File

@ -732,11 +732,13 @@ if test -d "${LOCALDIR}"; then
echo "Processing local certificates..." echo "Processing local certificates..."
for cert in `find "${LOCALDIR}" -name "*.pem"`; do for cert in `find "${LOCALDIR}" -name "*.pem"`; do
# Get some information about the certificate # Get some information about the certificate
get_p11_label ${cert}
keyhash=$("${OPENSSL}" x509 -noout -in "${cert}" -hash) keyhash=$("${OPENSSL}" x509 -noout -in "${cert}" -hash)
subject=$("${OPENSSL}" x509 -noout -in "${cert}" -subject) subject=$("${OPENSSL}" x509 -noout -in "${cert}" -subject)
if test "${p11label}" == ""; then
# This will always be OpenSSL, values will be separated by spaces # This will always be OpenSSL, values will be separated by spaces
certname=$( echo "${subject}" | grep -o "CN = .*" | sed 's@CN = @@' | cut -d "," -f 1) p11label=$( echo "${subject}" | grep -o "CN = .*" | sed 's@CN = @@' | cut -d "," -f 1)
fi
echo "Certificate: ${certname}" echo "Certificate: ${certname}"
echo "Keyhash: ${keyhash}" echo "Keyhash: ${keyhash}"
@ -774,9 +776,6 @@ if test -d "${LOCALDIR}"; then
certcer="$(${OPENSSL} x509 -in ${cert})" certcer="$(${OPENSSL} x509 -in ${cert})"
certtxt="$(${OPENSSL} x509 -in ${cert} -noout -text)" certtxt="$(${OPENSSL} x509 -in ${cert} -noout -text)"
# Place certificate into trust anchors dir
get_p11_label "${cert}"
# Get p11 trust and OID values # Get p11 trust and OID values
get_p11_trust get_p11_trust