RSA.SignData 方法
定义
计算指定数据的哈希值,并对其进行签名。Computes the hash value of the specified data and signs it.
重载
| 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(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)
使用指定的哈希算法和填充模式计算指定字节的哈希值,并对生产的哈希值进行签名。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()
参数
- 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.
返回
- Byte[]
指定的数据的 RSA 签名。The RSA signature for the specified data.
例外
padding 未知或不受此实现支持。padding is unknown, or not supported by this implementation.
- 或 --or-
此实例仅表示一个公钥。This instance represents only a public key.
- 或 --or-
创建签名时出错。An error occurred creating the signature.
另请参阅
- TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)
- SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)
适用于
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.
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()
参数
- 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.
返回
- Byte[]
指定的数据的 RSA 签名。The RSA signature for the specified data.
例外
padding 未知或不受此实现支持。padding is unknown, or not supported by this implementation.
- 或 --or-
此实例仅表示一个公钥。This instance represents only a public key.
- 或 --or-
创建签名时出错。An error occurred creating the signature.
另请参阅
- TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)
- SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)
适用于
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.
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()
参数
- 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.
返回
- Byte[]
指定的数据的 RSA 签名。The RSA signature for the specified data.
例外
offset 小于零。offset is less than zero.
- 或 --or-
count 小于零。count is less than zero.
- 或 --or-
offset + count - 1 会导致超出 data 上限的索引。offset + count - 1 results in an index that is beyond the upper bound of data.
padding 未知或不受此实现支持。padding is unknown, or not supported by this implementation.
- 或 --or-
此实例仅表示一个公钥。This instance represents only a public key.
- 或 --or-
创建签名时出错。An error occurred creating the signature.
另请参阅
- TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)
- SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)