Binding.CertificateHash Property

Definition

Gets or sets the hash of the certificate to bind.

public:
 property cli::array <System::Byte> ^ CertificateHash { cli::array <System::Byte> ^ get(); void set(cli::array <System::Byte> ^ value); };
public byte[] CertificateHash { get; set; }
member this.CertificateHash : byte[] with get, set
Public Property CertificateHash As Byte()

Property Value

Byte[]

The byte array that represents the Secure Sockets Layer (SSL) binding hash.

Examples

The following example demonstrates the CertificateHash property. If the protocol identifier is "https", the certificate hash and certificate store name are displayed. This code example is part of a larger example provided for the Binding class.

if (binding.Protocol == "https")
{
     // There is a CertificateHash and  
     // CertificateStoreName for the https protocol only.
    bindingdisplay = bindingdisplay + "\n   CertificateHash: " + 
        binding.CertificateHash + ": ";
    // Display the hash.
    foreach (System.Byte certhashbyte in binding.CertificateHash)
    {
        bindingdisplay = bindingdisplay + certhashbyte.ToString() + " ";
    }
    bindingdisplay = bindingdisplay + "\n   CertificateStoreName: " + 
        binding.CertificateStoreName;
}

Remarks

The CertificateHash property contains the certificate hash for the SSL binding. The certificate hash is the unique identifier for the certificate.

The CertificateHash property is available only when the protocol identifier defined by the Protocol property is "https". An attempt to get or set the CertificateHash property for a binding with a protocol of "http" will raise an error.

The value of the CertificateHash property is set in the BindingCollection object.

Applies to