RSA.SignData Method

Definition

Computes the hash value of the specified data and signs it.

Overloads

SignData(Byte[], HashAlgorithmName, RSASignaturePadding)

Computes the hash value of the specified byte array using the specified hash algorithm and padding mode, and signs the resulting hash value.

SignData(Stream, HashAlgorithmName, RSASignaturePadding)

Computes the hash value of the specified stream using the specified hash algorithm and padding mode, and signs the resulting hash value.

SignData(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

Computes the hash value of the specified data and signs it.

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

Computes the hash of the provided data with the specified algorithm and sign the hash with the current key, writing the signature into a provided buffer.

SignData(Byte[], Int32, Int32, HashAlgorithmName, RSASignaturePadding)

Computes the hash value of a portion of the specified byte array using the specified hash algorithm and padding mode, and signs the resulting hash value.

SignData(Byte[], HashAlgorithmName, RSASignaturePadding)

Source:
RSA.cs
Source:
RSA.cs
Source:
RSA.cs

Computes the hash value of the specified byte array using the specified hash algorithm and padding mode, and signs the resulting hash value.

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

Parameters

data
Byte[]

The input data to hash and sign.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

padding
RSASignaturePadding

The padding mode.

Returns

Byte[]

The RSA signature for the specified data.

Exceptions

data is null.

-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

SignData(Stream, HashAlgorithmName, RSASignaturePadding)

Source:
RSA.cs
Source:
RSA.cs
Source:
RSA.cs

Computes the hash value of the specified stream using the specified hash algorithm and padding mode, and signs the resulting hash value.

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

Parameters

data
Stream

The input stream to hash and sign.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

padding
RSASignaturePadding

The padding mode.

Returns

Byte[]

The RSA signature for the specified data.

Exceptions

data is null.

-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

SignData(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

Source:
RSA.cs
Source:
RSA.cs
Source:
RSA.cs

Computes the hash value of the specified data and signs it.

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

Parameters

data
ReadOnlySpan<Byte>

The input data to hash and sign.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

padding
RSASignaturePadding

The padding mode.

Returns

Byte[]

The RSA signature for the specified data.

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

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

Source:
RSA.cs
Source:
RSA.cs
Source:
RSA.cs

Computes the hash of the provided data with the specified algorithm and sign the hash with the current key, writing the signature into a provided buffer.

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

Parameters

data
ReadOnlySpan<Byte>

The input data to hash and sign.

destination
Span<Byte>

The buffer to receive the RSA signature.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

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

SignData(Byte[], Int32, Int32, HashAlgorithmName, RSASignaturePadding)

Source:
RSA.cs
Source:
RSA.cs
Source:
RSA.cs

Computes the hash value of a portion of the specified byte array using the specified hash algorithm and padding mode, and signs the resulting hash value.

public:
 virtual cli::array <System::Byte> ^ SignData(cli::array <System::Byte> ^ data, int offset, int count, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public virtual byte[] SignData (byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
abstract member SignData : byte[] * int * int * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
override this.SignData : byte[] * int * int * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
Public Overridable Function SignData (data As Byte(), offset As Integer, count As Integer, hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Byte()

Parameters

data
Byte[]

The input data to hash and sign.

offset
Int32

The offset into the array at which to begin using data.

count
Int32

The number of bytes in the array to use as data.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

padding
RSASignaturePadding

The padding mode.

Returns

Byte[]

The RSA signature for the specified data.

Exceptions

data is null.

-or-

padding is null.

hashAlgorithm.Name is null or Empty.

offset is less than zero.

-or-

count is less than zero.

-or-

offset + count - 1 results in an index that is beyond the upper bound of data.

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