X509Certificate.TryGetCertHash 方法

定义

尝试为证书生成“指纹”,方法是使用指定的哈希算法对已编码的证书表示形式进行哈希处理。

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

参数

hashAlgorithm
HashAlgorithmName

用于指纹的算法。

destination
Span<Byte>

用于接收证书指纹的缓冲区。

bytesWritten
Int32

此方法返回时,为写入 destination 的字节总数。 该参数未经初始化即被处理。

返回

Boolean

destination 的长度不足以接收哈希值,则为 true;否则为 false

例外

hashAlgorithm.Namenull 或空字符串。

hashAlgorithm 不是已知的哈希算法。

适用于

另请参阅