#!/bin/sh

harsafile=/tmp/sudi_certs/sudi-harsa-cert.der
rsafile=/tmp/sudi_certs/sudi-rsa-cert.der
eccfile=/tmp/sudi_certs/sudi-ecc-cert.der

if [ $# -gt 0 ] && [ $1 == "HARSA" ]; then
    certfile="$harsafile"
elif [ $# -gt 0 ] && [ $1 == "RSA" ]; then
    certfile="$rsafile"
elif [ $# -gt 0 ] && [ $1 == "ECC" ]; then
    certfile="$eccfile"
else
    echo "Invalid type"
    exit 0
fi

echo "$1:"
if [ -s $certfile ]; then
    echo "----------------------------- Device Certificate -----------------------------"
    openssl x509 -inform der -in $certfile -noout -text
    echo "------------------------------------------------------------------------------"
else
    echo "Not found"
    exit 0
fi

