Skip to content

OnixLabs.Security.Cryptography.IEcdsaPrivateKey

matthew edited this page May 27, 2026 · 1 revision

IEcdsaPrivateKey Interface

Defines an ECDSA cryptographic private key.

Namespace OnixLabs.Security.Cryptography
Assembly OnixLabs.Security.Cryptography.dll (NuGet)
Implements IPrivateKeyDerivable<EcdsaPublicKey>, IPrivateKeyImportable<EcdsaPrivateKey>, IPrivateKeyExportable, IBinaryConvertible

Definition

public interface IEcdsaPrivateKey :
    IPrivateKeyDerivable<EcdsaPublicKey>,
    IPrivateKeyImportable<EcdsaPrivateKey>,
    IPrivateKeyExportable,
    IBinaryConvertible

Remarks

IEcdsaPrivateKey provides two families of signing operation: SignData hashes input data before signing (accepting raw bytes, a byte-range slice, a Stream, or an IBinaryConvertible); SignHash signs a pre-computed hash directly. Both families accept either a HashAlgorithm instance or a HashAlgorithmName string, and both accept an optional DSASignatureFormat to select between IEEE P1363 and DER encoding.

Methods

Member Returns Description
SignData(ReadOnlySpan<byte>, HashAlgorithm, DSASignatureFormat) byte[] Hashes and signs a span of bytes using a HashAlgorithm instance.
SignData(ReadOnlySpan<byte>, int, int, HashAlgorithm, DSASignatureFormat) byte[] Hashes and signs a byte-range slice using a HashAlgorithm instance.
SignData(Stream, HashAlgorithm, DSASignatureFormat) byte[] Hashes and signs a Stream using a HashAlgorithm instance.
SignData(IBinaryConvertible, HashAlgorithm, DSASignatureFormat) byte[] Hashes and signs an IBinaryConvertible using a HashAlgorithm instance.
SignData(ReadOnlySpan<byte>, HashAlgorithmName, DSASignatureFormat) byte[] Hashes and signs a span of bytes using a HashAlgorithmName.
SignData(ReadOnlySpan<byte>, int, int, HashAlgorithmName, DSASignatureFormat) byte[] Hashes and signs a byte-range slice using a HashAlgorithmName.
SignData(Stream, HashAlgorithmName, DSASignatureFormat) byte[] Hashes and signs a Stream using a HashAlgorithmName.
SignData(IBinaryConvertible, HashAlgorithmName, DSASignatureFormat) byte[] Hashes and signs an IBinaryConvertible using a HashAlgorithmName.
SignHash(Hash, DSASignatureFormat) byte[] Signs a pre-computed Hash.
SignHash(ReadOnlySpan<byte>, DSASignatureFormat) byte[] Signs a pre-computed hash supplied as a raw span of bytes.

SignData overloads

byte[] SignData(ReadOnlySpan<byte> data, HashAlgorithm algorithm, DSASignatureFormat format = default);
byte[] SignData(ReadOnlySpan<byte> data, int offset, int count, HashAlgorithm algorithm, DSASignatureFormat format = default);
byte[] SignData(Stream data, HashAlgorithm algorithm, DSASignatureFormat format = default);
byte[] SignData(IBinaryConvertible data, HashAlgorithm algorithm, DSASignatureFormat format = default);
byte[] SignData(ReadOnlySpan<byte> data, HashAlgorithmName algorithm, DSASignatureFormat format = default);
byte[] SignData(ReadOnlySpan<byte> data, int offset, int count, HashAlgorithmName algorithm, DSASignatureFormat format = default);
byte[] SignData(Stream data, HashAlgorithmName algorithm, DSASignatureFormat format = default);
byte[] SignData(IBinaryConvertible data, HashAlgorithmName algorithm, DSASignatureFormat format = default);

Hashes the specified input data and signs the resulting hash.

Parameter Type Description
data ReadOnlySpan<byte> / Stream / IBinaryConvertible The input data to hash and sign.
offset int (slice overloads) The offset into the span from which to begin reading.
count int (slice overloads) The number of bytes to read from the span.
algorithm HashAlgorithm or HashAlgorithmName The hash algorithm used to hash the input data.
format DSASignatureFormat The digital signature format (IEEE P1363 or DER). Defaults to DSASignatureFormat.IeeeP1363FixedFieldConcatenation.

Returns — A byte[] containing the cryptographic digital signature.


SignHash overloads

byte[] SignHash(Hash hash, DSASignatureFormat format = default);
byte[] SignHash(ReadOnlySpan<byte> hash, DSASignatureFormat format = default);

Signs a pre-computed hash value.

Parameter Type Description
hash Hash or ReadOnlySpan<byte> The pre-computed hash to sign.
format DSASignatureFormat The digital signature format. Defaults to DSASignatureFormat.IeeeP1363FixedFieldConcatenation.

Returns — A byte[] containing the cryptographic digital signature.

See Also

ONIXLabs .NET Library


Clone this wiki locally