X509Certificate.GetCertHash Metodo

Definizione

Restituisce il valore hash per un X509Certificate oggetto .

Overload

Nome Descrizione
GetCertHash()

Restituisce il valore hash per il certificato X.509v3 come matrice di byte.

GetCertHash(HashAlgorithmName)

Restituisce il valore hash per il certificato X.509v3 calcolato usando l'algoritmo hash crittografico specificato.

GetCertHash()

Origine:
X509Certificate.cs
Origine:
X509Certificate.cs
Origine:
X509Certificate.cs
Origine:
X509Certificate.cs
Origine:
X509Certificate.cs

Restituisce il valore hash per il certificato X.509v3 come matrice di byte.

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()

Valori restituiti

Byte[]

Valore hash per il certificato X.509.

Esempio

Nell'esempio seguente viene usato il GetCertHash metodo per riempire una matrice di byte con il valore hash per un certificato X.509.


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

Si applica a

GetCertHash(HashAlgorithmName)

Origine:
X509Certificate.cs
Origine:
X509Certificate.cs
Origine:
X509Certificate.cs
Origine:
X509Certificate.cs
Origine:
X509Certificate.cs

Restituisce il valore hash per il certificato X.509v3 calcolato usando l'algoritmo hash crittografico specificato.

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()

Parametri

hashAlgorithm
HashAlgorithmName

Nome dell'algoritmo hash crittografico da usare.

Valori restituiti

Byte[]

Matrice di byte che contiene il valore hash per il certificato X.509.

Eccezioni

hashAlgorithm.Name è null o una stringa vuota.

hashAlgorithm non è un algoritmo hash noto.

Vedi anche

Si applica a