-
Notifications
You must be signed in to change notification settings - Fork 8
/
r_dump
executable file
·32 lines (28 loc) · 913 Bytes
/
r_dump
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /bin/sh
# r_dump (Bourne shell script) -- Dumps info about PEM-format X.509 certificate request(s)
#
# Tolerates failure to open a file by not showing anything other than the
# openssl error.
# Accepts "-" as an argument to read that cert from stdin.
# By default, reads a cert from stdin.
if [ $# -eq 0 ] ; then
set -- -
fi
# Similar to "-nameopt RFC2253" but with semicolons and without dn_rev
OPTS="-nameopt esc_2253,esc_ctrl,esc_msb,utf8,dump_nostr,dump_unknown,dump_der,sep_semi_plus_space,sname"
for file do
if [ -n "$prevfile" ] ; then
echo "--------"
fi
prevfile="$file" # Do this here to avoid missing out in case of openssl error
if [ "$file" = - ] ; then
info="$(openssl req -text $OPTS -noout)"
else
if ! info="$(openssl req -text $OPTS -noout -in "$file")"
then
continue
fi
fi
# TO-DO: Uses $file in less prompt
echo "$info" | ${PAGER:-less}
done