librelist archives

« back to archive

Public key export in paramiko

Public key export in paramiko

From:
Karolis Pabijanskas
Date:
2015-09-02 @ 13:38
Hi,

I am aware I can generate an ssh key using paramiko with something as
simple as:

import paramiko
k = paramiko.RSAKey.generate(2048)
k.write_private_key_file(filename)

I am probably being blind reading the docs and not seeing anything obvious,
but how can you export the public key from this private key into a file?
I.e. something similar to:

ssh-keygen -f ~/.ssh/id_rsa -y > ~/.ssh/id_rsa.pub

Thanks!