X509Certificate.GetCertHashString Methode

Definitie

Hiermee wordt een hexadecimale tekenreeks geretourneerd die de hash-waarde voor het X.509v3-certificaat bevat.

Overloads

Name Description
GetCertHashString()

Retourneert de SHA-1-hashwaarde voor het X.509v3-certificaat als een hexadecimale tekenreeks.

GetCertHashString(HashAlgorithmName)

Retourneert een hexadecimale tekenreeks met de hash-waarde voor het X.509v3-certificaat dat is berekend met behulp van het opgegeven cryptografische hash-algoritme.

GetCertHashString()

Bron:
X509Certificate.cs
Bron:
X509Certificate.cs
Bron:
X509Certificate.cs
Bron:
X509Certificate.cs
Bron:
X509Certificate.cs

Retourneert de SHA-1-hashwaarde voor het X.509v3-certificaat als een hexadecimale tekenreeks.

public:
 virtual System::String ^ GetCertHashString();
public virtual string GetCertHashString();
abstract member GetCertHashString : unit -> string
override this.GetCertHashString : unit -> string
Public Overridable Function GetCertHashString () As String

Retouren

De hexadecimale tekenreeksweergave van de hash-waarde van het X.509-certificaat.

Voorbeelden

In het volgende voorbeeld wordt de GetCertHashString methode gebruikt om een X.509-certificaathashwaarde op te halen, deze te converteren naar een tekenreeks en weer te geven naar de console.


using System;
using System.Security.Cryptography.X509Certificates;

public class X509
{

    public static void Main()
    {

        // The path to the certificate.
        string Certificate =  "Certificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate);

        // Get the value.
        string results = cert.GetCertHashString();

        // Display the value to the console.
        Console.WriteLine(results);
    }
}
Imports System.Security.Cryptography.X509Certificates

Public Class X509
   
   
   Public Shared Sub Main()
      
      ' The path to the certificate.
      Dim Certificate As String = "Certificate.cer"
      
      ' Load the certificate into an X509Certificate object.
      Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(Certificate)
      
      ' Get the value.
      Dim results As String = cert.GetCertHashString()
      
      ' Display the value to the console.
      Console.WriteLine(results)
   End Sub 
End Class

Van toepassing op

GetCertHashString(HashAlgorithmName)

Bron:
X509Certificate.cs
Bron:
X509Certificate.cs
Bron:
X509Certificate.cs
Bron:
X509Certificate.cs
Bron:
X509Certificate.cs

Retourneert een hexadecimale tekenreeks met de hash-waarde voor het X.509v3-certificaat dat is berekend met behulp van het opgegeven cryptografische hash-algoritme.

public:
 virtual System::String ^ GetCertHashString(System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public virtual string GetCertHashString(System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
abstract member GetCertHashString : System.Security.Cryptography.HashAlgorithmName -> string
override this.GetCertHashString : System.Security.Cryptography.HashAlgorithmName -> string
Public Overridable Function GetCertHashString (hashAlgorithm As HashAlgorithmName) As String

Parameters

hashAlgorithm
HashAlgorithmName

De naam van het cryptografische hash-algoritme dat moet worden gebruikt.

Retouren

De hexadecimale tekenreeksweergave van de hash-waarde van het X.509-certificaat.

Uitzonderingen

hashAlgorithm.Name is null of een lege tekenreeks.

hashAlgorithm is geen bekend hash-algoritme.

Van toepassing op