Table of Contents

Class SshKeyRevocationList

Namespace
SshSharp
Assembly
SshSharp.dll

A list of revoked keys, as sshd's RevokedKeys and ssh's RevokedHostKeys read it: an OpenSSH Key Revocation List (KRL, the binary file ssh-keygen -k writes), or a text file of public keys, one per line. Check a user's key or certificate against it before trusting it, as ssh-keygen -Q does.

public sealed class SshKeyRevocationList
Inheritance
SshKeyRevocationList
Inherited Members

Remarks

A KRL revokes plain keys (explicitly, or by SHA-1 or SHA-256 fingerprint) and certificates (by serial number, serial range or key id, for one certificate authority or for any). A certificate is also revoked when its certified key or its authority's key is. Serial 0, which a certificate carries when its authority assigned none, is never revoked by serial. In a text file of keys, lines that do not parse are skipped, as in OpenSSH, and a certificate line (a FIDO security key's too) revokes the key it certifies; a certificate line of a type SshSharp accepts (Ed25519, ECDSA, RSA, FIDO) whose key cannot be read refuses the file instead of being skipped, so a revoked key is never accepted. A certificate line of another type (DSA, or one this library does not know) is skipped.

A KRL's signature sections are read but not verified: OpenSSH checks a signature only against the key the KRL itself carries, which proves nothing about who wrote the file. The file is trusted as local configuration, so protect it as such. Immutable and thread-safe once read.

Properties

IsKrl

Whether the data was a KRL; false for a text file of public keys.

Methods

IsRevoked(SshCertificate)

Whether certificate is revoked: by its serial number or key id (for its authority, or for any), or because its certified key or its authority's key is.

IsRevoked(SshPublicKey)

Whether key is revoked: listed, or listed by its SHA-1 or SHA-256 fingerprint.

LoadAsync(string, CancellationToken)

Reads a revoked keys file, as Parse(ReadOnlySpan<byte>) does.

Parse(ReadOnlySpan<byte>)

Reads a KRL, or, when data does not start with the KRL header (SSHKRL), a text file of public keys in UTF-8, as OpenSSH tells them apart.