3 # This shell script will generate an X509 certificate for
4 # your gnunet-transport HTTPS
6 # The current version partially reuses and recycles
7 # code from build.sh by NetBSD (although not entirely
8 # used because it needs debugging):
10 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
11 # All rights reserved.
13 # This code is derived from software contributed to
14 # The NetBSD Foundation by Todd Vierling and Luke Mewburn.
16 # Redistribution and use in source and binary forms, with or
17 # without modification, are permitted provided that the following
19 # 1. Redistributions of source code must retain the above
20 # copyright notice, this list of conditions and the following
22 # 2. Redistributions in binary form must reproduce the above
23 # copyright notice, this list of conditions and the following
24 # disclaimer in the documentation and/or other materials
25 # provided with the distribution.
27 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
28 # CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
29 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 # IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR
33 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
35 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
40 # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
58 if [ x$verbosity = x1 ]; then
65 statusmsg "WARNING: $@"
75 statusmsg "========================================="
83 echo "${progname}: $*"
87 Usage: ${progname} [-hv] [-c FILE] [...]
90 -c FILE Use the configuration file FILE.
91 -h Print this help message.
92 -v Print the version and exit.
103 infomsg "Generating Cert and Key"
106 GNUTLS_CA_TEMPLATE=@PKGDATADIRECTORY@/gnunet-gns-proxy-ca.template
108 if test -z "`gnutls-certtool --version`" > /dev/null
110 if test -z "`openssl version`" > /dev/null
112 warningmsg "Install either gnutls certtool or openssl for certificate generation!"
119 CERTTOOL="gnutls-certtool"
121 mkdir -p `dirname $KEYFILE`
123 if test 1 -eq $OPENSSL
125 $CERTTOOL genrsa -out $KEYFILE 1024
126 $CERTTOOL req -batch -days 365 -out $CERTFILE -new -x509 -key $KEYFILE
128 $CERTTOOL --generate-privkey --outfile $KEYFILE 2>/dev/null
129 $CERTTOOL --template $GNUTLS_CA_TEMPLATE --generate-self-signed --load-privkey $KEYFILE --outfile $CERTFILE 2>/dev/null
135 GNUNET_ARM_VERSION=`gnunet-arm -v`
136 echo $GNUNET_ARM_VERSION