#!/bin/bash # This script converts a certificate from the PEM format to the DER format # (Windows works with certificates in both DER and PEM format, # but the PEM format certificates must have the .CRT extension instead of .PEM) # (C) 2005 Digithell, Inc. (Pavel Strachota, FNSPE CTU) if [ -z "$1" ] then echo synopsis: pem2der certificate_fle else pem_file=$1 der_file=${pem_file%".pem"}".der" openssl x509 -in $pem_file -inform PEM -out $der_file -outform DER fi