X509Certificate.TryGetCertHash(HashAlgorithmName, Span<Byte>, Int32) 方法

定義

使用所指定雜湊演算法來雜湊憑證的編碼表示,以嘗試產生憑證的「指紋」。Attempts to produce a "thumbprint" for the certificate by hashing the encoded representation of the certificate with the specified hash algorithm.

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

用於指紋的演算法。The algorithm to use for the thumbprint.

destination
Span<Byte>

接收憑證指紋的緩衝區。The buffer to receive the certificate thumbprint.

bytesWritten
Int32

當此方法傳回時,為寫入 destination 的位元組總數。When this method returns, the total number of bytes written into destination. 這個參數會被視為未初始化。This parameter is treated as uninitialized.

傳回

如果 destination 的長度足以接收雜湊值,則為 true;否則為 falsetrue if destination is long enough to receive the hash value; otherwise, false.

例外狀況

hashAlgorithm.NamehashAlgorithm.Name null 或空字串。is null or an empty string.

hashAlgorithm 不是已知的雜湊演算法。hashAlgorithm is not a known hash algorithm.

適用於

另請參閱