protected override void Dispose(bool disposing) { if (disposing) { if (null != _sslContext) { _sslContext.Dispose(); _sslContext = null !; } } base.Dispose(disposing); }
private static SafeSslHandle CreateSslContext(SafeFreeSslCredentials credential, bool isServer) { switch (credential.Policy) { case EncryptionPolicy.RequireEncryption: #pragma warning disable SYSLIB0040 // NoEncryption and AllowNoEncryption are obsolete case EncryptionPolicy.AllowNoEncryption: // SecureTransport doesn't allow TLS_NULL_NULL_WITH_NULL, but // since AllowNoEncryption intersect OS-supported isn't nothing, // let it pass. break; #pragma warning restore SYSLIB0040 default: throw new PlatformNotSupportedException(SR.Format(SR.net_encryptionpolicy_notsupported, credential.Policy)); } SafeSslHandle sslContext = Interop.AppleCrypto.SslCreateContext(isServer ? 1 : 0); try { if (sslContext.IsInvalid) { // This is as likely as anything. No error conditions are defined for // the OS function, and our shim only adds a NULL if isServer isn't a normalized bool. throw new OutOfMemoryException(); } // Let None mean "system default" if (credential.Protocols != SslProtocols.None) { SetProtocols(sslContext, credential.Protocols); } if (credential.CertificateContext != null) { SetCertificate(sslContext, credential.CertificateContext); } Interop.AppleCrypto.SslBreakOnCertRequested(sslContext, true); Interop.AppleCrypto.SslBreakOnServerAuth(sslContext, true); Interop.AppleCrypto.SslBreakOnClientAuth(sslContext, true); } catch { sslContext.Dispose(); throw; } return(sslContext); }
protected override void Dispose(bool disposing) { if (disposing) { SafeSslHandle sslContext = _sslContext; if (sslContext != null) { _inputBuffer.Dispose(); _outputBuffer.Dispose(); sslContext.Dispose(); } } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { if (null != _sslContext) { _sslContext.Dispose(); _sslContext = null; } _toConnection = null; _fromConnection = null; _writeCallback = null; _readCallback = null; } base.Dispose(disposing); }