comparison ssl_certificate_chain.t @ 1220:0af58b78df35

Tests: removed single quotes from system() calls. Single quotes were used to escape paths with spaces but are neither supported in the Windows CMD shell, nor sufficient without proper %%TESTDIR%% expansion.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 20 Sep 2017 14:46:51 +0300
parents 8ef51dbb5d69
children 8c764fd93b5e
comparison
equal deleted inserted replaced
1219:f373a718f646 1220:0af58b78df35
99 basicConstraints = critical,CA:TRUE 99 basicConstraints = critical,CA:TRUE
100 EOF 100 EOF
101 101
102 foreach my $name ('root') { 102 foreach my $name ('root') {
103 system('openssl req -x509 -new ' 103 system('openssl req -x509 -new '
104 . "-config '$d/openssl.conf' -subj '/CN=$name/' " 104 . "-config $d/openssl.conf -subj /CN=$name/ "
105 . "-out '$d/$name.crt' -keyout '$d/$name.key' " 105 . "-out $d/$name.crt -keyout $d/$name.key "
106 . ">>$d/openssl.out 2>&1") == 0 106 . ">>$d/openssl.out 2>&1") == 0
107 or die "Can't create certificate for $name: $!\n"; 107 or die "Can't create certificate for $name: $!\n";
108 } 108 }
109 109
110 foreach my $name ('int', 'end') { 110 foreach my $name ('int', 'end') {
111 system("openssl req -new " 111 system("openssl req -new "
112 . "-config '$d/openssl.conf' -subj '/CN=$name/' " 112 . "-config $d/openssl.conf -subj /CN=$name/ "
113 . "-out '$d/$name.csr' -keyout '$d/$name.key' " 113 . "-out $d/$name.csr -keyout $d/$name.key "
114 . ">>$d/openssl.out 2>&1") == 0 114 . ">>$d/openssl.out 2>&1") == 0
115 or die "Can't create certificate for $name: $!\n"; 115 or die "Can't create certificate for $name: $!\n";
116 } 116 }
117 117
118 $t->write_file('certserial', '1000'); 118 $t->write_file('certserial', '1000');
119 $t->write_file('certindex', ''); 119 $t->write_file('certindex', '');
120 120
121 system("openssl ca -batch -config '$d/ca.conf' " 121 system("openssl ca -batch -config $d/ca.conf "
122 . "-keyfile '$d/root.key' -cert '$d/root.crt' " 122 . "-keyfile $d/root.key -cert $d/root.crt "
123 . "-subj '/CN=int/' -in '$d/int.csr' -out '$d/int.crt' " 123 . "-subj /CN=int/ -in $d/int.csr -out $d/int.crt "
124 . ">>$d/openssl.out 2>&1") == 0 124 . ">>$d/openssl.out 2>&1") == 0
125 or die "Can't sign certificate for int: $!\n"; 125 or die "Can't sign certificate for int: $!\n";
126 126
127 system("openssl ca -batch -config '$d/ca.conf' " 127 system("openssl ca -batch -config $d/ca.conf "
128 . "-keyfile '$d/int.key' -cert '$d/int.crt' " 128 . "-keyfile $d/int.key -cert $d/int.crt "
129 . "-subj '/CN=end/' -in '$d/end.csr' -out '$d/end.crt' " 129 . "-subj /CN=end/ -in $d/end.csr -out $d/end.crt "
130 . ">>$d/openssl.out 2>&1") == 0 130 . ">>$d/openssl.out 2>&1") == 0
131 or die "Can't sign certificate for end: $!\n"; 131 or die "Can't sign certificate for end: $!\n";
132 132
133 $t->write_file('end-int.crt', 133 $t->write_file('end-int.crt',
134 $t->read_file('end.crt') . $t->read_file('int.crt')); 134 $t->read_file('end.crt') . $t->read_file('int.crt'));