Replace ckeygen with Paramiko library calls, since ckeygen doesn't work on Windows.

This commit is contained in:
Itamar Turner-Trauring 2021-01-11 14:02:45 -05:00
parent ce58f63040
commit 6b2a999f8d

View File

@ -16,6 +16,8 @@ from twisted.internet.error import ProcessExitedAlready, ProcessDone
import requests
from paramiko.rsakey import RSAKey
from allmydata.util.configutil import (
get_config,
set_config,
@ -510,5 +512,7 @@ def await_client_ready(tahoe, timeout=10, liveness=60*2):
def generate_ssh_key(path):
"""Create a new SSH private/public key pair."""
check_call(["ckeygen", "--type", "rsa", "--no-passphrase", "--bits", "2048",
"--file", path, "--private-key-subtype", "v1"])
key = RSAKey.generate(2048)
key.write_private_key_file(path)
with open(path + ".pub", "wb") as f:
f.write(b"%s %s" % (key.get_name(), key.get_base64()))