the new makeinfo sets the FLOAT_NAME by default.
[gnutls.git] / tests / ecdsa / ecdsa
blobddb9b60bd433c2c7c7abfb8ac14075a25d245484
1 #!/bin/sh
3 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
5 # Author: Nikos Mavrogiannopoulos
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 3 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.
23 #set -e
25 srcdir=${srcdir:-.}
26 CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
28 echo ca > template
29 echo cn = "ECDSA SHA 256 CA" >> template
31 $CERTTOOL --generate-privkey --ecc > key-ca-ecdsa.pem 2>/dev/null
33 $CERTTOOL -d 2 --generate-self-signed --template template \
34 --load-privkey key-ca-ecdsa.pem \
35 --outfile new-ca-ecdsa.pem \
36 --hash sha256 >out 2>&1
38 if [ $? != 0 ];then
39 cat out
40 exit 1
43 echo ca > template
44 $CERTTOOL --generate-privkey --ecc > key-subca-ecdsa.pem 2>/dev/null
45 echo cn = "ECDSA SHA 224 Mid CA" >> template
47 $CERTTOOL -d 2 --generate-certificate --template template \
48 --load-ca-privkey key-ca-ecdsa.pem \
49 --load-ca-certificate new-ca-ecdsa.pem \
50 --load-privkey key-subca-ecdsa.pem \
51 --outfile new-subca-ecdsa.pem \
52 --hash sha224 >out 2>&1
54 if [ $? != 0 ];then
55 cat out
56 exit 1
59 echo cn = "End-user" > template
61 $CERTTOOL --generate-privkey --ecc > key-ecdsa.pem 2>/dev/null
63 $CERTTOOL -d 2 --generate-certificate --template template \
64 --load-ca-privkey key-subca-ecdsa.pem \
65 --load-ca-certificate new-subca-ecdsa.pem \
66 --load-privkey key-ecdsa.pem \
67 --outfile new-user.pem >out 2>&1
69 if [ $? != 0 ];then
70 cat out
71 exit 1
74 cat new-user.pem new-subca-ecdsa.pem new-ca-ecdsa.pem > out
75 $CERTTOOL --verify-chain <out > verify
77 if [ $? != 0 ];then
78 cat verify
79 exit 1
82 rm -f verify new-user.pem new-ca-ecdsa.pem new-subca-ecdsa.pem template out
83 rm -f key-subca-ecdsa.pem key-ca-ecdsa.pem key-ecdsa.pem
85 $CERTTOOL -k < ${srcdir}/bad-key.pem | grep "validation failed" >/dev/null 2>&1
86 if [ $? != 0 ];then
87 echo "certtool didn't detect a bad ECDSA key."
88 exit 1
91 exit 0