internal SecureChannel(string hostname, bool serverMode, SchProtocols protocolFlags, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus, EncryptionPolicy encryptionPolicy, LocalCertSelectionCallback certSelectionDelegate) { if (Logging.On) { Logging.PrintInfo(Logging.Web, this, ".ctor", string.Concat(new object[] { "hostname=", hostname, ", #clientCertificates=", (clientCertificates == null) ? "0" : clientCertificates.Count.ToString(NumberFormatInfo.InvariantInfo), ", encryptionPolicy=", encryptionPolicy })); } SSPIWrapper.GetVerifyPackageInfo(GlobalSSPI.SSPISecureChannel, "Microsoft Unified Security Protocol Provider", true); if (ComNetOS.IsWin9x && (clientCertificates.Count > 0)) { this.m_Destination = hostname + "+" + clientCertificates.GetHashCode(); } else { this.m_Destination = hostname; } this.m_HostName = hostname; this.m_ServerMode = serverMode; if (serverMode) { this.m_ProtocolFlags = protocolFlags & SchProtocols.ServerMask; } else { this.m_ProtocolFlags = protocolFlags & SchProtocols.ClientMask; } this.m_ServerCertificate = serverCertificate; this.m_ClientCertificates = clientCertificates; this.m_RemoteCertRequired = remoteCertRequired; this.m_SecurityContext = null; this.m_CheckCertRevocation = checkCertRevocationStatus; this.m_CheckCertName = checkCertName; this.m_CertSelectionDelegate = certSelectionDelegate; this.m_RefreshCredentialNeeded = true; this.m_EncryptionPolicy = encryptionPolicy; }
public static void X509CertificateCollectionGetHashCode() { using (X509Certificate c1 = new X509Certificate()) using (X509Certificate c2 = new X509Certificate()) using (X509Certificate c3 = new X509Certificate()) { X509CertificateCollection cc = new X509CertificateCollection(new X509Certificate[] { c1, c2, c3 }); int expected = c1.GetHashCode() + c2.GetHashCode() + c3.GetHashCode(); Assert.Equal(expected, cc.GetHashCode()); } }