Piotr Jaszczyk | a4becf2 | 2018-05-29 13:35:11 +0200 | [diff] [blame] | 1 | FILE=sample |
| 2 | CA_PASSWD=onap |
| 3 | SUBJ=/C=PL/ST=DL/L=Wroclaw/O=Nokia/OU=MANO |
Jakub Dudycz | 8543949 | 2018-06-08 12:57:13 +0200 | [diff] [blame] | 4 | CA=trust |
Piotr Jaszczyk | a4becf2 | 2018-05-29 13:35:11 +0200 | [diff] [blame] | 5 | |
| 6 | sign: $(FILE).crt |
| 7 | |
| 8 | clean: |
| 9 | rm -f *.crt *.key *.srl *.csr |
| 10 | |
| 11 | generate-ca-certificate: $(CA).crt |
| 12 | |
| 13 | generate-private-key: $(FILE).key |
| 14 | |
| 15 | create-public-key: $(FILE).pub |
| 16 | |
| 17 | create-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) |
| 33 | |