Created
February 13, 2013 03:12
-
-
Save samalba/4941972 to your computer and use it in GitHub Desktop.
Generate SSH keys
This file contains hidden or 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
import StringIO | |
from paramiko import DSSKey | |
def generate_ssh_key(): | |
dss = DSSKey.generate() | |
out = StringIO.StringIO() | |
dss.write_private_key(out) | |
private_key = out.getvalue() | |
out.close() | |
public_key = 'ssh-dss {0}'.format(dss.get_base64()) | |
return (private_key, public_key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment