[Cryptography-dev] dumb question ... simple RSA ssh keys
Drew Fisher
drew.fisher at oracle.com
Tue Jul 14 20:45:26 CEST 2015
Good afternoon!
I'm trying to figure out how to replicate
'ssh-keygen -t rsa -b 2048 -q -N '' -C my_comment -f somefile'
with cryptography v0.8.2.
The best I've gotten to so far is
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
private_key = rsa.generate_private_key(
public_exponent=65537,
key_size=2048,
backend=default_backend()
)
public_key = private_key.public_key()
private_pem = private_key.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.TraditionalOpenSSL,
encryption_algorithm=serialization.NoEncryption()
)
public_pem = public_key.public_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PublicFormat.SubjectPublicKeyInfo
)
but when I put the public_pem content into a remote authorized_keys
file, I get prompted for the passphrase and password of the key.
Is it possible to replicate generation of simple ssh keys without
passphrases via cryptography?
Thanks!
-Drew
More information about the Cryptography-dev
mailing list