3 # Copyright (C) 2004, 2005, 2006 Free Software Foundation
5 # Author: Simon Josefsson
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 2 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 CERTTOOL
=${CERTTOOL:-../../src/certtool}
26 # Test 1, PKCS#1 pad digestAlgorithm.parameters
30 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-ok.pem |
tee out1
31 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken.pem |
tee out2
33 out1oks
=`grep 'Verified.' out1 | wc -l | tr -d " "`
34 out2oks
=`grep 'Verified.' out2 | wc -l | tr -d " "`
35 out1fails
=`grep 'Not verified.' out1 | wc -l | tr -d " "`
36 out2fails
=`grep 'Not verified.' out2 | wc -l | tr -d " "`
40 echo out1 oks
$out1oks fails
$out1fails out2 oks
$out2oks fails
$out2fails
42 if test "$out1oks$out2oks$out1fails$out2fails" != "$EXPECT1"; then
43 echo expected
$EXPECT1
44 echo "PKCS1-PAD1 FAIL"
50 # Test 2, Bleichenbacher's Crypto 06 rump session
54 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-ok2.pem |
tee out1
55 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken2.pem |
tee out2
57 out1oks
=`grep 'Verified.' out1 | wc -l | tr -d " "`
58 out2oks
=`grep 'Verified.' out2 | wc -l | tr -d " "`
59 out1fails
=`grep 'Not verified.' out1 | wc -l | tr -d " "`
60 out2fails
=`grep 'Not verified.' out2 | wc -l | tr -d " "`
64 echo out1 oks
$out1oks fails
$out1fails out2 oks
$out2oks fails
$out2fails
66 if test "$out1oks$out2oks$out1fails$out2fails" != "$EXPECT2"; then
67 echo expected
$EXPECT2
68 echo "PKCS1-PAD2 FAIL"
74 # Test 3, forged Starfield certificate,
75 # by Andrei Pyshkin, Erik Tews and Ralf-Philipp Weinmann.
79 $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken3.pem |
tee out1
81 out1oks
=`grep 'Verified.' out1 | wc -l | tr -d " "`
82 out1fails
=`grep 'Not verified.' out1 | wc -l | tr -d " "`
86 echo out1 oks
$out1oks fails
$out1fails
88 if test "$out1oks$out1fails" != "$EXPECT3"; then
89 echo expected
$EXPECT3
90 echo "PKCS1-PAD3 FAIL"