27 lines
732 B
Bash
Executable file
27 lines
732 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Copyright (C) 2006 ircd-ratbox development team
|
|
# This code is in the public domain.
|
|
|
|
KEYNAME=${1:-$USER}
|
|
|
|
openssl "no-aes256-cbc" >/dev/null
|
|
if [ $? != 1 ]; then
|
|
openssl "no-des3" >/dev/null
|
|
if [ $? != 1 ]; then
|
|
echo "Unable to find a suitable encryption for assigning a password to the key"
|
|
echo "If you wish to generate a key without a passphrase, run:"
|
|
echo " openssl genrsa -out key.sec 2048"
|
|
echo " openssl rsa -in key.sec -out key.pub -pubout"
|
|
echo "Though this is NOT recommended for security reasons."
|
|
exit
|
|
fi
|
|
enc="-des3"
|
|
else
|
|
enc="-aes256"
|
|
fi
|
|
|
|
openssl genrsa -out "$KEYNAME.sec" "$enc" 4096
|
|
|
|
echo "Generating RSA public key..."
|
|
openssl rsa -in "$KEYNAME.sec" -out "$KEYNAME.pub" -pubout
|