blob: 5fddc6b1d60f506cb438f01ecadf8b03d0a9390b [file] [log] [blame]
Filip Krzywka93185782018-08-06 09:31:40 +02001FILE=sample
2CA_PASSWD=onap
3SUBJ=/C=PL/ST=DL/L=Wroclaw/O=Nokia/OU=MANO
4CA=trust
5
6sign: $(FILE).crt
7
8clean:
9 rm -f *.crt *.key *.srl *.csr
10
11generate-ca-certificate: $(CA).crt
12
13generate-private-key: $(FILE).key
14
15create-public-key: $(FILE).pub
16
17create-sign-request: $(FILE).csr
18
19$(CA).crt:
20 openssl req -new -x509 -keyout $(CA).key -out $(CA).crt -days 365 -passout pass:$(CA_PASSWD) -subj "$(SUBJ)"
21
22$(FILE).key:
23 openssl genpkey -algorithm RSA -out $(FILE).key -pkeyopt rsa_keygen_bits:2048
24
25$(FILE).pub: $(FILE).key
26 openssl x509 -req -days 360 -in client.csr -CA $(CA).crt -CAkey $(CA).key -CAcreateserial -out client.crt
27
28$(FILE).csr: $(FILE).key
29 openssl req -new -sha256 -key $(FILE).key -out $(FILE).csr -subj "$(SUBJ)"
30
31$(FILE).crt: $(CA).crt $(FILE).csr
32 openssl x509 -req -days 360 -in $(FILE).csr -CA $(CA).crt -CAkey $(CA).key -out $(FILE).crt -CAcreateserial -passin pass:$(CA_PASSWD)