#!/bin/sh # # Author: Roumen Petrov, Sofia, Bulgaria # Version: 1.2, 2004-11-09 # # Placed in the Public Domain. # CRTFILE="$1" if test "x${CRTFILE}" = "x" ; then echo "usage: $0 der_certificate_file" >&2 exit 1 fi if test ! -r "${CRTFILE}" ; then echo "error:file ${CRTFILE} not found or not readable" >&2 exit 1 fi ( #=== print distinguished name enclosed in '[' and ']' IFS=' ' SUBJECT=`openssl x509 -in "${CRTFILE}" -inform DER -noout -subject` || exit $? printf "\n[%s]\n" `echo ${SUBJECT} | sed -e 's|^subject= *||'` ) && ( #=== print x509=certificate_on_only_one_line openssl x509 -in "${CRTFILE}" -inform DER | grep -v '^-----' | ( printf 'x509=' while read line; do printf '%s' $line done printf '\n' ) ) && ( #=== print additional options cat <