Skip to content

Instantly share code, notes, and snippets.

@teeralai
Created May 27, 2013 15:06
Show Gist options
  • Save teeralai/5657544 to your computer and use it in GitHub Desktop.
Save teeralai/5657544 to your computer and use it in GitHub Desktop.
#!/bin/bash
cd ~/.ssh
read -e -p "Enter SSH Private Key Name (default: id_rsa) > " -n 20 kname
if [ "$kname" = "" ]; then
kname="id_rsa"
fi
read -e -p "Enter E-mail Address > " email
read -s -p "Enter Passphrase for SSH Private Key ( >4 characters) : " passphrase
echo
#check
read -s -p "Enter Encryption Password : " epassword
#check
ssh-keygen -t rsa -C "$email" -N "$passphrase" -f $kname
knameo=$kname".old"
mv $kname $knameo
openssl pkcs8 -topk8 -v2 des3 -in $knameo -passin "pass:"$passphrase -out $kname -passout "pass:"$passphrase
cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment