X509Certificate.GetCertHash Metoda

Definice

Vrátí hodnotu hash objektu X509Certificate .

Přetížení

GetCertHash()

Vrátí hodnotu hash pro certifikát X.509v3 jako pole bajtů.

GetCertHash(HashAlgorithmName)

Vrátí hodnotu hash pro certifikát X.509v3 vypočítaný pomocí zadaného kryptografického hash algoritmu.

GetCertHash()

Vrátí hodnotu hash pro certifikát X.509v3 jako pole bajtů.

public:
 virtual cli::array <System::Byte> ^ GetCertHash();
public virtual byte[] GetCertHash ();
abstract member GetCertHash : unit -> byte[]
override this.GetCertHash : unit -> byte[]
Public Overridable Function GetCertHash () As Byte()

Návraty

Byte[]

Hodnota hash certifikátu X.509.

Příklady

Následující příklad používá metodu GetCertHash k vyplnění pole bajtů hodnotou hash pro certifikát X.509.

using namespace System;
using namespace System::Security::Cryptography::X509Certificates;
int 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.
   array<Byte>^results = cert->GetCertHash();
}

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.
        byte[] results = cert.GetCertHash();
    }
}
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 Byte() = cert.GetCertHash()
   End Sub 
End Class

Platí pro

GetCertHash(HashAlgorithmName)

Vrátí hodnotu hash pro certifikát X.509v3 vypočítaný pomocí zadaného kryptografického hash algoritmu.

public:
 virtual cli::array <System::Byte> ^ GetCertHash(System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public virtual byte[] GetCertHash (System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
abstract member GetCertHash : System.Security.Cryptography.HashAlgorithmName -> byte[]
override this.GetCertHash : System.Security.Cryptography.HashAlgorithmName -> byte[]
Public Overridable Function GetCertHash (hashAlgorithm As HashAlgorithmName) As Byte()

Parametry

hashAlgorithm
HashAlgorithmName

Název kryptografického algoritmu hash, který se má použít.

Návraty

Byte[]

Bajtové pole, které obsahuje hodnotu hash certifikátu X.509.

Výjimky

hashAlgorithm.Name je null nebo prázdný řetězec.

hashAlgorithm není známý algoritmus hash.

Viz také

Platí pro