-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-certificate.sh
24 lines (17 loc) · 965 Bytes
/
generate-certificate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
echo Generate CA key:
openssl ecparam -name prime256v1 -genkey -out ca.key
echo Generate CA certificate:
openssl req -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=FR/ST=PE/L=Recife/O=Hikers/OU=DevTeam/CN=server"
echo Generate server key:
openssl ecparam -name prime256v1 -genkey -out server.key
echo Generate server signing request:
openssl req -new -key server.key -out server.csr -subj "/C=FR/ST=PE/L=Recife/O=Hikers/OU=DevTeam/CN=server"
echo Self-sign server certificate:
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
echo Generate client key
openssl ecparam -name prime256v1 -genkey -out client.key
echo Generate client signing request:
openssl req -new -key client.key -out client.csr -subj "/C=FR/ST=PE/L=Recife/O=Hikers/OU=DevTeam/CN=client"
echo Self-sign client certificate:
openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt