Created
April 1, 2014 16:49
-
-
Save kraftb/9918106 to your computer and use it in GitHub Desktop.
Generate public/private keypair and output to stdout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BITS=2048 | |
# In one line: | |
# rm -f temp.key && ssh-keygen -t rsa -b 2048 -f temp.key -N "" -q && ssh-keygen -e -f temp.key -m PKCS8 | tr "\n" " " && echo && cat temp.key | tr "\n" " " && echo | |
# In multiple lines: | |
rm -f temp.key | |
ssh-keygen -t rsa -b $BITS -f temp.key -N "" -q | |
echo | |
ssh-keygen -e -f temp.key -m PKCS8 | tr "\n" " " | |
echo | |
echo | |
cat temp.key | tr "\n" " " | |
echo | |
echo | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a practical example of this for encrypting the ssh key with sops and age in a taskfile: