RSA.VerifyData Method

Definition

Verifies that a digital signature is valid.

Overloads

VerifyData(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and padding, and comparing it to the provided signature.

VerifyData(Stream, Byte[], HashAlgorithmName, RSASignaturePadding)

Verifies that a digital signature is valid by calculating the hash value of the specified stream using the specified hash algorithm and padding, and comparing it to the provided signature.

VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and padding, and comparing it to the provided signature.

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

Verifies that a digital signature is valid by calculating the hash value of the data in a portion of a byte array using the specified hash algorithm and padding, and comparing it to the provided signature.

VerifyData(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

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

Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and padding, and comparing it to the provided signature.

public bool VerifyData (byte[] data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);

Parameters

data
Byte[]

The signed data.

signature
Byte[]

The signature data to be verified.

hashAlgorithm
HashAlgorithmName

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

padding
RSASignaturePadding

The padding mode.

Returns

true if the signature is valid; otherwise, false.

Exceptions

data is null.

-or-

signature is null.

-or-

padding is null.

hashAlgorithm.Name is null or Empty.

padding is unknown, or not supported by this implementation.

Applies to

.NET 9 en andere versies
Product Versies
.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 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

VerifyData(Stream, Byte[], HashAlgorithmName, RSASignaturePadding)

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

Verifies that a digital signature is valid by calculating the hash value of the specified stream using the specified hash algorithm and padding, and comparing it to the provided signature.

public bool VerifyData (System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);

Parameters

data
Stream

The signed data.

signature
Byte[]

The signature data to be verified.

hashAlgorithm
HashAlgorithmName

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

padding
RSASignaturePadding

The padding mode.

Returns

true if the signature is valid; otherwise, false.

Exceptions

data is null.

-or-

signature is null.

-or-

padding is null.

hashAlgorithm.Name is null or Empty.

padding is unknown, or not supported by this implementation.

Applies to

.NET 9 en andere versies
Product Versies
.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 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

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

Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and padding, and comparing it to the provided signature.

public virtual bool VerifyData (ReadOnlySpan<byte> data, ReadOnlySpan<byte> signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);

Parameters

data
ReadOnlySpan<Byte>

The signed data.

signature
ReadOnlySpan<Byte>

The signature data to be verified.

hashAlgorithm
HashAlgorithmName

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

padding
RSASignaturePadding

The padding mode.

Returns

true if the signature is valid; otherwise, false.

Exceptions

hashAlgorithm.Name is null or Empty.

padding is unknown, or not supported by this implementation.

Applies to

.NET 9 en andere versies
Product Versies
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Standard 2.1

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

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

Verifies that a digital signature is valid by calculating the hash value of the data in a portion of a byte array using the specified hash algorithm and padding, and comparing it to the provided signature.

public virtual bool VerifyData (byte[] data, int offset, int count, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);

Parameters

data
Byte[]

The signed data.

offset
Int32

The starting index at which to compute the hash.

count
Int32

The number of bytes to hash.

signature
Byte[]

The signature data to be verified.

hashAlgorithm
HashAlgorithmName

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

padding
RSASignaturePadding

The padding mode.

Returns

true if the signature is valid; otherwise, false.

Exceptions

data is null.

-or-

signature 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.

Applies to

.NET 9 en andere versies
Product Versies
.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 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1