Skip to content

Instantly share code, notes, and snippets.

@hermzz
Last active December 17, 2015 18:59
Show Gist options
  • Select an option

  • Save hermzz/5656753 to your computer and use it in GitHub Desktop.

Select an option

Save hermzz/5656753 to your computer and use it in GitHub Desktop.

Use namespace SSL cert

cat $HOST.key $HOST.crt > $HOST.pem
cat AddTrustExternalCARoot.crt COMODORSA* > sslbundle.crt

Generate self-signed SSL cert

openssl genrsa -des3 -passout pass:x -out $HOST.pass.key 2048
openssl rsa -passin pass:x -in $HOST.pass.key -out $HOST.key
rm $HOST.pass.key
openssl req -new -key $HOST.key -out $HOST.csr
openssl x509 -req -days 365 -in $HOST.csr -signkey $HOST.key -out $HOST.crt
cat $HOST.key $HOST.crt > $HOST.pem

Importing cert into chrome

openssl s_client -connect $HOST:443 -showcerts > temporary_file
certutil -d sql:$HOME/.pki/nssdb -A -t CP,,C -n "$HOST -i temporary_file

Importing into Linux

cp $HOST.crt /usr/share/ca-certificates
echo "$HOST.crt" >> /etc/ca-certificates.conf
update-ca-certificates --fresh

Importing into Android

Copy $HOST.crt file to device, then import through Settings > Security > Install from storage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment