3 # Copyright (C) 2010 Free Software Foundation, Inc.
5 # Author: Nikos Mavrogiannopoulos
7 # This file is part of GnuTLS.
9 # GnuTLS is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by the
11 # Free Software Foundation; either version 3 of the License, or (at
12 # your option) any later version.
14 # GnuTLS is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GnuTLS; if not, write to the Free Software Foundation,
21 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 SERV="${SERV:-../../src/gnutls-serv} -q"
25 CLI="${CLI:-../../src/gnutls-cli}"
30 if test "${WINDIR}" != "";then
35 echo "Failure: $1" >&2
39 echo "Checking various DSA key sizes"
43 echo "Checking DSA-1024 with TLS 1.0"
45 $SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem >/dev/null 2>&1 & PID=$!
46 trap "kill $PID" 1 15 2
48 # give the server a chance to initialize
51 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
52 fail "Failed connection to a server with DSA 1024 key and TLS 1.0!"
54 echo "Checking server DSA-1024 with client DSA-1024 and TLS 1.0"
56 #try with client key of 1024 bits (should succeed)
57 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem </dev/null >/dev/null || \
58 fail "Failed connection to a server with DSA 1024 key and TLS 1.0!"
60 echo "Checking server DSA-1024 with client DSA-2048 and TLS 1.0"
62 #try with client key of 2048 bits (should fail)
63 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem </dev/null >/dev/null 2>&1 && \
64 fail "Succeeded connection to a server with a client DSA 2048 key and TLS 1.0!"
66 echo "Checking server DSA-1024 with client DSA-3072 and TLS 1.0"
68 #try with client key of 3072 bits (should fail)
69 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem </dev/null >/dev/null 2>&1 && \
70 fail "Succeeded connection to a server with a client DSA 3072 key and TLS 1.0!"
77 echo "Checking DSA-1024 with TLS 1.2"
79 $SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem >/dev/null 2>&1 & PID=$!
80 trap "kill $PID" 1 15 2
82 # give the server a chance to initialize
85 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
86 fail "Failed connection to a server with DSA 1024 key and TLS 1.2!"
88 echo "Checking server DSA-1024 with client DSA-1024 and TLS 1.2"
90 #try with client key of 1024 bits (should succeed)
91 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem </dev/null >/dev/null || \
92 fail "Failed connection to a server with DSA 1024 key and TLS 1.2!"
94 echo "Checking server DSA-1024 with client DSA-2048 and TLS 1.2"
96 #try with client key of 2048 bits (should succeed)
97 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem </dev/null >/dev/null || \
98 fail "Failed connection to a server with a client DSA 2048 key and TLS 1.2!"
100 echo "Checking server DSA-1024 with client DSA-3072 and TLS 1.2"
102 #try with client key of 3072 bits (should succeed)
103 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem </dev/null >/dev/null || \
104 fail "Failed connection to a server with a client DSA 3072 key and TLS 1.2!"
112 echo "Checking DSA-2048 with TLS 1.0"
114 $SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem >/dev/null 2>&1 & PID=$!
115 trap "kill $PID" 1 15 2
117 # give the server a chance to initialize
120 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null 2>&1 && \
121 fail "Succeeded connection to a server with DSA 2048 key and TLS 1.0. Should have failed!"
128 echo "Checking DSA-2048 with TLS 1.2"
130 $SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem >/dev/null 2>&1 & PID=$!
131 trap "kill $PID" 1 15 2
133 # give the server a chance to initialize
136 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
137 fail "Failed connection to a server with DSA 2048 key and TLS 1.2!"
144 echo "Checking DSA-3072 with TLS 1.0"
146 $SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem >/dev/null 2>&1 & PID=$!
147 trap "kill $PID" 1 15 2
149 # give the server a chance to initialize
152 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null 2>&1 && \
153 fail "Succeeded connection to a server with DSA 3072 key and TLS 1.0. Should have failed!"
160 echo "Checking DSA-3072 with TLS 1.2"
162 $SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem >/dev/null 2>&1 & PID=$!
163 trap "kill $PID" 1 15 2
165 # give the server a chance to initialize
168 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
169 fail "Failed connection to a server with DSA 3072 key and TLS 1.2!"