summaryrefslogtreecommitdiffstats
path: root/tests/gnutls-cli-rawpk.sh
blob: 90fde68c46045f6fadf631018a59fbf853ffea5c (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
#!/bin/sh

# Copyright (C) 2019 Tom Vrancken (dev@tomvrancken.nl)
#
# Author: Tom Vrancken
#         Nikos Mavrogiannopoulos
#
# This file is part of GnuTLS.
#
# GnuTLS is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GnuTLS is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>

: ${srcdir=.}
: ${SERV=../src/gnutls-serv${EXEEXT}}
: ${CLI=../src/gnutls-cli${EXEEXT}}
unset RETCODE
CERTFILE1=rawpk-script1.$$.pem.tmp
CERTFILE2=rawpk-script2.$$.pem.tmp

TMPFILE=rawpk-script.$$.log

if ! test -x "${SERV}"; then
	exit 77
fi

if ! test -x "${CLI}"; then
	exit 77
fi

if test "${WINDIR}" != ""; then
	exit 77
fi 

if ! test -z "${VALGRIND}"; then
	VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=15"
fi

SERV="${SERV} -q"

. "${srcdir}/scripts/common.sh"

echo "Checking whether we can connect with raw public-keys"

cat <<__EOF__ >${CERTFILE1}
-----BEGIN CERTIFICATE-----
MIIEXDCCAsSgAwIBAgIIWkcxay17JgYwDQYJKoZIhvcNAQELBQAwQjEaMBgGA1UE
AxMRdGVzdC1hbGwtZGVmYXVsdHMxCzAJBgNVBAYTAkFUMRcwFQYKCZImiZPyLGQB
GRYHYmVidC5kZTAeFw0xNzEyMzAwNjI1NDhaFw0xOTEyMjAwNjI1NTFaMEIxGjAY
BgNVBAMTEXRlc3QtYWxsLWRlZmF1bHRzMQswCQYDVQQGEwJBVDEXMBUGCgmSJomT
8ixkARkWB2JlYnQuZGUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCv
M1Y+Q4goCtHi3SLHTBQ14LS6NI4UbEa8YZFfaOfmOOufzwdNUntUkSA2PPS7mQ55
SN+Sdel1x4f4EjfxCWhj0j0Y26OmJS+wYNz3oOdoKThLq4Mn5SumO7mhU684mZTi
EP2qrxFeYvQqQBdjv8rfP2LJ+RsB/3CiwWdkx4qeudoSUCqzWo8e6K2ul0JJuk+Z
fvqkPpDl+cVTikmxNwqjAt4Ef9oiT1YjUIBUae+RCdNZEa6d2AhW+4bD+vl0Pci+
EBPzhLeR8iYuIEX66Tpv8AUvv412SuvVZbizGP5EDH4gkWtNWem9yNP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OY8ciWIpahFc796prk17ZgIn/t0hebc9ZTaIat5QKbr4SWLZJEl
i2yISkQxkJZp8sTwSlIGZSBpuZcDq9AdUjan1WhGgl4hpHpjr3Y=
-----END RSA PRIVATE KEY-----
__EOF__

cat <<__EOF__ >${CERTFILE2}
-----BEGIN PUBLIC KEY-----
MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAtfCQ/U13p076UUEggNm8
mI+bEilHrvKiyZpY/NZ2JYhmU+n0ChuH6XweXuiuW2gKR/Fl0vpGAxhugQAR3lMS
0XJZjg4z1gFP0BMeR0YYQuWe2Gfg24fUNPluHCf+dJMHAadIVKyUvVKFPDTwu6yU
lVafn0uoMme8b51yAwQAeXGOJnTFHSaRhuDWAokaTsW0kdAr5FSxMadSTVuDNSav
ic6qSUimJvPjT+URzpIjy/2MG8aj00At1MSj8sC/g5JuBvMKXe4mg6/Xd1YsP9gT
GhpfuBzwt+H4HDm4MzwNqdWNJ7pAhdcBOztqsScZJUqmGT742Fr0OjYYOFvHYLcx
SMD65huLlKTiQwg0HocVFA/VilLLV65cW+AUakr0YCXKyucPz4omVy/RINi663Bn
UyIR3pkOwbr71syuiU1S9cMnG0BxHsPmbvgaYttnCwp0cexB8MrJNJv5FcKLOGUL
MMCvSIT7elYwGN2p5gtAg1RLmyVvubTmkOAmxAgybgqHAgMBAAE=
-----END PUBLIC KEY-----

-----BEGIN RSA PRIVATE KEY-----
MIIG4gIBAAKCAYEAtfCQ/U13p076UUEggNm8mI+bEilHrvKiyZpY/NZ2JYhmU+n0
ChuH6XweXuiuW2gKR/Fl0vpGAxhugQAR3lMS0XJZjg4z1gFP0BMeR0YYQuWe2Gfg
24fUNPluHCf+dJMHAadIVKyUvVKFPDTwu6yUlVafn0uoMme8b51yAwQAeXGOJnTF
HSaRhuDWAokaTsW0kdAr5FSxMadSTVuDNSavic6qSUimJvPjT+URzpIjy/2MG8aj
00At1MSj8sC/g5JuBvMKXe4mg6/Xd1YsP9gTGhpfuBzw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ERTFILE1} ${CERTFILE2}

}

echo " * testing server X.509, client RAW"

eval "${GETPORT}"
launch_server --echo --x509keyfile ${CERTFILE1} --x509certfile ${CERTFILE1} --priority NORMAL:-CTYPE-CLI-ALL:+CTYPE-CLI-RAWPK --require-client-cert
PID=$!
wait_server ${PID}

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL:-CTYPE-CLI-ALL:+CTYPE-CLI-RAWPK --no-ca-verification --rawpkkeyfile ${CERTFILE2} --rawpkfile ${CERTFILE2}  >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL:+CTYPE-CLI-ALL --no-ca-verification --rawpkkeyfile ${CERTFILE2} --rawpkfile ${CERTFILE2}  >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL --no-ca-verification --rawpkkeyfile ${CERTFILE2} --rawpkfile ${CERTFILE2}  >${TMPFILE} 2>&1 </dev/null
grep "Certificate is required" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake has unexpectedly succeeded. See ${TMPFILE} for details."
	exit 1
fi

kill ${PID}
wait

echo " * testing server RAW, client none"
eval "${GETPORT}"
launch_server --echo --rawpkkeyfile ${CERTFILE2} --rawpkfile ${CERTFILE2} --priority NORMAL:+CTYPE-SRV-RAWPK
PID=$!
wait_server ${PID}

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL:-CTYPE-SRV-ALL:+CTYPE-SRV-RAWPK --no-ca-verification >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL:+CTYPE-SRV-ALL --no-ca-verification >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if test $? = 0;then
	echo "Handshake has unexpectedly succeeded. See ${TMPFILE} for details."
	exit 1
fi


kill ${PID}
wait

echo " * testing server RAW, client RAW"
eval "${GETPORT}"
launch_server --echo --rawpkkeyfile ${CERTFILE2} --rawpkfile ${CERTFILE2} --priority NORMAL:+CTYPE-SRV-RAWPK:-CTYPE-CLI-ALL:+CTYPE-CLI-RAWPK --require-client-cert
PID=$!
wait_server ${PID}

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL:-CTYPE-ALL:+CTYPE-SRV-RAWPK:+CTYPE-CLI-RAWPK --no-ca-verification --rawpkkeyfile ${CERTFILE2} --rawpkfile ${CERTFILE2}  >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL:+CTYPE-SRV-ALL:+CTYPE-CLI-ALL --no-ca-verification --rawpkkeyfile ${CERTFILE2} --rawpkfile ${CERTFILE2}  >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if test $? = 0;then
	echo "Handshake has unexpectedly succeeded. See ${TMPFILE} for details."
	exit 1
fi


kill ${PID}
wait

echo " * testing server X.509+RAW, client none"

eval "${GETPORT}"
launch_server --echo --x509keyfile ${CERTFILE1} --x509certfile ${CERTFILE1} --rawpkkeyfile ${CERTFILE2} --rawpkfile ${CERTFILE2} --priority NORMAL:+CTYPE-SRV-RAWPK
PID=$!
wait_server ${PID}

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL:-CTYPE-SRV-ALL:+CTYPE-SRV-RAWPK --no-ca-verification >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL:-CTYPE-SRV-ALL:+CTYPE-SRV-X509 --no-ca-verification >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL:+CTYPE-SRV-ALL --no-ca-verification >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

${VALGRIND} "${CLI}" -p "${PORT}" localhost --priority NORMAL --no-ca-verification >${TMPFILE} 2>&1 </dev/null
grep "Handshake was completed" ${TMPFILE}
if ! test $? = 0;then
	echo "Handshake failed. See ${TMPFILE} for details."
	exit 1
fi

kill ${PID}
wait


rm -f ${TMPFILE} ${CERTFILE1} ${CERTFILE2}

exit 0