Tizen 2.0 Release
[external/libgnutls26.git] / tests / pkcs8-decode / pkcs8
1 #!/bin/sh
2
3 # Copyright (C) 2004, 2005, 2006, 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 srcdir=${srcdir:-.}
24 CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
25
26 ret=0
27 for p8 in 'encpkcs8.pem foobar' unencpkcs8.pem 'enc2pkcs8.pem baz'; do
28     set -- $p8
29     file=$1
30     passwd=$2
31     $CERTTOOL --key-info --pkcs8 --password "$passwd" \
32                 --infile $srcdir/$file | tee out >/dev/null 2>&1
33     rc=$?
34     if test $rc != 0; then
35         cat out
36         echo "PKCS8 FATAL $p8"
37         ret=1
38     else
39         echo "PKCS8 OK $p8"
40     fi
41 done
42 rm -f out
43
44 echo "PKCS8 DONE (rc $ret)"
45 exit $ret