2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2024-12-25 04:03: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)
if [[ $certs_found -gt 0 ]]; then
local ossl_out=$(${OPENSSLBIN} x509 -noout -text 2>/dev/null <<<"${current_raw_certificates[0]}")
local regex='Signature Algorithm[^ ]+ +(.+$)'
while read data; do
if [[ $data =~ Signature\ Algorithm ]]; then
local match=($data)
unset match[0]
unset match[1]
join_array_by_char '_' "${match[@]}"
current_sigalg="$joined_array"
if [[ $data =~ $regex ]]; then
current_sigalg="${BASH_REMATCH[1]// /_}"
fi
done <<<"$ossl_out"
fi