Table of Contents

Method Parse

Namespace
SshSharp
Assembly
SshSharp.dll

Parse(string)

Parses one line in the OpenSSH public key format, <type> <base64> [comment]: a .pub file, the output of ssh-keygen -y, or an authorized_keys line without options. White space around the line is ignored.

public static SshPublicKey Parse(string line)

Parameters

line string

The line.

Returns

SshPublicKey

Remarks

authorized_keys options (restrict,command="..." ssh-ed25519 ...) are not parsed: a line that starts with them is refused rather than read without the restrictions they carry. Certificates (-cert.pub) are read by Parse(string).

Exceptions

FormatException

The line is not a single public key line of a supported type, the base64 is invalid, the key is malformed, or the type field does not match the key's own type.