respond-agent/ratbox-makekeypair

28 lines
732 B
Text
Raw Permalink Normal View History

#!/bin/sh
#
# Copyright (C) 2006 ircd-ratbox development team
# This code is in the public domain.
2021-10-29 20:39:10 +00:00
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:"
2021-10-29 20:39:10 +00:00
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
2021-10-29 20:39:10 +00:00
openssl genrsa -out "$KEYNAME.sec" "$enc" 4096
echo "Generating RSA public key..."
2021-10-29 20:39:10 +00:00
openssl rsa -in "$KEYNAME.sec" -out "$KEYNAME.pub" -pubout