Method Sign
- Namespace
- MailFathom.Common.ClientAssertions
- Assembly
- MailFathom.Common.dll
Sign(AsymmetricAlgorithm, ReadOnlySpan<byte>)
Signs the assertion's signing input with the key that mints it.
public static byte[] Sign(AsymmetricAlgorithm signingKey, ReadOnlySpan<byte> signingInput)
Parameters
signingKeyAsymmetricAlgorithmThe private key.
signingInputReadOnlySpan<byte>The encoded header and payload, joined by a full stop, as the compact serialization defines it.
Returns
- byte[]
The signature, in the encoding a JSON Web Signature carries for the key's algorithm.
Remarks
The elliptic-curve signature is produced as the fixed-width concatenation of its two halves rather than as a DER
sequence, because that is the encoding RFC 7518 section 3.4 defines for ES256 and its siblings — and the
one difference between a signature a verifier reads and one it rejects without saying why.
Exceptions
- ArgumentNullException
Thrown when
signingKeyis null.- NotSupportedException
Thrown when the key is of a kind AlgorithmFor(AsymmetricAlgorithm) names no algorithm for.