Tizen 2.0 Release
[external/libgnutls26.git] / tests / key-id / key-id
1 #!/bin/sh
2
3 # Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 #
5 # Author: Simon Josefsson
6 #
7 # This file is part of GnuTLS.
8 #
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.
13 #
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.
18 #
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.
22
23 set -e
24
25 srcdir=${srcdir:-.}
26 CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
27
28 PARAMS="--generate-certificate --load-privkey $srcdir/key-user.pem --load-ca-privkey $srcdir/key-ca.pem --template tmpl"
29
30 echo > tmpl
31
32 #$CERTTOOL $PARAMS --load-ca-certificate $srcdir/ca-gnutls-keyid.pem \
33 #    --outfile user-gnutls-keyid.pem 2> /dev/null
34
35 #$CERTTOOL $PARAMS --load-ca-certificate $srcdir/ca-no-keyid.pem \
36 #    --outfile user-no-keyid.pem 2> /dev/null
37
38 $CERTTOOL $PARAMS --load-ca-certificate $srcdir/ca-weird-keyid.pem \
39     --outfile user-weird-keyid.pem 2> /dev/null
40
41 if $CERTTOOL -i < user-weird-keyid.pem \
42     | grep '7a2c7a6097460603cbfb28e8e219df18deeb4e0d' > /dev/null; then
43     :
44 else
45     echo "Could not find CA SKI in user certificate."
46     exit 1;
47 fi
48
49 rm -f tmpl user-gnutls-keyid.pem user-no-keyid.pem user-weird-keyid.pem
50
51 # We're done.
52 exit 0