402a4cebd5adaa7105ec91646b7531ace58e9d71
[oweals/gnunet.git] / src / transport / gnunet-transport-certificate-creation
1 #!/bin/sh
2
3 # GNUnet TLS certificate shell scricpt
4 # Creates a TSL certificate to use with HTTPS transport plugin
5
6 if [ $# -ne 2 ]; then
7  exit 1
8 fi
9
10 rm -f $1 $2
11
12 # Create RSA Private Key
13 openssl genrsa -out $1 1024 2> /dev/null
14 if [ $? -ne 0 ]; then
15  rm -f $1 $2
16  exit 1
17 fi 
18 # Create a self-signed certificate in batch mode using rsa key
19 openssl req -batch -days 365 -out $2 -new -x509 -key $1 2> /dev/null
20 if [ $? -ne 0 ]; then
21  rm -f $1 $2
22  exit 1
23 fi 
24
25 chmod 0400 $1 $2
26
27 exit 0