DSA.TryCreateSignature(ReadOnlySpan<Byte>, Span<Byte>, Int32) 方法

定义

尝试将指定哈希的 DSA 签名创建到所提供的缓冲区中。Attempts to create the DSA signature for the specified hash into the provided buffer.

public:
 virtual bool TryCreateSignature(ReadOnlySpan<System::Byte> hash, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public virtual bool TryCreateSignature (ReadOnlySpan<byte> hash, Span<byte> destination, out int bytesWritten);
abstract member TryCreateSignature : ReadOnlySpan<byte> * Span<byte> * int -> bool
override this.TryCreateSignature : ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Overridable Function TryCreateSignature (hash As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

参数

hash
ReadOnlySpan<Byte>

要签名的哈希值。The hash to sign.

destination
Span<Byte>

接收签名的字节范围。The byte span to receive the signature.

bytesWritten
Int32

此方法返回时,包含一个指示写入 destination 的字节数的值。When this method returns, contains a value that indicates the number of bytes written to destination.

返回

如果 destination 足够大可以接收结果,则为 true;否则为 falsetrue if destination is large enough to receive the result; otherwise, false.

异常

此实例仅表示一个公钥。This instance represents only a public key.

-or-

实现类型仅支持旧版 DSA (FIPS 186-2),并且 hash 不是 20 字节的值。The implementation type only supports legacy DSA (FIPS 186-2), and hash is not a 20-byte value.

-or-

创建签名失败。Creating the signature otherwise failed.

注解

此方法的默认实现是调用 CreateSignature(Byte[]) 并将结果复制到 @no__t。The default implementation of this method is to call CreateSignature(Byte[]) and copy the result to destination. 派生类型应重写此方法,以避免中间数组创建。Derived types should override this method to avoid the intermediate array creation.

适用于