1f59d82ffSelric#!/bin/sh
2f59d82ffSelric#
3f59d82ffSelric# Copyright (c) 2005 - 2007 Kungliga Tekniska Högskolan
4f59d82ffSelric# (Royal Institute of Technology, Stockholm, Sweden).
5f59d82ffSelric# All rights reserved.
6f59d82ffSelric#
7f59d82ffSelric# Redistribution and use in source and binary forms, with or without
8f59d82ffSelric# modification, are permitted provided that the following conditions
9f59d82ffSelric# are met:
10f59d82ffSelric#
11f59d82ffSelric# 1. Redistributions of source code must retain the above copyright
12f59d82ffSelric#    notice, this list of conditions and the following disclaimer.
13f59d82ffSelric#
14f59d82ffSelric# 2. Redistributions in binary form must reproduce the above copyright
15f59d82ffSelric#    notice, this list of conditions and the following disclaimer in the
16f59d82ffSelric#    documentation and/or other materials provided with the distribution.
17f59d82ffSelric#
18f59d82ffSelric# 3. Neither the name of the Institute nor the names of its contributors
19f59d82ffSelric#    may be used to endorse or promote products derived from this software
20f59d82ffSelric#    without specific prior written permission.
21f59d82ffSelric#
22f59d82ffSelric# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23f59d82ffSelric# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24f59d82ffSelric# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25f59d82ffSelric# ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26f59d82ffSelric# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27f59d82ffSelric# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28f59d82ffSelric# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29f59d82ffSelric# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30f59d82ffSelric# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31f59d82ffSelric# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32f59d82ffSelric# SUCH DAMAGE.
33f59d82ffSelric#
34*fcfd9267Selric# Id
35f59d82ffSelric#
36f59d82ffSelric
37f59d82ffSelricsrcdir="@srcdir@"
38f59d82ffSelricobjdir="@objdir@"
39f59d82ffSelric
40f59d82ffSelricstat="--statistic-file=${objdir}/statfile"
41f59d82ffSelric
42f59d82ffSelrichxtool="${TESTS_ENVIRONMENT} ./hxtool ${stat}"
43f59d82ffSelric
44f59d82ffSelricif ${hxtool} info | grep 'rsa: hcrypto null RSA' > /dev/null ; then
45f59d82ffSelric    exit 77
46f59d82ffSelricfi
47f59d82ffSelricif ${hxtool} info | grep 'rand: not available' > /dev/null ; then
48f59d82ffSelric    exit 77
49f59d82ffSelricfi
50f59d82ffSelric
51f59d82ffSelric${hxtool} request-create \
52f59d82ffSelric	 --subject="CN=Love,DC=it,DC=su,DC=se" \
53f59d82ffSelric	 --key=FILE:$srcdir/data/key.der \
54f59d82ffSelric	 request.out || exit 1
55f59d82ffSelric
56f59d82ffSelric${hxtool} request-print \
57f59d82ffSelric	 PKCS10:request.out > /dev/null || exit 1
58f59d82ffSelric
59f59d82ffSelric${hxtool} request-create \
60f59d82ffSelric	 --subject="CN=Love,DC=it,DC=su,DC=se" \
61f59d82ffSelric	 --dnsname=nutcracker.it.su.se \
62f59d82ffSelric	 --key=FILE:$srcdir/data/key.der \
63f59d82ffSelric	 request.out || exit 1
64