Add private keys and generation scripts for test certificates in apps
[openssl.git] / demos / certs / mkcerts.sh
1 #!/bin/sh
2
3 OPENSSL=openssl
4
5 # Root CA: create certificate directly
6 CN="Test Root CA" $OPENSSL req -config ca.cnf -x509 -nodes \
7         -keyout root.pem -out root.pem -newkey rsa:2048 -days 3650
8 # Server certificate: create request first
9 CN="Test Server Cert" $OPENSSL req -config ca.cnf -nodes \
10         -keyout skey.pem -out req.pem -newkey rsa:1024
11 # Sign request: end entity extensions
12 $OPENSSL x509 -req -in req.pem -CA root.pem -days 3600 \
13         -extfile ca.cnf -extensions usr_cert -CAcreateserial -out server.pem
14 # Intermediate CA: request first
15 CN="Test Intermediate CA" $OPENSSL req -config ca.cnf -nodes \
16         -keyout intkey.pem -out intreq.pem -newkey rsa:2048
17 # Sign request: CA extensions
18 $OPENSSL x509 -req -in intreq.pem -CA root.pem -days 3600 \
19         -extfile ca.cnf -extensions v3_ca -CAcreateserial -out intca.pem
20 # Client certificate: request first
21 CN="Test Client Cert" $OPENSSL req -config ca.cnf -nodes \
22         -keyout ckey.pem -out creq.pem -newkey rsa:1024
23 # Sign using intermediate CA
24 $OPENSSL x509 -req -in creq.pem -CA intca.pem -CAkey intkey.pem -days 3600 \
25         -extfile ca.cnf -extensions usr_cert -CAcreateserial -out client.pem