Introduce tool to create dfn-pki style certificate fingerprints
This commit is contained in:
parent
5d2f8cb1d3
commit
9985f29d21
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
reqfile=$1
|
||||
|
||||
if [[ ! -f "$reqfile" ]]; then
|
||||
echo "Given certificate request file does not exist: '$reqfile'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get fingerprint in format '(stdin)= dcfdf79ac7af887201b813b463051c42102a2ecd'
|
||||
result=$(openssl req -in "$reqfile" -pubkey -noout | openssl rsa -pubin -text -noout | sed -e '/Modulus:$/d' | sed -e 's/RSA Public-Key: (\(.*\))/Modulus (\1):/' | openssl sha1)
|
||||
|
||||
# Convert fingerprint to DFN-PKI format for readability
|
||||
echo "$result" | cut -d ' ' -f 2 | tr '[:lower:]' '[:upper:]' | sed 's/../&:/g;s/:$//'
|
Loading…
Reference in New Issue