1#!/bin/bash 2 3openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \ 4 -keyout privatekey.pem -out publickey.pem \ 5 -subj "/CN=unit-tests" 6 7openssl pkcs12 -export -out privatekey.p12 \ 8 -inkey privatekey.pem -in publickey.pem \ 9 -name "key" -passout pass:notasecret 10 11openssl pkcs12 -in privatekey.p12 \ 12 -nodes -nocerts -passout pass:notasecret \ 13 -passin pass:notasecret > pem_from_pkcs12.pem