Redigera

Dela via


X509Certificate.TryGetCertHash Method

Definition

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

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm to use for the thumbprint.

destination
Span<Byte>

The buffer to receive the certificate thumbprint.

bytesWritten
Int32

When this method returns, the total number of bytes written into destination. This parameter is treated as uninitialized.

Returns

true if destination is long enough to receive the hash value; otherwise, false.

Exceptions

hashAlgorithm.Name is null or an empty string.

hashAlgorithm is not a known hash algorithm.

Applies to

See also