aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport-certificate-creation.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-transport-certificate-creation.in')
-rw-r--r--src/transport/gnunet-transport-certificate-creation.in147
1 files changed, 0 insertions, 147 deletions
diff --git a/src/transport/gnunet-transport-certificate-creation.in b/src/transport/gnunet-transport-certificate-creation.in
deleted file mode 100644
index 8348dd1b7..000000000
--- a/src/transport/gnunet-transport-certificate-creation.in
+++ /dev/null
@@ -1,147 +0,0 @@
1#!/bin/sh
2#
3# This shell script will generate an X509 certificate for
4# your gnunet-transport HTTPS
5#
6# The current version partially reuses and recycles
7# code from build.sh by NetBSD (although not entirely
8# used because it needs debugging):
9#
10# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
11# All rights reserved.
12#
13# This code is derived from software contributed to
14# The NetBSD Foundation by Todd Vierling and Luke Mewburn.
15
16# Redistribution and use in source and binary forms, with or
17# without modification, are permitted provided that the following
18# conditions are met:
19# 1. Redistributions of source code must retain the above
20# copyright notice, this list of conditions and the following
21# disclaimer.
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.
26
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
31# DISCLAIMED.
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
38# LIABILITY, OR TORT
39# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
40# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
41# OF SUCH DAMAGE.
42
43progname=${0##*/}
44
45setdefaults()
46{
47 verbosity=0
48 runcmd=
49}
50
51statusmsg()
52{
53 ${runcmd} echo " $@"
54}
55
56infomsg()
57{
58 if [ x$verbosity = x1 ]; then
59 statusmsg "INFO: $@"
60 fi
61}
62
63warningmsg()
64{
65 statusmsg "WARNING: $@"
66}
67
68errormsg()
69{
70 statusmsg "ERROR: $@"
71}
72
73linemsg()
74{
75 statusmsg "========================================="
76}
77
78
79usage()
80{
81 if [ -n "$*" ]; then
82 echo ""
83 echo "${progname}: $*"
84 fi
85 cat <<_usage_
86
87Usage: ${progname} [-hv] [-c FILE] [...]
88
89Options:
90 -c FILE Use the configuration file FILE.
91 -h Print this help message.
92 -v Print the version and exit.
93 -V be verbose
94
95_usage_
96 exit 1
97}
98
99
100generate_cert_key()
101{
102 echo ""
103 infomsg "Generating Cert and Key"
104
105 CERTTOOL=""
106 GNUTLS_CA_TEMPLATE=@PKGDATADIRECTORY@/gnunet-gns-proxy-ca.template
107 OPENSSL=0
108 if test -z "`gnutls-certtool --version`" > /dev/null
109 then
110 if test -z "`openssl version`" > /dev/null
111 then
112 warningmsg "Install either gnutls certtool or openssl for certificate generation!"
113 exit 1
114 else
115 OPENSSL=1
116 fi
117 CERTTOOL="openssl"
118 else
119 CERTTOOL="gnutls-certtool"
120 fi
121 mkdir -p `dirname $KEYFILE`
122
123 if test 1 -eq $OPENSSL
124 then
125 $CERTTOOL genrsa -out $KEYFILE 1024
126 $CERTTOOL req -batch -days 365 -out $CERTFILE -new -x509 -key $KEYFILE
127 else
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
130 fi
131 }
132
133print_version()
134{
135 GNUNET_ARM_VERSION=`gnunet-arm -v`
136 echo $GNUNET_ARM_VERSION
137}
138
139main()
140{
141 KEYFILE=$1
142 CERTFILE=$2
143 setdefaults
144 generate_cert_key
145}
146
147main "$@"