Table of Contents

Method SignAsync

Namespace
SshSharp
Assembly
SshSharp.dll

SignAsync(SshPrivateKey, ReadOnlyMemory<byte>, string, string, CancellationToken)

Signs message, as ssh-keygen -Y sign -n namespace does.

public static Task<SshSignature> SignAsync(SshPrivateKey key, ReadOnlyMemory<byte> message, string @namespace, string hashAlgorithm = "sha512", CancellationToken cancellationToken = default)

Parameters

key SshPrivateKey

The key to sign with: one loaded from a file, generated, or held by an SshAgent.

message ReadOnlyMemory<byte>

What to sign.

namespace string

What the signature is for, for example git, file, or your application's own name.

hashAlgorithm string

sha512 (as ssh-keygen) or sha256.

cancellationToken CancellationToken

Cancels an agent's signing.

Returns

Task<SshSignature>

Exceptions

ArgumentException

The namespace is empty, or the hash algorithm is not one of the two.

SignAsync(SshPrivateKey, Stream, string, string, CancellationToken)

Signs what message reads to its end, as ssh-keygen -Y sign signs a file.

public static Task<SshSignature> SignAsync(SshPrivateKey key, Stream message, string @namespace, string hashAlgorithm = "sha512", CancellationToken cancellationToken = default)

Parameters

key SshPrivateKey

The key to sign with: one loaded from a file, generated, or held by an SshAgent.

message Stream

What to sign.

namespace string

What the signature is for, for example git, file, or your application's own name.

hashAlgorithm string

sha512 (as ssh-keygen) or sha256.

cancellationToken CancellationToken

Cancels an agent's signing.

Returns

Task<SshSignature>

Exceptions

ArgumentException

The namespace is empty, or the hash algorithm is not one of the two.