/[svn]/ircd-hybrid-7.2/tools/mkkeypair
ViewVC logotype

Contents of /ircd-hybrid-7.2/tools/mkkeypair

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (show annotations)
Sun Oct 2 21:05:51 2005 UTC (13 years, 11 months ago) by lusky
File size: 1269 byte(s)
create 7.2 branch, we can move/rename it as needed.


1 #!/bin/sh
2 # $Id$
3 #
4 # mkkeypair - short shell script to generate a OpenSSL RSA key suitable
5 # for use with cryptlinks.
6 #
7 # (C) 2003 Joshua Kwan and the IRCD-Hybrid team
8 # See LICENSE for the terms of copying.
9
10 if test -f rsa.key; then
11 echo Moving old key out of the way to rsa.key.old
12 mv rsa.key rsa.key.old
13 fi
14
15 if test -f rsa.pub; then
16 echo Moving old public key out of the way to rsa.pub.old
17 mv rsa.pub rsa.pub.old
18 fi
19
20 echo Generating random bytes
21
22 if test -c /dev/urandom; then
23 RANDGEN=/dev/urandom
24 elif test -c /dev/random; then
25 RANDGEN=/dev/random
26 else
27 RANDGEN=input
28 fi
29
30 if test "$RANDGEN" = input; then
31 echo "Your system doesn't have a suitable random data generator,"
32 echo "so type 150 characters of gibberish here to simulate it."
33 read -n 150 randomdata
34 echo
35 echo "$randomdata" > randdata
36 sort < randdata >> randdata.1
37 cat randdata.1 >> randdata
38 rm -f randdata.1
39 else
40 dd if=$RANDGEN of=randdata count=1 bs=2048
41 fi
42
43 echo Creating the private key.
44 openssl genrsa -rand randdata -out rsa.key 2048 || exit 1
45 chmod 600 rsa.key
46 echo Creating the public key from the private key.
47 openssl rsa -in rsa.key -out rsa.pub -pubout || exit 1
48 chmod 644 rsa.pub
49
50 echo
51 echo Private key now exists as rsa.key
52 echo Public key now exists as rsa.pub
53
54 rm -f randdata

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Id Revision

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.26