Share via


X509Certificate.Equals Yöntem

Tanım

Eşitlik için iki X509Certificate nesneyi karşılaştırır.

Aşırı Yüklemeler

Equals(Object)

Eşitlik için iki X509Certificate nesneyi karşılaştırır.

Equals(X509Certificate)

Eşitlik için iki X509Certificate nesneyi karşılaştırır.

Equals(Object)

Kaynak:
X509Certificate.cs
Kaynak:
X509Certificate.cs
Kaynak:
X509Certificate.cs

Eşitlik için iki X509Certificate nesneyi karşılaştırır.

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

Parametreler

obj
Object

X509Certificate Geçerli nesneyle karşılaştıracak bir nesne.

Döndürülenler

true geçerli X509Certificate nesne parametresi tarafından other belirtilen nesneye eşitse; değilse, false.

Öznitelikler

Örnekler

Aşağıdaki örnek, eşitlik için iki sertifikayı karşılaştırır.

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

Açıklamalar

İki nesne, nesneyse X509Certificate ve aynı veren ve seri numarasına sahipse eşit olarak kabul edilir.

Önemli

Equals Yöntemi, güvenlik amacıyla sertifikaları karşılaştırırken kullanılmamalıdır. Bunun yerine, özelliğinin veya özelliğinin RawData karması Thumbprint kullanın.

Şunlara uygulanır

Equals(X509Certificate)

Kaynak:
X509Certificate.cs
Kaynak:
X509Certificate.cs
Kaynak:
X509Certificate.cs

Eşitlik için iki X509Certificate nesneyi karşılaştırır.

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

Parametreler

other
X509Certificate

X509Certificate Geçerli nesneyle karşılaştıracak bir nesne.

Döndürülenler

true geçerli X509Certificate nesne parametresi tarafından other belirtilen nesneye eşitse; değilse, false.

Örnekler

Aşağıdaki örnek, eşitlik için iki sertifikayı karşılaştırır.

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

Açıklamalar

Aynı veren ve seri numarasına sahip olan iki X509Certificate nesne eşit olarak kabul edilir.

Önemli

Equals Yöntemi, güvenlik amacıyla sertifikaları karşılaştırırken kullanılmamalıdır. Bunun yerine, özelliğinin veya özelliğinin RawData karması Thumbprint kullanın.

Şunlara uygulanır