3 # Copyright (C) 2004-2006, 2008-2010, 2012 Free Software Foundation,
6 # Author: Simon Josefsson
8 # This file is part of GnuTLS.
10 # GnuTLS is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by the
12 # Free Software Foundation; either version 3 of the License, or (at
13 # your option) any later version.
15 # GnuTLS is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with GnuTLS; if not, write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 CERTTOOL
=${CERTTOOL:-../../src/certtool$EXEEXT}
30 TSTAMP
=`datefudge "2006-09-23" date -u +%s || true`
31 if test "$TSTAMP" != "1158962400"; then
32 echo "You need datefudge to run this test"
36 # Test 1, PKCS#1 pad digestAlgorithm.parameters
40 datefudge
"2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-ok.pem |
tee out1
>/dev
/null
2>&1
41 datefudge
"2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken.pem |
tee out2
>/dev
/null
2>&1
43 out1oks
=`grep 'Verified.' out1 | wc -l | tr -d " "`
44 out2oks
=`grep 'Verified.' out2 | wc -l | tr -d " "`
45 out1fails
=`grep 'Not verified.' out1 | wc -l | tr -d " "`
46 out2fails
=`grep 'Not verified.' out2 | wc -l | tr -d " "`
48 if test "$out1oks$out2oks$out1fails$out2fails" != "$EXPECT1"; then
49 echo out1 oks
$out1oks fails
$out1fails out2 oks
$out2oks fails
$out2fails
50 echo expected
$EXPECT1
51 echo "PKCS1-PAD1 FAIL"
59 # Test 2, Bleichenbacher's Crypto 06 rump session
63 datefudge
"2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-ok2.pem |
tee out1
>/dev
/null
2>&1
64 datefudge
"2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken2.pem |
tee out2
>/dev
/null
2>&1
66 out1oks
=`grep 'Verified.' out1 | wc -l | tr -d " "`
67 out2oks
=`grep 'Verified.' out2 | wc -l | tr -d " "`
68 out1fails
=`grep 'Not verified.' out1 | wc -l | tr -d " "`
69 out2fails
=`grep 'Not verified.' out2 | wc -l | tr -d " "`
71 if test "$out1oks$out2oks$out1fails$out2fails" != "$EXPECT2"; then
72 echo out1 oks
$out1oks fails
$out1fails out2 oks
$out2oks fails
$out2fails
73 echo expected
$EXPECT2
74 echo "PKCS1-PAD2 FAIL"
82 # Test 3, forged Starfield certificate,
83 # by Andrei Pyshkin, Erik Tews and Ralf-Philipp Weinmann.
88 datefudge
"2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken3.pem |
tee out1
>/dev
/null
2>&1
90 out1oks
=`grep 'Verified.' out1 | wc -l | tr -d " "`
91 out1fails
=`grep 'Not verified.' out1 | wc -l | tr -d " "`
93 if test "$out1oks$out1fails" != "$EXPECT3"; then
94 echo out1 oks
$out1oks fails
$out1fails
95 echo expected
$EXPECT3
96 echo "PKCS1-PAD3 FAIL"