Fix CNs for agent keys; can't be the same as CA's CN
[platform/upstream/nodejs.git] / test / fixtures / keys / Makefile
1 all: agent1-cert.pem agent2-cert.pem agent3-cert.pem
2
3
4 #
5 # Create Certificate Authority: ca1
6 # ('password' is used for the CA password.)
7 #
8 ca1-cert.pem: ca1.cnf
9         openssl req -new -x509 -config ca1.cnf -keyout ca1-key.pem -out ca1-cert.pem
10
11 #
12 # Create Certificate Authority: ca2
13 # ('password' is used for the CA password.)
14 #
15 ca2-cert.pem: ca2.cnf
16         openssl req -new -x509 -config ca2.cnf -keyout ca2-key.pem -out ca2-cert.pem
17
18
19 #
20 # agent1 is signed by ca1.
21 #
22
23 agent1-key.pem:
24         openssl genrsa -out agent1-key.pem
25
26 agent1-csr.pem: agent1.cnf agent1-key.pem
27         openssl req -new -config agent1.cnf -key agent1-key.pem -out agent1-csr.pem
28
29 agent1-cert.pem: agent1-csr.pem ca1-cert.pem ca1-key.pem
30         openssl x509 -req \
31                 -passin "pass:password" \
32                 -in agent1-csr.pem \
33                 -CA ca1-cert.pem \
34                 -CAkey ca1-key.pem \
35                 -CAcreateserial \
36                 -out agent1-cert.pem
37
38 #
39 # agent2 has a self signed cert
40 #
41 # Generate new private key
42 agent2-key.pem:
43         openssl genrsa -out agent2-key.pem
44
45 # Create a Certificate Signing Request for the key
46 agent2-csr.pem: agent2-key.pem agent2.cnf
47         openssl req -new -config agent2.cnf -key agent2-key.pem -out agent2-csr.pem
48
49 # Create a Certificate for the agent.
50 agent2-cert.pem: agent2-csr.pem agent2-key.pem
51         openssl x509 -req \
52                 -in agent2-csr.pem \
53                 -signkey agent2-key.pem \
54                 -out agent2-cert.pem
55
56
57 #
58 # agent3 is signed by ca2.
59 #
60
61 agent3-key.pem:
62         openssl genrsa -out agent3-key.pem
63
64 agent3-csr.pem: agent3.cnf agent3-key.pem
65         openssl req -new -config agent3.cnf -key agent3-key.pem -out agent3-csr.pem
66
67 agent3-cert.pem: agent3-csr.pem ca2-cert.pem ca2-key.pem
68         openssl x509 -req \
69                 -passin "pass:password" \
70                 -in agent3-csr.pem \
71                 -CA ca2-cert.pem \
72                 -CAkey ca2-key.pem \
73                 -CAcreateserial \
74                 -out agent3-cert.pem
75
76 # TODO: agent on CRL
77
78
79 clean:
80         rm -f *.pem *.srl
81
82
83 .PHONY: all clean