Bagikan melalui


X509Certificate.GetCertHash Metode

Definisi

Mengembalikan nilai hash untuk objek X509Certificate .

Overload

GetCertHash()

Mengembalikan nilai hash untuk sertifikat X.509v3 sebagai array byte.

GetCertHash(HashAlgorithmName)

Mengembalikan nilai hash untuk sertifikat X.509v3 yang dihitung dengan menggunakan algoritma hash kriptografi yang ditentukan.

GetCertHash()

Sumber:
X509Certificate.cs
Sumber:
X509Certificate.cs
Sumber:
X509Certificate.cs

Mengembalikan nilai hash untuk sertifikat X.509v3 sebagai array 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()

Mengembalikan

Byte[]

Nilai hash untuk sertifikat X.509.

Contoh

Contoh berikut menggunakan GetCertHash metode untuk mengisi array byte dengan nilai hash untuk sertifikat 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

Berlaku untuk

GetCertHash(HashAlgorithmName)

Sumber:
X509Certificate.cs
Sumber:
X509Certificate.cs
Sumber:
X509Certificate.cs

Mengembalikan nilai hash untuk sertifikat X.509v3 yang dihitung dengan menggunakan algoritma hash kriptografi yang ditentukan.

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

Parameter

hashAlgorithm
HashAlgorithmName

Nama algoritma hash kriptografi yang akan digunakan.

Mengembalikan

Byte[]

Array byte yang berisi nilai hash untuk sertifikat X.509.

Pengecualian

hashAlgorithm.Name adalah null atau string kosong.

hashAlgorithm bukan algoritma hash yang diketahui.

Lihat juga

Berlaku untuk