Comparteix a través de


X509Certificate.GetCertHash Método

Definición

Devuelve el valor hash de un objeto X509Certificate.

Sobrecargas

GetCertHash()

Devuelve el valor hash del certificado X.509v3 en forma de matriz de bytes.

GetCertHash(HashAlgorithmName)

Devuelve el valor hash del certificado X.509v3 que se calcula mediante el algoritmo hash criptográfico especificado.

GetCertHash()

Source:
X509Certificate.cs
Source:
X509Certificate.cs
Source:
X509Certificate.cs

Devuelve el valor hash del certificado X.509v3 en forma de matriz de bytes.

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

Devoluciones

Byte[]

Valor hash del certificado X.509.

Ejemplos

En el ejemplo siguiente se usa el GetCertHash método para rellenar una matriz de bytes con el valor hash de un certificado 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

Se aplica a

GetCertHash(HashAlgorithmName)

Source:
X509Certificate.cs
Source:
X509Certificate.cs
Source:
X509Certificate.cs

Devuelve el valor hash del certificado X.509v3 que se calcula mediante el algoritmo hash criptográfico especificado.

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

Parámetros

hashAlgorithm
HashAlgorithmName

Nombre del algoritmo hash criptográfico que se va a usar.

Devoluciones

Byte[]

Matriz de bytes que contiene el valor hash del certificado X.509.

Excepciones

hashAlgorithm.Name es null o una cadena vacía.

hashAlgorithm no es un algoritmo hash conocido.

Consulte también

Se aplica a