mirror of
https://github.com/mozilla/cipherscan.git
synced 2024-11-22 22:33:40 +01:00
Simplify signature algorithm extraction to use a capturing regex and string substitution.
This commit is contained in:
parent
2764a16693
commit
871ad92ae2
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user