23 lines
315 B
Bash
Executable file
23 lines
315 B
Bash
Executable file
#!/bin/bash
|
|
|
|
if [[ -z $1 ]] ; then
|
|
echo "usage: $0 <file.crt>"
|
|
exit 1
|
|
fi
|
|
|
|
FILE=$1
|
|
|
|
if [[ ! -f $FILE ]] ; then
|
|
echo "File $FILE does not exist"
|
|
exit 2
|
|
fi
|
|
|
|
openssl x509 -in $FILE -noout -text \
|
|
| grep -A1 'Serial Number' \
|
|
| tail -1 \
|
|
| tr ':' "\n" \
|
|
| while read B ; do
|
|
#echo $B
|
|
printf "\x$B"
|
|
done
|
|
echo
|