Skip to content

Instantly share code, notes, and snippets.

@sopsmattw
Forked from richieforeman/makeauthority.sh
Created April 5, 2017 21:36
Show Gist options
  • Save sopsmattw/354c05650203483cea63dd1f5614679e to your computer and use it in GitHub Desktop.
Save sopsmattw/354c05650203483cea63dd1f5614679e to your computer and use it in GitHub Desktop.
Issue Your Own Self-Signed S/MIME Certs with OpenSSL
# Run this once
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
# Run this for each email account. The system must install the CA cert and the resulting p12 file in order to be happy.
# Borrowed from http://serverfault.com/questions/103263/can-i-create-my-own-s-mime-certificate-for-email-encryption
openssl genrsa -des3 -out smime.key 4096
openssl req -new -key smime.key -out smime.csr
openssl x509 -req -days 365 -in smime.csr -CA ca.crt -CAkey ca.key -set_serial 1 -out smime.crt -setalias "Self Signed SMIME" -addtrust emailProtection -addreject clientAuth -addreject serverAuth -trustout
openssl pkcs12 -export -in smime.crt -inkey smime.key -out smime.p12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment