1#!/bin/sh 2# 3# Copyright (c) 2005 - 2007 Kungliga Tekniska H�gskolan 4# (Royal Institute of Technology, Stockholm, Sweden). 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# 11# 1. Redistributions of source code must retain the above copyright 12# notice, this list of conditions and the following disclaimer. 13# 14# 2. Redistributions in binary form must reproduce the above copyright 15# notice, this list of conditions and the following disclaimer in the 16# documentation and/or other materials provided with the distribution. 17# 18# 3. Neither the name of the Institute nor the names of its contributors 19# may be used to endorse or promote products derived from this software 20# without specific prior written permission. 21# 22# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 23# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25# ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 26# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32# SUCH DAMAGE. 33# 34# $Id: test_query.in 20782 2007-06-02 00:46:00Z lha $ 35# 36 37srcdir="@srcdir@" 38objdir="@objdir@" 39 40stat="--statistic-file=${objdir}/statfile" 41 42hxtool="${TESTS_ENVIRONMENT} ./hxtool ${stat}" 43 44echo "try printing" 45${hxtool} print \ 46 --pass=PASS:foobar \ 47 PKCS12:$srcdir/data/test.p12 >/dev/null 2>/dev/null || exit 1 48 49${hxtool} print \ 50 --pass=PASS:foobar \ 51 --info \ 52 PKCS12:$srcdir/data/test.p12 >/dev/null 2>/dev/null || exit 1 53 54echo "make sure entry is found (friendlyname)" 55${hxtool} query \ 56 --pass=PASS:foobar \ 57 --friendlyname=friendlyname-test \ 58 PKCS12:$srcdir/data/test.p12 >/dev/null 2>/dev/null || exit 1 59 60echo "make sure entry is not found (friendlyname)" 61${hxtool} query \ 62 --pass=PASS:foobar \ 63 --friendlyname=friendlyname-test-not \ 64 PKCS12:$srcdir/data/test.p12 >/dev/null 2>/dev/null && exit 1 65 66echo "make sure entry is found (friendlyname, no-pw)" 67${hxtool} query \ 68 --friendlyname=friendlyname-cert \ 69 PKCS12:$srcdir/data/test-nopw.p12 >/dev/null 2>/dev/null || exit 1 70 71echo "check for ca cert (friendlyname)" 72${hxtool} query \ 73 --pass=PASS:foobar \ 74 --friendlyname=ca \ 75 PKCS12:$srcdir/data/test.p12 >/dev/null 2>/dev/null || exit 1 76 77echo "make sure entry is not found (friendlyname)" 78${hxtool} query \ 79 --pass=PASS:foobar \ 80 --friendlyname=friendlyname-test \ 81 PKCS12:$srcdir/data/sub-cert.p12 >/dev/null 2>/dev/null && exit 1 82 83echo "make sure entry is found (friendlyname|private key)" 84${hxtool} query \ 85 --pass=PASS:foobar \ 86 --friendlyname=friendlyname-test \ 87 --private-key \ 88 PKCS12:$srcdir/data/test.p12 > /dev/null || exit 1 89 90echo "make sure entry is not found (friendlyname|private key)" 91${hxtool} query \ 92 --pass=PASS:foobar \ 93 --friendlyname=ca \ 94 --private-key \ 95 PKCS12:$srcdir/data/test.p12 >/dev/null 2>/dev/null && exit 1 96 97echo "make sure entry is found (cert ds)" 98${hxtool} query \ 99 --digitalSignature \ 100 FILE:$srcdir/data/test.crt >/dev/null 2>/dev/null || exit 1 101 102echo "make sure entry is found (cert ke)" 103${hxtool} query \ 104 --keyEncipherment \ 105 FILE:$srcdir/data/test.crt >/dev/null 2>/dev/null || exit 1 106 107echo "make sure entry is found (cert ke + ds)" 108${hxtool} query \ 109 --digitalSignature \ 110 --keyEncipherment \ 111 FILE:$srcdir/data/test.crt >/dev/null 2>/dev/null || exit 1 112 113echo "make sure entry is found (cert-ds ds)" 114${hxtool} query \ 115 --digitalSignature \ 116 FILE:$srcdir/data/test-ds-only.crt >/dev/null 2>/dev/null || exit 1 117 118echo "make sure entry is not found (cert-ds ke)" 119${hxtool} query \ 120 --keyEncipherment \ 121 FILE:$srcdir/data/test-ds-only.crt >/dev/null 2>/dev/null && exit 1 122 123echo "make sure entry is not found (cert-ds ke + ds)" 124${hxtool} query \ 125 --digitalSignature \ 126 --keyEncipherment \ 127 FILE:$srcdir/data/test-ds-only.crt >/dev/null 2>/dev/null && exit 1 128 129echo "make sure entry is not found (cert-ke ds)" 130${hxtool} query \ 131 --digitalSignature \ 132 FILE:$srcdir/data/test-ke-only.crt >/dev/null 2>/dev/null && exit 1 133 134echo "make sure entry is found (cert-ke ke)" 135${hxtool} query \ 136 --keyEncipherment \ 137 FILE:$srcdir/data/test-ke-only.crt >/dev/null 2>/dev/null || exit 1 138 139echo "make sure entry is not found (cert-ke ke + ds)" 140${hxtool} query \ 141 --digitalSignature \ 142 --keyEncipherment \ 143 FILE:$srcdir/data/test-ke-only.crt >/dev/null 2>/dev/null && exit 1 144 145exit 0 146 147