Alexander Schäferdiek
71977c9dca
All checks were successful
continuous-integration/drone/push Build is passing
25 lines
No EOL
529 B
Bash
Executable file
25 lines
No EOL
529 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -e;
|
|
|
|
check_required() {
|
|
type openssl &> /dev/null || { echo "Requiring 'openssl' but it's not installed"; exit 1; }
|
|
type ssh-keygen &> /dev/null || { echo "Requiring 'ssh-keygen' but it's not installed"; exit 1; }
|
|
}
|
|
|
|
name=$1;
|
|
encryption=$2;
|
|
|
|
if [[ -z "${name}" ]]; then
|
|
echo "Usage: ssh-keygen-rsa <name> [<encryptionKeySize>]"
|
|
exit 1;
|
|
fi
|
|
|
|
if [[ -z ${encryption} ]]; then
|
|
encryption=4096;
|
|
fi
|
|
|
|
check_required
|
|
|
|
openssl genrsa -out "${name}" "${encryption}"
|
|
ssh-keygen -y -f "${name}" > "${name}.pub" |