openssl: self-signed certificate + .pfx

without CA

openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
openssl pkcs12 -passout pass:password -export -out server.pfx -inkey server.key -in server.crt

with CA

openssl req -new -x509 -extensions v3_ca -keyout ca.key -out ca.crt -days 3650
openssl genrsa -out certificate.key 1024
openssl req -new -key certificate.key -out certificate.csr
openssl x509 -req -days 365 -in certificate.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out certificate.crt
openssl pkcs12 -passout pass:password -export -out certificate.p12 -inkey certificate.key -in certificate.crt -chain -CAfile ca.crt

Leave a Reply

Your email address will not be published. Required fields are marked *