Beispiel #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);
        }
		internal static MonoSslStream CreateSslStream (
			Stream innerStream, bool leaveInnerStreamOpen,
			MonoTlsProvider provider, MonoTlsSettings settings = null)
		{
			var stream = new MonoNewTlsStream (innerStream, leaveInnerStreamOpen, provider, settings);
			return new MonoSslStreamImpl (stream);
		}
Beispiel #3
0
		public MonoSslStream (MSI.MonoSslStream stream)
		{
			this.stream = stream;

			if (NewTlsProvider.IsNewTlsStream (stream))
				monoNewTlsStream = NewTlsProvider.GetNewTlsStream (stream);
		}
		internal static MonoSslStream CreateSslStream (
			Stream innerStream, bool leaveInnerStreamOpen,
			ICertificateValidator certificateValidator,
			MonoTlsSettings settings = null)
		{
			var stream = new MonoNewTlsStream (innerStream, leaveInnerStreamOpen, certificateValidator, settings);
			return new MonoSslStreamImpl (stream);
		}
Beispiel #5
0
        internal static MonoSslStream CreateSslStream(
            Stream innerStream, bool leaveInnerStreamOpen,
            MonoTlsProvider provider, MonoTlsSettings settings = null)
        {
            var stream = new MonoNewTlsStream(innerStream, leaveInnerStreamOpen, provider, settings);

            return(new MonoSslStreamImpl(stream));
        }
Beispiel #6
0
 protected override void Dispose(bool disposing)
 {
     if (impl != null && disposing)
     {
         impl.Dispose();
         impl = null;
     }
 }
		public static MonoNewTlsStream CreateClient (
			Stream innerStream, bool leaveOpen, ICertificateValidator certificateValidator, TlsSettings settings,
			string targetHost, PSSCX.X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
		{
			var stream = new MonoNewTlsStream (innerStream, leaveOpen, certificateValidator, settings);

			try {
				stream.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
			} catch (Exception ex) {
				var tlsEx = stream.LastError;
				if (tlsEx != null)
					throw new AggregateException (ex, tlsEx);
				throw;
			}
			return stream;
		}
Beispiel #8
0
        public static MonoNewTlsStream CreateClient(
            Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
            string targetHost, PSSCX.X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
        {
            var stream = new MonoNewTlsStream(innerStream, leaveOpen, provider, settings);

            try {
                stream.AuthenticateAsClient(targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
            } catch (Exception ex) {
                var tlsEx = stream.LastError;
                if (tlsEx != null)
                {
                    throw new AggregateException(ex, tlsEx);
                }
                throw;
            }
            return(stream);
        }
		public static MonoNewTlsStream CreateServer (
			Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
			SSCX.X509Certificate serverCertificate, bool clientCertificateRequired,
			SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
		{
			var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, 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;
		}
		public MonoSslStreamImpl (MonoNewTlsStream impl)
		{
			this.impl = impl;
		}
		protected override void Dispose (bool disposing)
		{
			if (impl != null && disposing) {
				impl.Dispose ();
				impl = null;
			}
		}
Beispiel #12
0
 public MonoSslStreamImpl(MonoNewTlsStream impl)
 {
     this.impl = impl;
 }