示例#1
0
        int ServerNameCallback()
        {
            Debug("SERVER NAME CALLBACK");
            var name = ssl.GetServerName();

            Debug($"SERVER NAME CALLBACK #1: {name}");

            var certificate = SelectServerCertificate(name);

            if (certificate == null)
            {
                return(1);
            }

            nativeServerCertificate = GetPrivateCertificate(certificate);
            SetPrivateCertificate(nativeServerCertificate);

            return(1);
        }
示例#2
0
        void InitializeSession()
        {
            GetPeerCertificate();

            if (IsServer && AskForClientCertificate && !certificateValidated)
            {
                if (!ValidateCertificate(null, null))
                {
                    throw new TlsException(AlertDescription.CertificateUnknown);
                }
            }

            var cipher     = (CipherSuiteCode)ssl.GetCipher();
            var protocol   = (TlsProtocolCode)ssl.GetVersion();
            var serverName = ssl.GetServerName();

            Debug("GET CONNECTION INFO: {0:x}:{0} {1:x}:{1} {2}", cipher, protocol, (TlsProtocolCode)protocol);

            connectionInfo = new MonoTlsConnectionInfo {
                CipherSuiteCode = cipher,
                ProtocolVersion = GetProtocol(protocol),
                PeerDomainName  = serverName
            };
        }