2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2024-11-26 07:53:41 +01:00

Simplify signature algorithm extraction to use a capturing regex and string substitution.

This commit is contained in:
Richard Soderberg 2015-09-05 03:13:46 -07:00
parent 2764a16693
commit 871ad92ae2

View File

@ -444,13 +444,10 @@ parse_openssl_output() {
# the signature algorithm on it (it's the server's certificate) # the signature algorithm on it (it's the server's certificate)
if [[ $certs_found -gt 0 ]]; then if [[ $certs_found -gt 0 ]]; then
local ossl_out=$(${OPENSSLBIN} x509 -noout -text 2>/dev/null <<<"${current_raw_certificates[0]}") local ossl_out=$(${OPENSSLBIN} x509 -noout -text 2>/dev/null <<<"${current_raw_certificates[0]}")
local regex='Signature Algorithm[^ ]+ +(.+$)'
while read data; do while read data; do
if [[ $data =~ Signature\ Algorithm ]]; then if [[ $data =~ $regex ]]; then
local match=($data) current_sigalg="${BASH_REMATCH[1]// /_}"
unset match[0]
unset match[1]
join_array_by_char '_' "${match[@]}"
current_sigalg="$joined_array"
fi fi
done <<<"$ossl_out" done <<<"$ossl_out"
fi fi