aboutsummaryrefslogtreecommitdiff
path: root/tests/Makefile
blob: 545114f11563aa656bd0e6501a8a7a8445dc2a07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
.POSIX:

leaf.csr: leaf.key leaf.csr.cnf
	openssl req -new -key leaf.key -out leaf.csr -config leaf.csr.cnf

leaf.key:
	openssl genrsa -out leaf.key 4096

sub.crt.tar: sub.csr ca.cnf
	rm -rf subcrts
	mkdir subcrts
	mkdir -p newcerts
	touch index.txt
	EXT=normal; openssl ca -batch -config ca.cnf -extensions extensions_sub_$$EXT -notext -rand_serial -in sub.csr -out subcrts/$$EXT.crt
	EXT=basic_constraints_no; openssl ca -batch -config ca.cnf -extensions extensions_sub_$$EXT -notext -rand_serial -in sub.csr -out subcrts/$$EXT.crt
	EXT=basic_constraints_wrong; openssl ca -batch -config ca.cnf -extensions extensions_sub_$$EXT -notext -rand_serial -in sub.csr -out subcrts/$$EXT.crt
	EXT=key_usage_missing; openssl ca -batch -config ca.cnf -extensions extensions_sub_$$EXT -notext -rand_serial -in sub.csr -out subcrts/$$EXT.crt
	EXT=key_usage_wrong_1; openssl ca -batch -config ca.cnf -extensions extensions_sub_$$EXT -notext -rand_serial -in sub.csr -out subcrts/$$EXT.crt
	EXT=key_usage_wrong_2; openssl ca -batch -config ca.cnf -extensions extensions_sub_$$EXT -notext -rand_serial -in sub.csr -out subcrts/$$EXT.crt
	EXT=key_usage_wrong_3; openssl ca -batch -config ca.cnf -extensions extensions_sub_$$EXT -notext -rand_serial -in sub.csr -out subcrts/$$EXT.crt
	openssl ca -batch -config ca.cnf -notext -rand_serial -in sub.csr -out subcrts/v1.crt
	tar cvf sub.crt.tar subcrts/
	rm -rf subcrts/

sub.crt: sub.csr
	mkdir -p newcerts
	touch index.txt
	openssl ca \
		-verbose \
		-config ca.cnf \
		-extensions extensions_sub \
		-notext \
		-rand_serial \
		-in sub.csr \
		-out sub.crt

ca.crt:
	openssl req \
		-verbose \
		-config ca.cnf \
		-new \
		-x509 \
		-key ca.key \
		-days 9132 \
		-out ca.crt

ca.key:
	openssl ecparam -name P-256 -genkey -out ca.key

crlnumber:
	echo 0000 > crlnumber

reset:
	echo "!!! THIS WILL RESET EVERYTHING, INCLUDING PRIVATE KEYS !!!"
	# sleep 5
	rm -rf newcerts serial index.txt private certs sub.csr crlnumber* ca.crl ca.crt sub.crt ca.key index.txt.old subcrts/