Skip to content

Instantly share code, notes, and snippets.

@siburu
Created November 30, 2015 09:56
Show Gist options
  • Save siburu/bb162362a8ee9ae35bfe to your computer and use it in GitHub Desktop.
Save siburu/bb162362a8ee9ae35bfe to your computer and use it in GitHub Desktop.
#!/bin/sh
# This script explains how to generate a self signed certificate (DER format).
if [ $# = 0 ]
then
echo 'Usage: $0 <name>'
exit 1
fi
name=$1
tmpkey=`mktemp -t ca.key`
openssl genrsa -aes256 -out $tmpkey 2048
openssl req -new -key $tmpkey -out $name.csr
openssl rsa -in $tmpkey -out $name.key -outform der
rm $tmpkey
openssl x509 -req -days 3650 -in $name.csr -signkey $name.key -keyform der -out $name.crt -outform der
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment