ECDsa.SignHash Method

Definition

Overloads

SignHash(Byte[])

Generates a digital signature for the specified hash value.

SignHash(ReadOnlySpan<Byte>)

Computes the ECDSA signature for the specified hash value.

SignHash(Byte[], DSASignatureFormat)

Computes the ECDSA signature for the specified hash value in the indicated format.

SignHash(ReadOnlySpan<Byte>, DSASignatureFormat)

Computes the ECDSA signature for the specified hash value in the indicated format.

SignHash(ReadOnlySpan<Byte>, Span<Byte>)

Computes the ECDSA signature for the specified hash value into the provided buffer.

SignHash(ReadOnlySpan<Byte>, Span<Byte>, DSASignatureFormat)

Computes the ECDSA signature for the specified hash value in the indicated format into the provided buffer.

SignHash(Byte[])

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Generates a digital signature for the specified hash value.

C#
public abstract byte[] SignHash(byte[] hash);

Parameters

hash
Byte[]

The hash value of the data that is being signed.

Returns

Byte[]

A digital signature for the specified hash value.

Exceptions

The hash parameter is null.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.4, 1.6, 2.0, 2.1

SignHash(ReadOnlySpan<Byte>)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the ECDSA signature for the specified hash value.

C#
public byte[] SignHash(ReadOnlySpan<byte> hash);

Parameters

hash
ReadOnlySpan<Byte>

The hash value of the data that is being signed.

Returns

Byte[]

A digital signature for the specified hash value.

Exceptions

An error occurred in the signing operation.

Remarks

This method will use IeeeP1363FixedFieldConcatenation to encode the the signature. To use a different signature format, use SignHash(ReadOnlySpan<Byte>, DSASignatureFormat).

Applies to

.NET 9 and other versions
Product Versions
.NET 7, 8, 9

SignHash(Byte[], DSASignatureFormat)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the ECDSA signature for the specified hash value in the indicated format.

C#
public byte[] SignHash(byte[] hash, System.Security.Cryptography.DSASignatureFormat signatureFormat);

Parameters

hash
Byte[]

The hash value to sign.

signatureFormat
DSASignatureFormat

The encoding format to use for the signature.

Returns

Byte[]

The ECDSA signature for the specified data.

Exceptions

hash is null.

signatureFormat is not a known format.

An error occurred in the signing operation.

Applies to

.NET 9 and other versions
Product Versions
.NET 5, 6, 7, 8, 9

SignHash(ReadOnlySpan<Byte>, DSASignatureFormat)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the ECDSA signature for the specified hash value in the indicated format.

C#
public byte[] SignHash(ReadOnlySpan<byte> hash, System.Security.Cryptography.DSASignatureFormat signatureFormat);

Parameters

hash
ReadOnlySpan<Byte>

The hash value of the data that is being signed.

signatureFormat
DSASignatureFormat

The encoding format to use for the signature.

Returns

Byte[]

A digital signature for the specified hash value.

Exceptions

signatureFormat is not a known format.

An error occurred in the signing operation.

Applies to

.NET 9 and other versions
Product Versions
.NET 7, 8, 9

SignHash(ReadOnlySpan<Byte>, Span<Byte>)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the ECDSA signature for the specified hash value into the provided buffer.

C#
public int SignHash(ReadOnlySpan<byte> hash, Span<byte> destination);

Parameters

hash
ReadOnlySpan<Byte>

The hash value of the data that is being signed.

destination
Span<Byte>

The buffer to receive the signature.

Returns

The total number of bytes written to destination.

Exceptions

An error occurred in the signing operation.

The buffer in destination is too small to hold the signature.

Remarks

This method will use IeeeP1363FixedFieldConcatenation to encode the the signature. To use a different signature format, use SignHash(ReadOnlySpan<Byte>, Span<Byte>, DSASignatureFormat).

Applies to

.NET 9 and other versions
Product Versions
.NET 7, 8, 9

SignHash(ReadOnlySpan<Byte>, Span<Byte>, DSASignatureFormat)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the ECDSA signature for the specified hash value in the indicated format into the provided buffer.

C#
public int SignHash(ReadOnlySpan<byte> hash, Span<byte> destination, System.Security.Cryptography.DSASignatureFormat signatureFormat);

Parameters

hash
ReadOnlySpan<Byte>

The hash value of the data that is being signed.

destination
Span<Byte>

The buffer to receive the signature.

signatureFormat
DSASignatureFormat

The encoding format to use for the signature.

Returns

The total number of bytes written to destination.

Exceptions

signatureFormat is not a known format.

An error occurred in the signing operation.

The buffer in destination is too small to hold the signature.

Applies to

.NET 9 and other versions
Product Versions
.NET 7, 8, 9