blob: 6a8bcc8b812555e399d85dc4a79ab3c0a81dae6e (
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
|
#!/bin/sh
# Copyright (C) 2014 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 General Public License
# along with GnuTLS; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#set -e
srcdir="${srcdir:-.}"
CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
DIFF="${DIFF:-diff -b -B}"
if ! test -z "${VALGRIND}"; then
VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
fi
#check whether "funny" spaces can be interpreted
id=`${VALGRIND} "${CERTTOOL}" --key-id --infile "${srcdir}/data/funny-spacing.pem" --hash sha1| tr -d '\r'`
rc=$?
if test "${id}" != "1e09d707d4e3651b84dcb6c68a828d2affef7ec3"; then
echo "Key-ID1 doesn't match the expected: ${id}"
exit 1
fi
id=`${VALGRIND} "${CERTTOOL}" --key-id --infile "${srcdir}/data/funny-spacing.pem"| tr -d '\r'`
rc=$?
if test "${id}" != "1e09d707d4e3651b84dcb6c68a828d2affef7ec3"; then
echo "Default key-ID1 doesn't match the expected; did the defaults change? ID: ${id}"
exit 1
fi
id=`"${CERTTOOL}" --pubkey-info <"${srcdir}/data/funny-spacing.pem"|"${CERTTOOL}" --key-id --hash sha1| tr -d '\r'`
rc=$?
if test "${id}" != "1e09d707d4e3651b84dcb6c68a828d2affef7ec3"; then
echo "Key-ID2 doesn't match the expected: ${id}"
exit 1
fi
id=`"${CERTTOOL}" --pubkey-info <"${srcdir}/data/funny-spacing.pem"|"${CERTTOOL}" --key-id --hash sha256| tr -d '\r'`
rc=$?
if test "${id}" != "118e72e3655150c895ecbd19b3634179fb4a87c7a25abefcb11f5d66661d5a4d"; then
echo "Key-ID3 doesn't match the expected: ${id}"
exit 1
fi
#fingerprint
id=`${VALGRIND} "${CERTTOOL}" --fingerprint --infile "${srcdir}/data/funny-spacing.pem"| tr -d '\r'`
rc=$?
if test "${id}" != "8f735c5ddefd723f59b6a3bb2ac0522470c0182f"; then
echo "Fingerprint doesn't match the expected: 3"
exit 1
fi
id=`${VALGRIND} "${CERTTOOL}" --fingerprint --hash sha256 --infile "${srcdir}/data/funny-spacing.pem"| tr -d '\r'`
rc=$?
if test "${id}" != "fc5b45b20c489393a457f177572920ac40bacba9d25cea51200822271eaf7d1f"; then
echo "Fingerprint doesn't match the expected: 4"
exit 1
fi
export TZ="UTC"
. ${srcdir}/../scripts/common.sh
check_for_datefudge
cat "${srcdir}/../certs/cert-ecc256.pem" "${srcdir}/../certs/ca-cert-ecc.pem"|datefudge "2012-11-22" \
${VALGRIND} "${CERTTOOL}" --verify-chain
rc=$?
if test "${rc}" != "0"; then
echo "There was an issue verifying the chain"
exit 1
fi
exit 0
|