#!/bin/bash # This self-signs the certificate request generated using an encrypted private key # the output goes to the file with the same name as the certificate request, but with the # .pem extension instead of .csr # The password in the supplied file relates to the private key that is used for the # signature! # (C) 2005 Digithell, Inc. (Pavel Strachota, FNSPE CTU) if [ -z "$1" ] then echo synopsis: ssignreqp [request_file] [private_key_file] [password_file] req_file="my_cert.csr" else req_file=$1 fi if [ -z "$2" ] then key_file="my_key.pem" else key_file=$2 fi if [ -z "$3" ] then password_file="Pass.txt" else password_file=$3 fi cert_file=${req_file%".csr"}".pem" echo "Using cert request file: " $req_file echo "Using key file: " $key_file echo "Using password file: " $password_file echo "Using output file: " $cert_file echo echo openssl req -config ./SSL_config -x509 -in $req_file -out $cert_file -passin file:$password_file -key $key_file