项目作者: bhalbright

项目描述 :
OpenSSH key parser in C#
高级语言: C#
项目地址: git://github.com/bhalbright/openssh-key-parser.git
创建时间: 2019-05-14T03:12:49Z
项目社区:https://github.com/bhalbright/openssh-key-parser

开源协议:MIT License

下载


openssh-key-parser

C# parser for private keys in the OpenSSH file format (i.e. openssh-key-v1).

The following key types are supported

  • ssh-ed25519
  • ssh-rsa
  • ssh-dss (DSA)
  • ecdsa-sha2-nistp256
  • ecdsa-sha2-nistp384
  • ecdsa-sha2-nistp521

Example usage:

  1. var keyPair = (Ed25519KeyPair)OpenSshKeyParser.ParseOpenSshKeyFile(
  2. System.IO.File.ReadAllText(@"E:\keys\ed25519_with_passphrase"), "password");

The format for openssh-key-v1 is documented here. But to be honest, this doesn’t quite give you all you need. I looked quite a bit at how the sshj library parses these keys and a extracting a key/iv from the KDF was directly ported from sshj. The crypto stuff like Bcrypt and ae256-ctr were used from existing sources. I used a little code from ssh.net on reading the binary data from the keyfile. Finally, I owe picking the parts from ECDSA keys to this ssh.net fork.