How to create keys for SSH.NET without using ssh-keygen on client-side?

201 views Asked by At

Users of our C# application must send their public SSH key to an administrator in order to create a secure SSH connection using the SSH.NET library which is integrated into our software.

Since some users don't have access to the ssh-keygen tool, we are working on a method to create the private and public keys directly from within our software. Is there a recommended way on which key algorithms and formats to use and how to create them?

Currently, we use BouncyCastle to create ECDSA384 key-pairs in OpenSSL PEM format.

  • The private key should be compatible with SSH.NET according to their documentation (https://github.com/sshnet/SSH.NET#public-key-authentication).
  • The public key must be transformed to the OpenSSH format so that it can be added to the authorized_keys file. Unfortunately, it seems that the conversion can't be done using ssh-keygen -f openssl.pub -i > openssh.pub, right?

My questions:

  1. Is this the right way to do it?
  2. How to transform the public key from OpenSSL PEM to OpenSSH format?

Thanks for your help!

0

There are 0 answers