summaryrefslogtreecommitdiffstats
path: root/tests/gnutls-cli-rawpk.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtests/gnutls-cli-rawpk.sh320
1 files changed, 320 insertions, 0 deletions
diff --git a/tests/gnutls-cli-rawpk.sh b/tests/gnutls-cli-rawpk.sh
new file mode 100755
index 0000000..90fde68
--- /dev/null
+++ b/tests/gnutls-cli-rawpk.sh
@@ -0,0 +1,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-----
+MIIEXDCCAsSgAwIBAgIIW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fcVnPlPcHkNo7MJGxhYmRZbYI4h
+f8IC6sLpQ3e1rIZyOJKuMCgMrKdMdhyVQ+vzagXbYUJS3rEXSd/SrUi2O+LGd7eO
+23Sjjt3+8wJOGmEodR8i753kz4u/l+HOBTPsp8/2G+0CgcBD72Pz1TMVojRsOCKe
+JdbivBPja60VxU0Szb78Nca1+qhe4SBDzyJgxBTR9o9I9otiP859vG+sWxlxEc2/
+8t1lAUlzRJ+PWtsOdP22gH2iXwK8SvI0iaak7Xs7wddUV46b5umxURxo7qvIOZdN
+ZqoZc2leyNnXGn3W0/8EiZ7HRcqDEnH3xeE6UkpY/aRsywu/3cR66M7QRNbv/Jm+
+daz9bReE2thQClHb+W1YpHM+Dp6aWRZuYidkHrwOFbWVOyECgcBSsN2yk6eV9pmQ
+p4yHZcJ6QdCHm1KqdAMK/pSurjSf3+281mkxTAkZBGLl2QwZKEBTapKZhvsoC3+d
+fpk1UZneP1g9PHoRS7rooQV5baUj0sOd3RyD3iylb1soyyEKWxbzdiS/nswYbwCV
+LMvucEsmS5aIfIUo4ntlNs3bVZqLdh0BAG9+WuimpYyp7pxrvuj2FM+gwbwDZvto
+O2/1wSKkPX2klUKg1hNNELJAXfxHLw2+NvV9x4rDiu5xJHgDCD0=
+-----END RSA PRIVATE KEY-----
+__EOF__
+
+trap "cleanup" EXIT QUIT
+
+cleanup()
+{
+ kill ${PID} >/dev/null 2>&1
+ rm -f ${CERTFILE1} ${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