Exemple #1
0
        internal void ValidateCreateContext(bool serverMode, string targetHost, SslProtocols enabledProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, bool clientCertRequired)
        {
            if (xobileTlsContext != null)
            {
                throw new InvalidOperationException();
            }

            if (serverMode)
            {
                if (serverCertificate == null)
                {
                    throw new ArgumentException("serverCertificate");
                }
            }
            else
            {
                if (targetHost == null)
                {
                    throw new ArgumentException("targetHost");
                }
                if (targetHost.Length == 0)
                {
                    targetHost = "?" + Interlocked.Increment(ref uniqueNameInteger).ToString(NumberFormatInfo.InvariantInfo);
                }
            }

            xobileTlsContext = new AppleTlsContext(this, Settings, Provider, serverMode, targetHost, enabledProtocols, serverCertificate, clientCertificates, clientCertRequired);
        }
Exemple #2
0
 protected override void Dispose(bool disposing)
 {
     try {
         lastException = new ObjectDisposedException("MobileAuthenticatedStream");
         lock (ioLock) {
             if (xobileTlsContext != null)
             {
                 xobileTlsContext.Dispose();
                 xobileTlsContext = null;
             }
         }
     } finally {
         base.Dispose(disposing);
     }
 }
Exemple #3
0
        AsyncOperationStatus ProcessClose(AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
        {
            Debug("ProcessClose: {0}", status);

            lock (ioLock) {
                if (xobileTlsContext == null)
                {
                    return(AsyncOperationStatus.Complete);
                }

                xobileTlsContext.Close();
                xobileTlsContext = null;
                return(AsyncOperationStatus.Continue);
            }
        }
Exemple #4
0
        AsyncOperationStatus ProcessClose(AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
        {
            Debug ("ProcessClose: {0}", status);

            lock (ioLock) {
                if (xobileTlsContext == null)
                    return AsyncOperationStatus.Complete;

                xobileTlsContext.Close ();
                xobileTlsContext = null;
                return AsyncOperationStatus.Continue;
            }
        }
Exemple #5
0
 protected override void Dispose(bool disposing)
 {
     try {
         lastException = new ObjectDisposedException ("MobileAuthenticatedStream");
         lock (ioLock) {
             if (xobileTlsContext != null) {
                 xobileTlsContext.Dispose ();
                 xobileTlsContext = null;
             }
         }
     } finally {
         base.Dispose (disposing);
     }
 }
Exemple #6
0
        internal void ValidateCreateContext(bool serverMode, string targetHost, SslProtocols enabledProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, bool clientCertRequired)
        {
            if (xobileTlsContext != null)
                throw new InvalidOperationException ();

            if (serverMode) {
                if (serverCertificate == null)
                    throw new ArgumentException ("serverCertificate");
            } else {
                if (targetHost == null)
                    throw new ArgumentException ("targetHost");
                if (targetHost.Length == 0)
                    targetHost = "?" + Interlocked.Increment (ref uniqueNameInteger).ToString (NumberFormatInfo.InvariantInfo);
            }

            xobileTlsContext = new AppleTlsContext (this, Settings, Provider, serverMode, targetHost, enabledProtocols, serverCertificate, clientCertificates, clientCertRequired);
        }