RSA.SignHash Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
- Source:
- RSA.cs
- Source:
- RSA.cs
- Source:
- RSA.cs
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
The RSA signature for the specified hash value.
Exceptions
A derived class must override this method.
data
or padding
is null
.
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
- TrySignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)
- SignData(Byte[], HashAlgorithmName, RSASignaturePadding)
Applies to
SignHash(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)
- Source:
- RSA.cs
- Source:
- RSA.cs
- Source:
- RSA.cs
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
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.
This implementation has not implemented one of TrySignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32) or SignHash(Byte[], HashAlgorithmName, RSASignaturePadding).
Applies to
SignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding)
- Source:
- RSA.cs
- Source:
- RSA.cs
- Source:
- RSA.cs
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.
- 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.
This implementation has not implemented one of TrySignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32) or SignHash(Byte[], HashAlgorithmName, RSASignaturePadding).