Skip to content

Instantly share code, notes, and snippets.

@bng44270
Created April 10, 2020 12:33
Show Gist options
  • Save bng44270/3e86a9d194e8fa33e200acbbeb17f96d to your computer and use it in GitHub Desktop.
Save bng44270/3e86a9d194e8fa33e200acbbeb17f96d to your computer and use it in GitHub Desktop.
Generate SSH Key Pairs with AppleScript
set appname to ""
set keypass to ""
repeat
set appname to text returned of (display dialog "Enter application name" default answer "")
if (length of appname) > 0 then exit repeat
end repeat
repeat
set keypass to text returned of (display dialog "Enter key password" default answer "" with hidden answer)
if (length of keypass) > 0 then exit repeat
end repeat
do shell script "ssh-keygen -b 2048 -t rsa -N " & keypass & " -f ~/" & appname & ".key"
do shell script "zip -jr ~/Desktop/" & appname & ".zip ~/" & appname & ".key*"
do shell script "rm ~/" & appname & ".key*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment