RSA.SignHash Method

Definition

Overloads

SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)

When overridden in a derived class, computes the signature for the specified hash value using the specified padding.

SignHash(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

Computes the signature for the specified hash value using the specified padding.

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

Signs the hash with the current key, writing the signature into a provided buffer.

SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)

When overridden in a derived class, computes the signature for the specified hash value using the specified padding.

public:
 virtual cli::array <System::Byte> ^ SignHash(cli::array <System::Byte> ^ hash, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public:
 abstract cli::array <System::Byte> ^ SignHash(cli::array <System::Byte> ^ hash, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public virtual byte[] SignHash (byte[] hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
public abstract byte[] SignHash (byte[] hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
abstract member SignHash : byte[] * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
override this.SignHash : byte[] * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
abstract member SignHash : byte[] * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
Public Overridable Function SignHash (hash As Byte(), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Byte()
Public MustOverride Function SignHash (hash As Byte(), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Byte()

Parameters

hash
Byte[]

The hash value of the data to be signed.

hashAlgorithm
HashAlgorithmName

The hash algorithm used to create the hash value of the data.

padding
RSASignaturePadding

The padding.

Returns

Byte[]

The RSA signature for the specified hash value.

Exceptions

A derived class must override this method.

data or padding is null.

hashAlgorithm.Name is null or Empty.

padding is unknown, or not supported by this implementation.

-or-

This instance represents only a public key.

-or-

An error occurred creating the signature.

See also

Applies to

SignHash(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

Computes the signature for the specified hash value using the specified padding.

public:
 cli::array <System::Byte> ^ SignHash(ReadOnlySpan<System::Byte> hash, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public byte[] SignHash (ReadOnlySpan<byte> hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
member this.SignHash : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
Public Function SignHash (hash As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Byte()

Parameters

hash
ReadOnlySpan<Byte>

The hash value of the data to be signed.

hashAlgorithm
HashAlgorithmName

The hash algorithm used to create the hash of hash.

padding
RSASignaturePadding

The padding mode.

Returns

Byte[]

The RSA signature for the specified hash value.

Exceptions

padding or hashAlgorithm's Name is null.

hashAlgorithm's Name is an empty string.

padding is unknown, or not supported by this implementation.

-or-

This instance represents only a public key.

-or-

An error occurred creating the signature.

Applies to

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

Signs the hash with the current key, writing the signature into a provided buffer.

public:
 int SignHash(ReadOnlySpan<System::Byte> hash, Span<System::Byte> destination, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public int SignHash (ReadOnlySpan<byte> hash, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
member this.SignHash : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> int
Public Function SignHash (hash As ReadOnlySpan(Of Byte), destination As Span(Of Byte), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Integer

Parameters

hash
ReadOnlySpan<Byte>

The hash value of the data to be signed.

destination
Span<Byte>

The buffer to receive the RSA signature.

hashAlgorithm
HashAlgorithmName

The hash algorithm used to create the hash of hash.

padding
RSASignaturePadding

The padding mode.

Returns

The total number of bytes written to destination.

Exceptions

padding or hashAlgorithm's Name is null.

hashAlgorithm's Name is an empty string.

-or-

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

padding is unknown, or not supported by this implementation.

-or-

This instance represents only a public key.

-or-

An error occurred creating the signature.

Applies to