1178825Sdfr#!/bin/sh 2178825Sdfr# 3233294Sstas# Copyright (c) 2007 Kungliga Tekniska H��gskolan 4178825Sdfr# (Royal Institute of Technology, Stockholm, Sweden). 5178825Sdfr# All rights reserved. 6178825Sdfr# 7178825Sdfr# Redistribution and use in source and binary forms, with or without 8178825Sdfr# modification, are permitted provided that the following conditions 9178825Sdfr# are met: 10178825Sdfr# 11178825Sdfr# 1. Redistributions of source code must retain the above copyright 12178825Sdfr# notice, this list of conditions and the following disclaimer. 13178825Sdfr# 14178825Sdfr# 2. Redistributions in binary form must reproduce the above copyright 15178825Sdfr# notice, this list of conditions and the following disclaimer in the 16178825Sdfr# documentation and/or other materials provided with the distribution. 17178825Sdfr# 18178825Sdfr# 3. Neither the name of the Institute nor the names of its contributors 19178825Sdfr# may be used to endorse or promote products derived from this software 20178825Sdfr# without specific prior written permission. 21178825Sdfr# 22178825Sdfr# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 23178825Sdfr# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24178825Sdfr# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25178825Sdfr# ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 26178825Sdfr# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27178825Sdfr# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28178825Sdfr# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29178825Sdfr# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30178825Sdfr# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31178825Sdfr# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32178825Sdfr# SUCH DAMAGE. 33178825Sdfr# 34178825Sdfr# $Id: test_chain.in 20809 2007-06-03 03:19:06Z lha $ 35178825Sdfr# 36178825Sdfr 37178825Sdfrsrcdir="@srcdir@" 38178825Sdfrobjdir="@objdir@" 39178825Sdfr 40178825Sdfrhxtool="${TESTS_ENVIRONMENT} ./hxtool ${stat}" 41178825Sdfrif ${hxtool} info | grep 'rsa: hcrypto null RSA' > /dev/null ; then 42178825Sdfr exit 77 43178825Sdfrfi 44178825Sdfrif ${hxtool} info | grep 'rand: not available' > /dev/null ; then 45178825Sdfr exit 77 46178825Sdfrfi 47178825Sdfr 48178825Sdfrecho "print DIR" 49178825Sdfr${hxtool} print --content DIR:$srcdir/data > /dev/null || exit 1 50178825Sdfr 51178825Sdfrecho "print FILE" 52178825Sdfrfor a in $srcdir/data/*.crt; do 53178825Sdfr ${hxtool} print --content FILE:"$a" > /dev/null 2>/dev/null 54178825Sdfrdone 55178825Sdfr 56178825Sdfrecho "print NULL" 57178825Sdfr${hxtool} print --content NULL: > /dev/null || exit 1 58178825Sdfr 59178825Sdfrecho "copy dance" 60178825Sdfr${hxtool} certificate-copy \ 61178825Sdfr FILE:${srcdir}/data/test.crt PEM-FILE:cert-pem.tmp || exit 1 62178825Sdfr 63178825Sdfr${hxtool} certificate-copy PEM-FILE:cert-pem.tmp DER-FILE:cert-der.tmp || exit 1 64178825Sdfr${hxtool} certificate-copy DER-FILE:cert-der.tmp PEM-FILE:cert-pem2.tmp || exit 1 65178825Sdfr 66178825Sdfrcmp cert-pem.tmp cert-pem2.tmp || exit 1 67178825Sdfr 68233294Sstasecho "verify n0ll cert (fail)" 69233294Sstas${hxtool} verify --missing-revoke \ 70233294Sstas --hostname=foo.com \ 71233294Sstas cert:FILE:$srcdir/data/n0ll.pem \ 72233294Sstas anchor:FILE:$srcdir/data/n0ll.pem && exit 1 73178825Sdfr 74233294Sstasecho "verify n0ll cert (fail)" 75233294Sstas${hxtool} verify --missing-revoke \ 76233294Sstas cert:FILE:$srcdir/data/n0ll.pem \ 77233294Sstas anchor:FILE:$srcdir/data/n0ll.pem && exit 1 78233294Sstas 79233294Sstasecho "check that windows cert with utf16 in printable string works" 80233294Sstas${hxtool} verify --missing-revoke \ 81233294Sstas cert:FILE:$srcdir/data/win-u16-in-printablestring.der \ 82233294Sstas anchor:FILE:$srcdir/data/win-u16-in-printablestring.der || exit 1 83233294Sstas 84178825Sdfrexit 0 85