summaryrefslogtreecommitdiff
path: root/tests/cert-tests/provable-privkey
blob: 3f94f9ee240d77ce780007d6114b151997721e96 (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
#!/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}"
OUTFILE=provable-privkey$$.tmp

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

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

#RSA keys
${VALGRIND} "${CERTTOOL}" --verify-provable-privkey --load-privkey "${srcdir}/data/provable2048.pem" &
PID1=$!


${VALGRIND} "${CERTTOOL}" --verify-provable-privkey --load-privkey "${srcdir}/data/provable3072.pem" &
PID2=$!


if test "${FIPS140}" = 1;then
SEED="30:EC:33:4F:97:DB:C0:BA:9C:86:52:A7:B5:D3:F7:B2:DB:BB:48:A4:84:2E:19:0D:21:0E:01:DA:BD:53:59:81:50:37:55:EE:96:A2:70:A5:98:E9:D9:1B:22:54:66:91:69:EB:DF:45:99:D9:F7:2A:CA"
DSAFILE=provable-dsa2048-fips.pem
else
SEED="5A:0E:A0:41:77:9B:0A:B7:65:BE:25:09:C4:DE:90:E5:A0:E7:DA:AD:AE:6E:49:D3:59:38:F9:13:33:A8:E1:FE:50:9D:D2:DF:E1:96:7C:D0:04:54:28:10:34:97:D0:03:88:C8:CE:36:29:0F:E9:37:9F:80:03:CB:F8:FD:A4:DA:27"
DSAFILE=provable-dsa2048.pem
fi

#DSA keys
${VALGRIND} "${CERTTOOL}" --verify-provable-privkey --load-privkey "${srcdir}/data/${DSAFILE}" &
PID3=$!

wait $PID1
rc1=$?

wait $PID2
rc2=$?

wait $PID3
rc3=$?

if test "${rc1}" != "0"; then
	echo "Could not verify the 2048-bit key"
	exit 1
fi

if test "${rc2}" != "0"; then
	echo "Could not verify the 3072-bit key"
	exit 1
fi

if test "${rc3}" != "0"; then
	echo "Could not verify the 2048-bit DSA key"
	exit 1
fi

rm -f "$OUTFILE"

exit 0