X509Certificate.GetCertHashString 메서드

정의

X.509v3 인증서에 대한 해시 값이 포함된 16진수 문자열을 반환합니다.

오버로드

GetCertHashString()

X.509v3 인증서의 SHA1 해시 값을 16진수 문자열로 반환합니다.

GetCertHashString(HashAlgorithmName)

지정된 암호화 해시 알고리즘을 사용하여 계산된 X.509v3 인증서에 대한 해시 값을 포함하는 16진수 문자열을 반환합니다.

GetCertHashString()

X.509v3 인증서의 SHA1 해시 값을 16진수 문자열로 반환합니다.

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

반환

String

16진 문자열로 나타낸 Authenticode X.509 v.3 인증서 해시 값입니다.

예제

다음 예제에서는 메서드를 GetCertHashString 사용하여 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.
   String^ results = cert->GetCertHashString();
   
   // Display the value to the console.
   Console::WriteLine( results );
}

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

적용 대상

GetCertHashString(HashAlgorithmName)

지정된 암호화 해시 알고리즘을 사용하여 계산된 X.509v3 인증서에 대한 해시 값을 포함하는 16진수 문자열을 반환합니다.

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

매개 변수

hashAlgorithm
HashAlgorithmName

사용할 암호화 해시 알고리즘의 이름입니다.

반환

String

16진 문자열로 나타낸 Authenticode X.509 v.3 인증서 해시 값입니다.

예외

hashAlgorithm.Namenull 또는 빈 문자열입니다.

hashAlgorithm은 알려진 해시 알고리즘이 아닙니다.

적용 대상