Прочетете на английски Редактиране

Споделяне чрез


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.

C#
public virtual bool TryGetCertHash(System.Security.Cryptography.HashAlgorithmName hashAlgorithm, Span<byte> destination, out int bytesWritten);

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

Продукт Версии
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1

See also