Method SignAsync
- Namespace
- SshSharp
- Assembly
- SshSharp.dll
SignAsync(SshPrivateKey, ReadOnlyMemory<byte>, string, string, CancellationToken)
Signs message, as ssh-keygen -Y sign -n does.namespace
public static Task<SshSignature> SignAsync(SshPrivateKey key, ReadOnlyMemory<byte> message, string @namespace, string hashAlgorithm = "sha512", CancellationToken cancellationToken = default)
Parameters
keySshPrivateKeyThe key to sign with: one loaded from a file, generated, or held by an SshAgent.
messageReadOnlyMemory<byte>What to sign.
namespacestringWhat the signature is for, for example
git,file, or your application's own name.hashAlgorithmstringsha512(as ssh-keygen) orsha256.cancellationTokenCancellationTokenCancels an agent's signing.
Returns
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
keySshPrivateKeyThe key to sign with: one loaded from a file, generated, or held by an SshAgent.
messageStreamWhat to sign.
namespacestringWhat the signature is for, for example
git,file, or your application's own name.hashAlgorithmstringsha512(as ssh-keygen) orsha256.cancellationTokenCancellationTokenCancels an agent's signing.
Returns
Exceptions
- ArgumentException
The namespace is empty, or the hash algorithm is not one of the two.