示例#1
0
        public static MonoNewTlsStream CreateServer(
            Stream innerStream, bool leaveOpen, RemoteCertificateValidationCallback certValidationCallback,
            LocalCertificateSelectionCallback certSelectionCallback, XEncryptionPolicy encryptionPolicy, TlsSettings settings,
            SSCX.X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
        {
            var stream = new MonoNewTlsStream(
                innerStream, leaveOpen,
                ConvertCallback(certValidationCallback),
                ConvertCallback(certSelectionCallback),
                (XEncryptionPolicy)encryptionPolicy,
                settings);

            try {
                stream.AuthenticateAsServer(serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
            } catch (Exception ex) {
                var tlsEx = stream.LastError;
                if (tlsEx != null)
                {
                    throw new AggregateException(ex, tlsEx);
                }
                throw;
            }

            return(stream);
        }
示例#2
0
 internal MonoNewTlsStream(Stream innerStream, bool leaveOpen, RemoteCertificateValidationCallback certValidationCallback,
                           LocalCertificateSelectionCallback certSelectionCallback, EncryptionPolicy encryptionPolicy, MonoTlsSettings settings)
     : base(innerStream, leaveOpen, certValidationCallback, certSelectionCallback, encryptionPolicy, settings)
 {
 }