다음을 통해 공유


X509Certificate.Equals 메서드

정의

X509Certificate 개체가 같은지 비교합니다.

오버로드

Equals(Object)

X509Certificate 개체가 같은지 비교합니다.

Equals(X509Certificate)

X509Certificate 개체가 같은지 비교합니다.

Equals(Object)

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

X509Certificate 개체가 같은지 비교합니다.

public:
 override bool Equals(System::Object ^ obj);
public override bool Equals (object? obj);
public override bool Equals (object obj);
[System.Runtime.InteropServices.ComVisible(false)]
public override bool Equals (object obj);
override this.Equals : obj -> bool
[<System.Runtime.InteropServices.ComVisible(false)>]
override this.Equals : obj -> bool
Public Overrides Function Equals (obj As Object) As Boolean

매개 변수

obj
Object

현재 개체와 비교할 X509Certificate 개체입니다.

반환

현재 X509Certificate 개체가 other 매개 변수에 의해 지정된 개체와 같으면 true이고, 그렇지 않으면 false입니다.

특성

예제

다음 예제에서는 두 인증서를 같음으로 비교합니다.

using namespace System;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
   
   // The path to the certificate.
   String^ Certificate = "Certificate.cer";
   String^ OtherCertificate = "OtherCertificate.cer";
   
   // Load the certificate into an X509Certificate object.
   X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate );
   
   // Load the certificate into an X509Certificate object.
   X509Certificate^ certTwo = X509Certificate::CreateFromCertFile( OtherCertificate );
   
   // Get the value.
   bool result = cert->Equals( certTwo );
   
   // Display the value to the console.
   Console::WriteLine( result );
}

using System;
using System.Security.Cryptography.X509Certificates;

public class X509
{

    public static void Main()
    {

        // The path to the certificate.
        string Certificate =  "Certificate.cer";
        string OtherCertificate =  "OtherCertificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate);

        // Load the certificate into an X509Certificate object.
        X509Certificate certTwo = X509Certificate.CreateFromCertFile(OtherCertificate);

        // Get the value.
        bool result = cert.Equals(certTwo);

        // Display the value to the console.
        Console.WriteLine(result);
    }
}
Imports System.Security.Cryptography.X509Certificates




Public Class X509
   
   
   Public Shared Sub Main()
      
      ' The path to the certificate.
      Dim Certificate As String = "Certificate.cer"
      Dim OtherCertificate As String = "OtherCertificate.cer"
      
      ' Load the certificate into an X509Certificate object.
      Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(Certificate)
      
      ' Load the certificate into an X509Certificate object.
      Dim certTwo As X509Certificate = X509Certificate.CreateFromCertFile(OtherCertificate)
      
      ' Get the value.
      Dim result As Boolean = cert.Equals(certTwo)
      
      ' Display the value to the console.
      Console.WriteLine(result)
   End Sub  
End Class

설명

두 개체가 개체이고 발급자와 일련 번호가 같으면 같은 것으로 간주됩니다 X509Certificate .

중요

Equals 보안 목적으로 인증서를 비교할 때 메서드를 사용하면 안 됩니다. 대신 속성의 RawData 해시 또는 Thumbprint 속성을 사용합니다.

적용 대상

Equals(X509Certificate)

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

X509Certificate 개체가 같은지 비교합니다.

public:
 virtual bool Equals(System::Security::Cryptography::X509Certificates::X509Certificate ^ other);
public virtual bool Equals (System.Security.Cryptography.X509Certificates.X509Certificate? other);
public virtual bool Equals (System.Security.Cryptography.X509Certificates.X509Certificate other);
override this.Equals : System.Security.Cryptography.X509Certificates.X509Certificate -> bool
Public Overridable Function Equals (other As X509Certificate) As Boolean

매개 변수

other
X509Certificate

현재 개체와 비교할 X509Certificate 개체입니다.

반환

현재 X509Certificate 개체가 other 매개 변수에 의해 지정된 개체와 같으면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는 두 인증서를 같음으로 비교합니다.

using namespace System;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
   
   // The path to the certificate.
   String^ Certificate = "Certificate.cer";
   String^ OtherCertificate = "OtherCertificate.cer";
   
   // Load the certificate into an X509Certificate object.
   X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate );
   
   // Load the certificate into an X509Certificate object.
   X509Certificate^ certTwo = X509Certificate::CreateFromCertFile( OtherCertificate );
   
   // Get the value.
   bool result = cert->Equals( certTwo );
   
   // Display the value to the console.
   Console::WriteLine( result );
}

using System;
using System.Security.Cryptography.X509Certificates;

public class X509
{

    public static void Main()
    {

        // The path to the certificate.
        string Certificate =  "Certificate.cer";
        string OtherCertificate =  "OtherCertificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate);

        // Load the certificate into an X509Certificate object.
        X509Certificate certTwo = X509Certificate.CreateFromCertFile(OtherCertificate);

        // Get the value.
        bool result = cert.Equals(certTwo);

        // Display the value to the console.
        Console.WriteLine(result);
    }
}
Imports System.Security.Cryptography.X509Certificates




Public Class X509
   
   
   Public Shared Sub Main()
      
      ' The path to the certificate.
      Dim Certificate As String = "Certificate.cer"
      Dim OtherCertificate As String = "OtherCertificate.cer"
      
      ' Load the certificate into an X509Certificate object.
      Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(Certificate)
      
      ' Load the certificate into an X509Certificate object.
      Dim certTwo As X509Certificate = X509Certificate.CreateFromCertFile(OtherCertificate)
      
      ' Get the value.
      Dim result As Boolean = cert.Equals(certTwo)
      
      ' Display the value to the console.
      Console.WriteLine(result)
   End Sub  
End Class

설명

X509Certificate 개체가 발급자와 일련 번호가 같으면 같은 것으로 간주됩니다.

중요

Equals 보안 목적으로 인증서를 비교할 때 메서드를 사용하면 안 됩니다. 대신 속성의 RawData 해시 또는 Thumbprint 속성을 사용합니다.

적용 대상