Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <mabaul@microsoft.com>2019-10-19 01:02:48 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2019-10-19 01:02:48 +0300
commitfffad7e3a8f57a7eaff67d43a3a29b7f64e94646 (patch)
treee9b222b63c2a16a6a6b22cb4b6b8a08c06c2c896 /mcs/class/System
parent8836231459121e0144ae03169554c1d0636ec5ba (diff)
Remove the Legacy TLS Provider. (#17391)
* `MonoTlsProviderFactory` now treats "legacy" as an alias for "default". * `Mono.Net.Security/LegacySslStream`: Removed. This class also wasn't using the `MobileAuthenticatedStream` base class, thus preventing cleanups simplifications in that area. * `Mono.Net.Security/LegacyTlsProvider`: Removed. * `Mono.Security/Mono.Security.Protocol.Tls*`: Removed all the old legacy code. * `Mono.Security.Interface.MonoTlsProviderFactory`: Bump internal version to 4.
Diffstat (limited to 'mcs/class/System')
-rw-r--r--mcs/class/System/Mono.Net.Security/LegacySslStream.cs645
-rw-r--r--mcs/class/System/Mono.Net.Security/LegacyTlsProvider.cs108
-rw-r--r--mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs57
-rw-r--r--mcs/class/System/Mono/SystemCertificateProvider.cs2
-rw-r--r--mcs/class/System/System.csproj32
-rw-r--r--mcs/class/System/Test/tools/README4
-rw-r--r--mcs/class/System/Test/tools/mutual/.gitattributes2
-rw-r--r--mcs/class/System/Test/tools/mutual/Makefile28
-rw-r--r--mcs/class/System/Test/tools/mutual/README3
-rw-r--r--mcs/class/System/Test/tools/mutual/ca.pem15
-rw-r--r--mcs/class/System/Test/tools/mutual/client.p12bin2156 -> 0 bytes
-rw-r--r--mcs/class/System/Test/tools/mutual/client.pem16
-rw-r--r--mcs/class/System/Test/tools/mutual/mutual.cs99
-rwxr-xr-xmcs/class/System/Test/tools/mutual/server.sh1
-rw-r--r--mcs/class/System/Test/tools/mutual/server_cert.pem66
-rw-r--r--mcs/class/System/Test/tools/mutual/server_key.pem15
-rwxr-xr-xmcs/class/System/Test/tools/mutual/serveropt.sh1
-rw-r--r--mcs/class/System/Test/tools/server/Makefile30
-rw-r--r--mcs/class/System/Test/tools/server/README3
-rw-r--r--mcs/class/System/Test/tools/server/msslserver.cs110
-rw-r--r--mcs/class/System/Test/tools/server/mutual.pem53
-rw-r--r--mcs/class/System/common_networking.sources2
22 files changed, 22 insertions, 1270 deletions
diff --git a/mcs/class/System/Mono.Net.Security/LegacySslStream.cs b/mcs/class/System/Mono.Net.Security/LegacySslStream.cs
deleted file mode 100644
index 1512306bcd5..00000000000
--- a/mcs/class/System/Mono.Net.Security/LegacySslStream.cs
+++ /dev/null
@@ -1,645 +0,0 @@
-//
-// System.Net.Security.SslStream.cs
-//
-// Authors:
-// Tim Coleman (tim@timcoleman.com)
-// Atsushi Enomoto (atsushi@ximian.com)
-// Marek Safar (marek.safar@gmail.com)
-//
-// Copyright (C) Tim Coleman, 2004
-// (c) 2004,2007 Novell, Inc. (http://www.novell.com)
-// Copyright 2011 Xamarin Inc.
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if SECURITY_DEP
-
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-#endif
-
-#if MONO_SECURITY_ALIAS
-using MonoCipherAlgorithmType = MonoSecurity::Mono.Security.Protocol.Tls.CipherAlgorithmType;
-using MonoHashAlgorithmType = MonoSecurity::Mono.Security.Protocol.Tls.HashAlgorithmType;
-using MonoExchangeAlgorithmType = MonoSecurity::Mono.Security.Protocol.Tls.ExchangeAlgorithmType;
-using MonoSecurityProtocolType = MonoSecurity::Mono.Security.Protocol.Tls.SecurityProtocolType;
-using MonoSecurity::Mono.Security.Protocol.Tls;
-using MonoSecurity::Mono.Security.Interface;
-#else
-using MonoCipherAlgorithmType = Mono.Security.Protocol.Tls.CipherAlgorithmType;
-using MonoHashAlgorithmType = Mono.Security.Protocol.Tls.HashAlgorithmType;
-using MonoExchangeAlgorithmType = Mono.Security.Protocol.Tls.ExchangeAlgorithmType;
-using MonoSecurityProtocolType = Mono.Security.Protocol.Tls.SecurityProtocolType;
-using Mono.Security.Protocol.Tls;
-using Mono.Security.Interface;
-#endif
-
-using CipherAlgorithmType = System.Security.Authentication.CipherAlgorithmType;
-using HashAlgorithmType = System.Security.Authentication.HashAlgorithmType;
-using ExchangeAlgorithmType = System.Security.Authentication.ExchangeAlgorithmType;
-
-using System;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Principal;
-using System.Security.Cryptography;
-
-namespace Mono.Net.Security.Private
-{
- /*
- * Strictly private - do not use outside the Mono.Net.Security directory.
- */
- [MonoTODO ("Non-X509Certificate2 certificate is not supported")]
- internal class LegacySslStream : AuthenticatedStream, IMonoSslStream
- {
- #region Fields
-
- SslStreamBase ssl_stream;
- ICertificateValidator certificateValidator;
-
- #endregion // Fields
-
- #region Constructors
-
- public LegacySslStream (Stream innerStream, bool leaveInnerStreamOpen, SslStream owner, MonoTlsProvider provider, MonoTlsSettings settings)
- : base (innerStream, leaveInnerStreamOpen)
- {
- SslStream = owner;
- Provider = provider;
- certificateValidator = ChainValidationHelper.GetInternalValidator (owner, provider, settings);
- }
- #endregion // Constructors
-
- #region Properties
-
- public override bool CanRead {
- get { return InnerStream.CanRead; }
- }
-
- public override bool CanSeek {
- get { return InnerStream.CanSeek; }
- }
-
- public override bool CanTimeout {
- get { return InnerStream.CanTimeout; }
- }
-
- public override bool CanWrite {
- get { return InnerStream.CanWrite; }
- }
-
- public override long Length {
- get { return InnerStream.Length; }
- }
-
- public override long Position {
- get { return InnerStream.Position; }
- set {
- throw new NotSupportedException ("This stream does not support seek operations");
- }
- }
-
- // AuthenticatedStream overrides
-
- public override bool IsAuthenticated {
- get { return ssl_stream != null; }
- }
-
- public override bool IsEncrypted {
- get { return IsAuthenticated; }
- }
-
- public override bool IsMutuallyAuthenticated {
- get { return IsAuthenticated && (IsServer ? RemoteCertificate != null : LocalCertificate != null); }
- }
-
- public override bool IsServer {
- get { return ssl_stream is SslServerStream; }
- }
-
- public override bool IsSigned {
- get { return IsAuthenticated; }
- }
-
- public override int ReadTimeout {
- get { return InnerStream.ReadTimeout; }
- set { InnerStream.ReadTimeout = value; }
- }
-
- public override int WriteTimeout {
- get { return InnerStream.WriteTimeout; }
- set { InnerStream.WriteTimeout = value; }
- }
-
- // SslStream
-
- public virtual bool CheckCertRevocationStatus {
- get {
- if (!IsAuthenticated)
- return false;
-
- return ssl_stream.CheckCertRevocationStatus;
- }
- }
-
- public virtual CipherAlgorithmType CipherAlgorithm {
- get {
- CheckConnectionAuthenticated ();
-
- switch (ssl_stream.CipherAlgorithm) {
- case MonoCipherAlgorithmType.Des:
- return CipherAlgorithmType.Des;
- case MonoCipherAlgorithmType.None:
- return CipherAlgorithmType.None;
- case MonoCipherAlgorithmType.Rc2:
- return CipherAlgorithmType.Rc2;
- case MonoCipherAlgorithmType.Rc4:
- return CipherAlgorithmType.Rc4;
- case MonoCipherAlgorithmType.SkipJack:
- break;
- case MonoCipherAlgorithmType.TripleDes:
- return CipherAlgorithmType.TripleDes;
- case MonoCipherAlgorithmType.Rijndael:
- switch (ssl_stream.CipherStrength) {
- case 128:
- return CipherAlgorithmType.Aes128;
- case 192:
- return CipherAlgorithmType.Aes192;
- case 256:
- return CipherAlgorithmType.Aes256;
- }
- break;
- }
-
- throw new InvalidOperationException ("Not supported cipher algorithm is in use. It is likely a bug in SslStream.");
- }
- }
-
- public virtual int CipherStrength {
- get {
- CheckConnectionAuthenticated ();
-
- return ssl_stream.CipherStrength;
- }
- }
-
- public virtual HashAlgorithmType HashAlgorithm {
- get {
- CheckConnectionAuthenticated ();
-
- switch (ssl_stream.HashAlgorithm) {
- case MonoHashAlgorithmType.Md5:
- return HashAlgorithmType.Md5;
- case MonoHashAlgorithmType.None:
- return HashAlgorithmType.None;
- case MonoHashAlgorithmType.Sha1:
- return HashAlgorithmType.Sha1;
- }
-
- throw new InvalidOperationException ("Not supported hash algorithm is in use. It is likely a bug in SslStream.");
- }
- }
-
- public virtual int HashStrength {
- get {
- CheckConnectionAuthenticated ();
-
- return ssl_stream.HashStrength;
- }
- }
-
- public virtual ExchangeAlgorithmType KeyExchangeAlgorithm {
- get {
- CheckConnectionAuthenticated ();
-
- switch (ssl_stream.KeyExchangeAlgorithm) {
- case MonoExchangeAlgorithmType.DiffieHellman:
- return ExchangeAlgorithmType.DiffieHellman;
- case MonoExchangeAlgorithmType.Fortezza:
- break;
- case MonoExchangeAlgorithmType.None:
- return ExchangeAlgorithmType.None;
- case MonoExchangeAlgorithmType.RsaKeyX:
- return ExchangeAlgorithmType.RsaKeyX;
- case MonoExchangeAlgorithmType.RsaSign:
- return ExchangeAlgorithmType.RsaSign;
- }
-
- throw new InvalidOperationException ("Not supported exchange algorithm is in use. It is likely a bug in SslStream.");
- }
- }
-
- public virtual int KeyExchangeStrength {
- get {
- CheckConnectionAuthenticated ();
-
- return ssl_stream.KeyExchangeStrength;
- }
- }
-
- X509Certificate IMonoSslStream.InternalLocalCertificate {
- get {
- return IsServer ? ssl_stream.ServerCertificate : ((SslClientStream) ssl_stream).SelectedClientCertificate;
- }
- }
-
- public virtual X509Certificate LocalCertificate {
- get {
- CheckConnectionAuthenticated ();
-
- return IsServer ? ssl_stream.ServerCertificate : ((SslClientStream) ssl_stream).SelectedClientCertificate;
- }
- }
-
- public virtual X509Certificate RemoteCertificate {
- get {
- CheckConnectionAuthenticated ();
- return !IsServer ? ssl_stream.ServerCertificate : ((SslServerStream) ssl_stream).ClientCertificate;
- }
- }
-
- public virtual SslProtocols SslProtocol {
- get {
- CheckConnectionAuthenticated ();
-
- switch (ssl_stream.SecurityProtocol) {
- case MonoSecurityProtocolType.Default:
- return SslProtocols.Default;
- case MonoSecurityProtocolType.Ssl2:
- return SslProtocols.Ssl2;
- case MonoSecurityProtocolType.Ssl3:
- return SslProtocols.Ssl3;
- case MonoSecurityProtocolType.Tls:
- return SslProtocols.Tls;
- }
-
- throw new InvalidOperationException ("Not supported SSL/TLS protocol is in use. It is likely a bug in SslStream.");
- }
- }
-
- #endregion // Properties
-
- #region Methods
-
-/*
- AsymmetricAlgorithm GetPrivateKey (X509Certificate cert, string targetHost)
- {
- // FIXME: what can I do for non-X509Certificate2 ?
- X509Certificate2 cert2 = cert as X509Certificate2;
- return cert2 != null ? cert2.PrivateKey : null;
- }
-*/
- X509Certificate OnCertificateSelection (X509CertificateCollection clientCerts, X509Certificate serverCert, string targetHost, X509CertificateCollection serverRequestedCerts)
- {
-#pragma warning disable 618
- string [] acceptableIssuers = new string [serverRequestedCerts != null ? serverRequestedCerts.Count : 0];
- for (int i = 0; i < acceptableIssuers.Length; i++)
- acceptableIssuers [i] = serverRequestedCerts [i].GetIssuerName ();
- X509Certificate clientCertificate;
- certificateValidator.SelectClientCertificate (targetHost, clientCerts, serverCert, acceptableIssuers, out clientCertificate);
- return clientCertificate;
-#pragma warning restore 618
- }
-
- public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
- {
- return BeginAuthenticateAsClient (targetHost, new X509CertificateCollection (), SslProtocols.Tls, false, asyncCallback, asyncState);
- }
-
- public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
- {
- return BeginAuthenticateAsClient (targetHost, clientCertificates, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation, asyncCallback, asyncState);
- }
-
- public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
- {
- if (IsAuthenticated)
- throw new InvalidOperationException ("This SslStream is already authenticated");
-
- SslClientStream s = new SslClientStream (InnerStream, targetHost, !LeaveInnerStreamOpen, GetMonoSslProtocol (enabledSslProtocols), clientCertificates);
- s.CheckCertRevocationStatus = checkCertificateRevocation;
-
- // Due to the Mono.Security internal, it cannot reuse
- // the delegated argument, as Mono.Security creates
- // another instance of X509Certificate which lacks
- // private key but is filled the private key via this
- // delegate.
- s.PrivateKeyCertSelectionDelegate = delegate (X509Certificate cert, string host) {
- string hash = cert.GetCertHashString ();
- // ... so, we cannot use the delegate argument.
- foreach (X509Certificate cc in clientCertificates) {
- if (cc.GetCertHashString () != hash)
- continue;
- X509Certificate2 cert2 = cc as X509Certificate2;
- cert2 = cert2 ?? new X509Certificate2 (cc);
- return cert2.PrivateKey;
- }
- return null;
- };
-
- // Even if validation_callback is null this allows us to verify requests where the user
- // does not provide a verification callback but attempts to authenticate with the website
- // as a client (see https://bugzilla.xamarin.com/show_bug.cgi?id=18962 for an example)
- s.ServerCertValidation2 += (mcerts) => {
- X509CertificateCollection certs = null;
- if (mcerts != null) {
- certs = new X509CertificateCollection ();
- for (int i = 0; i < mcerts.Count; i++)
- certs.Add (new X509Certificate2 (mcerts [i].RawData));
- }
- return ((ChainValidationHelper)certificateValidator).ValidateCertificate (targetHost, false, certs);
- };
- s.ClientCertSelectionDelegate = OnCertificateSelection;
-
- ssl_stream = s;
-
- return BeginWrite (new byte [0], 0, 0, asyncCallback, asyncState);
- }
-
- public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
- {
- CheckConnectionAuthenticated ();
-
- return ssl_stream.BeginRead (buffer, offset, count, asyncCallback, asyncState);
- }
-
- public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
- {
- return BeginAuthenticateAsServer (serverCertificate, false, SslProtocols.Tls, false, asyncCallback, asyncState);
- }
-
- public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
- {
- return BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation, asyncCallback, asyncState);
- }
-
- public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
- {
- if (IsAuthenticated)
- throw new InvalidOperationException ("This SslStream is already authenticated");
-
- SslServerStream s = new SslServerStream (InnerStream, serverCertificate, false, clientCertificateRequired, !LeaveInnerStreamOpen, GetMonoSslProtocol (enabledSslProtocols));
- s.CheckCertRevocationStatus = checkCertificateRevocation;
- // Due to the Mono.Security internal, it cannot reuse
- // the delegated argument, as Mono.Security creates
- // another instance of X509Certificate which lacks
- // private key but is filled the private key via this
- // delegate.
- s.PrivateKeyCertSelectionDelegate = delegate (X509Certificate cert, string targetHost) {
- // ... so, we cannot use the delegate argument.
- X509Certificate2 cert2 = serverCertificate as X509Certificate2 ?? new X509Certificate2 (serverCertificate);
- return cert2 != null ? cert2.PrivateKey : null;
- };
-
- s.ClientCertValidationDelegate = delegate (X509Certificate cert, int[] certErrors) {
- var errors = certErrors.Length > 0 ? MonoSslPolicyErrors.RemoteCertificateChainErrors : MonoSslPolicyErrors.None;
- return ((ChainValidationHelper)certificateValidator).ValidateClientCertificate (cert, errors);
- };
-
- ssl_stream = s;
-
- return BeginWrite (new byte[0], 0, 0, asyncCallback, asyncState);
- }
-
- MonoSecurityProtocolType GetMonoSslProtocol (SslProtocols ms)
- {
- switch (ms) {
- case SslProtocols.Ssl2:
- return MonoSecurityProtocolType.Ssl2;
- case SslProtocols.Ssl3:
- return MonoSecurityProtocolType.Ssl3;
- case SslProtocols.Tls:
- return MonoSecurityProtocolType.Tls;
- default:
- return MonoSecurityProtocolType.Default;
- }
- }
-
- public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
- {
- CheckConnectionAuthenticated ();
-
- return ssl_stream.BeginWrite (buffer, offset, count, asyncCallback, asyncState);
- }
-
- public virtual void AuthenticateAsClient (string targetHost)
- {
- AuthenticateAsClient (targetHost, new X509CertificateCollection (), SslProtocols.Tls, false);
- }
-
- public virtual void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, bool checkCertificateRevocation)
- {
- AuthenticateAsClient (targetHost, clientCertificates, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation);
- }
-
- public virtual void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
- {
- EndAuthenticateAsClient (BeginAuthenticateAsClient (
- targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, null, null));
- }
-
- public virtual void AuthenticateAsServer (X509Certificate serverCertificate)
- {
- AuthenticateAsServer (serverCertificate, false, SslProtocols.Tls, false);
- }
-
- public virtual void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation)
- {
- AuthenticateAsServer (serverCertificate, clientCertificateRequired, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation);
- }
-
- public virtual void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
- {
- EndAuthenticateAsServer (BeginAuthenticateAsServer (
- serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, null, null));
- }
-
- protected override void Dispose (bool disposing)
- {
- if (disposing) {
- if (ssl_stream != null)
- ssl_stream.Dispose ();
- ssl_stream = null;
- }
- base.Dispose (disposing);
- }
-
- public virtual void EndAuthenticateAsClient (IAsyncResult asyncResult)
- {
- CheckConnectionAuthenticated ();
-
- if (CanRead)
- ssl_stream.EndRead (asyncResult);
- else
- ssl_stream.EndWrite (asyncResult);
- }
-
- public virtual void EndAuthenticateAsServer (IAsyncResult asyncResult)
- {
- CheckConnectionAuthenticated ();
-
- if (CanRead)
- ssl_stream.EndRead (asyncResult);
- else
- ssl_stream.EndWrite (asyncResult);
- }
-
- public override int EndRead (IAsyncResult asyncResult)
- {
- CheckConnectionAuthenticated ();
-
- return ssl_stream.EndRead (asyncResult);
- }
-
- public override void EndWrite (IAsyncResult asyncResult)
- {
- CheckConnectionAuthenticated ();
-
- ssl_stream.EndWrite (asyncResult);
- }
-
- public override void Flush ()
- {
- CheckConnectionAuthenticated ();
-
- InnerStream.Flush ();
- }
-
- public override int Read (byte[] buffer, int offset, int count)
- {
- return EndRead (BeginRead (buffer, offset, count, null, null));
- }
-
- public override long Seek (long offset, SeekOrigin origin)
- {
- throw new NotSupportedException ("This stream does not support seek operations");
- }
-
- public override void SetLength (long value)
- {
- InnerStream.SetLength (value);
- }
-
- public override void Write (byte[] buffer, int offset, int count)
- {
- EndWrite (BeginWrite (buffer, offset, count, null, null));
- }
-
- public void Write (byte[] buffer)
- {
- Write (buffer, 0, buffer.Length);
- }
-
- void CheckConnectionAuthenticated ()
- {
- if (!IsAuthenticated)
- throw new InvalidOperationException ("This operation is invalid until it is successfully authenticated");
- }
-
- public virtual Task AuthenticateAsClientAsync (string targetHost)
- {
- return Task.Factory.FromAsync (BeginAuthenticateAsClient, EndAuthenticateAsClient, targetHost, null);
- }
-
- public virtual Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, bool checkCertificateRevocation)
- {
- return AuthenticateAsClientAsync (targetHost, clientCertificates, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation);
- }
-
- public virtual Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
- {
- var t = Tuple.Create (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, this);
-
- return Task.Factory.FromAsync ((callback, state) => {
- var d = (Tuple<string, X509CertificateCollection, SslProtocols, bool, LegacySslStream>) state;
- return d.Item5.BeginAuthenticateAsClient (d.Item1, d.Item2, d.Item3, d.Item4, callback, null);
- }, EndAuthenticateAsClient, t);
- }
-
- public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
- {
- return Task.Factory.FromAsync (BeginAuthenticateAsServer, EndAuthenticateAsServer, serverCertificate, null);
- }
-
- public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation)
- {
- return AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation);
- }
-
- public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
- {
- var t = Tuple.Create (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, this);
-
- return Task.Factory.FromAsync ((callback, state) => {
- var d = (Tuple<X509Certificate, bool, SslProtocols, bool, LegacySslStream>) state;
- return d.Item5.BeginAuthenticateAsServer (d.Item1, d.Item2, d.Item3, d.Item4, callback, null);
- }, EndAuthenticateAsServer, t);
- }
-
- #endregion // Methods
-
- #region IMonoSslStream
-
- Task IMonoSslStream.ShutdownAsync ()
- {
- return Task.CompletedTask;
- }
-
- AuthenticatedStream IMonoSslStream.AuthenticatedStream {
- get { return this; }
- }
-
- TransportContext IMonoSslStream.TransportContext {
- get { throw new NotSupportedException (); }
- }
-
- public SslStream SslStream {
- get;
- }
-
- public MonoTlsProvider Provider {
- get;
- }
-
- public MonoTlsConnectionInfo GetConnectionInfo ()
- {
- return null;
- }
-
- public bool CanRenegotiate => false;
-
- public Task RenegotiateAsync (CancellationToken cancellationToken)
- {
- throw new NotSupportedException ();
- }
-
- #endregion
- }
-}
-
-#endif
diff --git a/mcs/class/System/Mono.Net.Security/LegacyTlsProvider.cs b/mcs/class/System/Mono.Net.Security/LegacyTlsProvider.cs
deleted file mode 100644
index d5d66c2f5ee..00000000000
--- a/mcs/class/System/Mono.Net.Security/LegacyTlsProvider.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-// LegacyTlsProvider.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-#if SECURITY_DEP
-#if MONO_SECURITY_ALIAS
-extern alias MonoSecurity;
-#endif
-
-#if MONO_SECURITY_ALIAS
-using MSI = MonoSecurity::Mono.Security.Interface;
-#else
-using MSI = Mono.Security.Interface;
-#endif
-
-using System;
-using System.IO;
-using System.Net;
-using System.Net.Security;
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Authentication;
-
-namespace Mono.Net.Security
-{
- /*
- * Strictly private - do not use outside the Mono.Net.Security directory.
- */
- class LegacyTlsProvider : MSI.MonoTlsProvider
- {
- public override Guid ID {
- get { return MonoTlsProviderFactory.LegacyId; }
- }
-
- public override string Name {
- get { return "legacy"; }
- }
-
- public override bool SupportsSslStream {
- get { return true; }
- }
-
- public override bool SupportsConnectionInfo {
- get { return false; }
- }
-
- public override bool SupportsMonoExtensions {
- get { return false; }
- }
-
- internal override bool SupportsCleanShutdown {
- get { return false; }
- }
-
- public override SslProtocols SupportedProtocols {
- get { return SslProtocols.Tls; }
- }
-
- public override MSI.IMonoSslStream CreateSslStream (
- Stream innerStream, bool leaveInnerStreamOpen,
- MSI.MonoTlsSettings settings = null)
- {
- return SslStream.CreateMonoSslStream (innerStream, leaveInnerStreamOpen, this, settings);
- }
-
- internal override MSI.IMonoSslStream CreateSslStreamInternal (
- SslStream sslStream, Stream innerStream, bool leaveInnerStreamOpen,
- MSI.MonoTlsSettings settings)
- {
- return new Private.LegacySslStream (innerStream, leaveInnerStreamOpen, sslStream, this, settings);
- }
-
- internal override bool ValidateCertificate (
- MSI.ICertificateValidator2 validator, string targetHost, bool serverMode,
- X509CertificateCollection certificates, bool wantsChain, ref X509Chain chain,
- ref MSI.MonoSslPolicyErrors errors, ref int status11)
- {
- if (wantsChain)
- chain = SystemCertificateValidator.CreateX509Chain (certificates);
- var xerrors = (SslPolicyErrors)errors;
- var result = SystemCertificateValidator.Evaluate (validator.Settings, targetHost, certificates, chain, ref xerrors, ref status11);
- errors = (MSI.MonoSslPolicyErrors)xerrors;
- return result;
- }
- }
-}
-#endif
-
diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs
index c38752e060b..dd4a009a653 100644
--- a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs
+++ b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs
@@ -214,7 +214,6 @@ namespace Mono.Net.Security
internal static readonly Guid AppleTlsId = new Guid ("981af8af-a3a3-419a-9f01-a518e3a17c1c");
internal static readonly Guid BtlsId = new Guid ("432d18c9-9348-4b90-bfbf-9f2a10e1f15b");
- internal static readonly Guid LegacyId = new Guid ("809e77d5-56cc-4da8-b9f0-45e65ba9cceb");
static void InitializeProviderRegistration ()
{
@@ -238,34 +237,31 @@ namespace Mono.Net.Security
var appleTlsEntry = new Tuple<Guid,String> (AppleTlsId, typeof (Mono.AppleTls.AppleTlsProvider).FullName);
providerRegistration.Add ("default", appleTlsEntry);
+ providerRegistration.Add ("legacy", appleTlsEntry);
providerRegistration.Add ("apple", appleTlsEntry);
}
#elif MONODROID
// TODO: Should be redundant
static void PopulateProviders ()
{
- var legacyEntry = new Tuple<Guid,String> (LegacyId, typeof (Mono.Net.Security.LegacyTlsProvider).FullName);
-
- providerRegistration.Add ("legacy", legacyEntry);
-
- #if MONO_FEATURE_BTLS
+#if MONO_FEATURE_BTLS
var btlsEntry = new Tuple<Guid,String> (BtlsId, typeof (Mono.Btls.MonoBtlsProvider).FullName);
- if (btlsEntry != null)
- providerRegistration.Add ("default", btlsEntry);
- else
- #endif
- providerRegistration.Add ("default", legacyEntry);
+ providerRegistration.Add ("default", btlsEntry);
+ providerRegistration.Add ("legacy", btlsEntry);
+ providerRegistration.Add ("btls", btlsEntry);
+#endif
}
#else
static void PopulateProviders ()
{
+ Tuple<Guid,String> appleTlsEntry = null;
+ Tuple<Guid,String> btlsEntry = null;
+
#if MONO_FEATURE_APPLETLS
- var appleTlsEntry = new Tuple<Guid,String> (AppleTlsId, typeof (Mono.AppleTls.AppleTlsProvider).FullName);
+ appleTlsEntry = new Tuple<Guid,String> (AppleTlsId, typeof (Mono.AppleTls.AppleTlsProvider).FullName);
+ providerRegistration.Add ("apple", appleTlsEntry);
#endif
- var legacyEntry = new Tuple<Guid,String> (LegacyId, typeof (Mono.Net.Security.LegacyTlsProvider).FullName);
- providerRegistration.Add ("legacy", legacyEntry);
- Tuple<Guid,String> btlsEntry = null;
#if MONO_FEATURE_BTLS
if (IsBtlsSupported ()) {
btlsEntry = new Tuple<Guid,String> (BtlsId, typeof (Mono.Btls.MonoBtlsProvider).FullName);
@@ -273,21 +269,11 @@ namespace Mono.Net.Security
}
#endif
-#if MONO_FEATURE_APPLETLS
- if (Platform.IsMacOS)
- providerRegistration.Add ("default", appleTlsEntry);
- else
-#endif
-#if MONO_FEATURE_BTLS
- if (btlsEntry != null)
- providerRegistration.Add ("default", btlsEntry);
- else
-#endif
- providerRegistration.Add ("default", legacyEntry);
-
-#if MONO_FEATURE_APPLETLS
- providerRegistration.Add ("apple", appleTlsEntry);
-#endif
+ var defaultEntry = appleTlsEntry ?? btlsEntry;
+ if (defaultEntry != null) {
+ providerRegistration.Add ("default", defaultEntry);
+ providerRegistration.Add ("legacy", defaultEntry);
+ }
}
#endif
@@ -300,21 +286,19 @@ namespace Mono.Net.Security
static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
{
#if MONODROID
- MSI.MonoTlsProvider provider = null;
var type = Environment.GetEnvironmentVariable ("XA_TLS_PROVIDER");
switch (type) {
+#if MONO_FEATURE_BTLS
case null:
case "default":
case "legacy":
- return new LegacyTlsProvider ();
-#if MONO_FEATURE_BTLS
case "btls":
if (!IsBtlsSupported ())
throw new NotSupportedException ("BTLS in not supported!");
return new MonoBtlsProvider ();
#endif
default:
- throw new NotSupportedException (string.Format ("Invalid TLS Provider: `{0}'.", provider));
+ throw new NotSupportedException ($"Invalid TLS Provider: `{type}'.");
}
#elif ONLY_APPLETLS || MONOTOUCH || XAMMAC
@@ -326,6 +310,7 @@ namespace Mono.Net.Security
switch (type) {
case "default":
+ case "legacy":
#if MONO_FEATURE_APPLETLS
if (Platform.IsMacOS)
goto case "apple";
@@ -334,7 +319,7 @@ namespace Mono.Net.Security
if (IsBtlsSupported ())
goto case "btls";
#endif
- goto case "legacy";
+ throw new NotSupportedException ("TLS Support not available.");
#if MONO_FEATURE_APPLETLS
case "apple":
return new AppleTlsProvider ();
@@ -343,8 +328,6 @@ namespace Mono.Net.Security
case "btls":
return new MonoBtlsProvider ();
#endif
- case "legacy":
- return new Mono.Net.Security.LegacyTlsProvider ();
}
return LookupProvider (type, true);
diff --git a/mcs/class/System/Mono/SystemCertificateProvider.cs b/mcs/class/System/Mono/SystemCertificateProvider.cs
index e63b22d6293..fe40196e283 100644
--- a/mcs/class/System/Mono/SystemCertificateProvider.cs
+++ b/mcs/class/System/Mono/SystemCertificateProvider.cs
@@ -89,7 +89,7 @@ namespace Mono
return;
#if MONO_FEATURE_BTLS || MONO_FEATURE_APPLETLS
- provider = MonoTlsProviderFactory.GetProvider ();
+ provider = MonoTlsProviderFactory.GetProvider ();
#endif
x509pal = GetX509Pal ();
}
diff --git a/mcs/class/System/System.csproj b/mcs/class/System/System.csproj
index 1375257ac9c..f66531b1a64 100644
--- a/mcs/class/System/System.csproj
+++ b/mcs/class/System/System.csproj
@@ -112,7 +112,7 @@
<PropertyGroup Condition=" '$(Platform)' == 'wasm' ">
<OutputPath>./../../class/lib/wasm</OutputPath>
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-wasm</IntermediateOutputPath>
- <DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;WASM;DISABLE_COM;FEATURE_NO_BSD_SOCKETS;DISABLE_REMOTING;DISABLE_SECURITY;COREFX;CONFIGURATION_2_0;SYSTEM_NET_PRIMITIVES_DLL;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_SECURITY_ALIAS;MONO_FEATURE_BTLS</DefineConstants>
+ <DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;WASM;DISABLE_COM;FEATURE_NO_BSD_SOCKETS;DISABLE_REMOTING;DISABLE_SECURITY;COREFX;CONFIGURATION_2_0;SYSTEM_NET_PRIMITIVES_DLL;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_SECURITY_ALIAS</DefineConstants>
</PropertyGroup>
<!-- @ALL_PROFILE_PROPERTIES@ -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
@@ -1086,8 +1086,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -1227,8 +1225,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -1323,8 +1319,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -1454,8 +1448,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -1580,8 +1572,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -1905,8 +1895,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -2379,8 +2367,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -2893,8 +2879,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -3395,8 +3379,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -3833,8 +3815,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -3972,8 +3952,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -4127,8 +4105,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -4249,8 +4225,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -4392,8 +4366,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
@@ -4535,8 +4507,6 @@
<Compile Include="Mono.Net.Security\AsyncProtocolRequest.cs" />
<Compile Include="Mono.Net.Security\CallbackHelpers.cs" />
<Compile Include="Mono.Net.Security\ChainValidationHelper.cs" />
- <Compile Include="Mono.Net.Security\LegacySslStream.cs" />
- <Compile Include="Mono.Net.Security\LegacyTlsProvider.cs" />
<Compile Include="Mono.Net.Security\MobileAuthenticatedStream.cs" />
<Compile Include="Mono.Net.Security\MobileTlsContext.cs" />
<Compile Include="Mono.Net.Security\MonoSslAuthenticationOptions.cs" />
diff --git a/mcs/class/System/Test/tools/README b/mcs/class/System/Test/tools/README
deleted file mode 100644
index 941c357724e..00000000000
--- a/mcs/class/System/Test/tools/README
+++ /dev/null
@@ -1,4 +0,0 @@
-These samples are port of Mono.Security test tools for
-System.Net.Security.SslStream.
-
-Atsushi Eno
diff --git a/mcs/class/System/Test/tools/mutual/.gitattributes b/mcs/class/System/Test/tools/mutual/.gitattributes
deleted file mode 100644
index 958b70946af..00000000000
--- a/mcs/class/System/Test/tools/mutual/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-/ca.pem -crlf
-/client.pem -crlf
diff --git a/mcs/class/System/Test/tools/mutual/Makefile b/mcs/class/System/Test/tools/mutual/Makefile
deleted file mode 100644
index dcea4bd4fb2..00000000000
--- a/mcs/class/System/Test/tools/mutual/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-thisdir = class/Mono.Security/Test/tools/mutual
-SUBDIRS =
-include ../../../../../build/rules.make
-
-LOCAL_MCS_FLAGS = /r:System.dll /r:Mono.Security.dll
-
-all-local install-local uninstall-local:
-
-test-local:
-
-# ??? What do we run here?
-
-run-test-local:
-
-clean-local:
- rm -f *.exe *.pdb *.mdb
-
-sources = mutual.cs
-
-DISTFILES = $(sources) ca.pem client.p12 client.pem server_cert.pem \
- server_key.pem server.sh README
-
-dist-local: dist-default
-
-all: mutual.exe
-
-mutual.exe: mutual.cs
- $(CSCOMPILE) /target:exe /out:$@ $^
diff --git a/mcs/class/System/Test/tools/mutual/README b/mcs/class/System/Test/tools/mutual/README
deleted file mode 100644
index f929403c361..00000000000
--- a/mcs/class/System/Test/tools/mutual/README
+++ /dev/null
@@ -1,3 +0,0 @@
-This is a ported version of sample tool from Mono.Security.
-See mcs/class/Mono.Security/Test/tools/mutual/README.
-
diff --git a/mcs/class/System/Test/tools/mutual/ca.pem b/mcs/class/System/Test/tools/mutual/ca.pem
deleted file mode 100644
index c837dce7f9c..00000000000
--- a/mcs/class/System/Test/tools/mutual/ca.pem
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICXjCCAgigAwIBAgIBADANBgkqhkiG9w0BAQQFADBbMRAwDgYDVQQKEwdNaWRk
-c29sMRAwDgYDVQQHEwdIYW1idXJnMRAwDgYDVQQIEwdHZXJtYW55MQswCQYDVQQG
-EwJERTEWMBQGA1UEAxMNTWlkZHNvbERlbW9DQTAeFw0wNDA4MjUxNTAyNDdaFw0x
-NDA4MjgxNTAyNDdaMFsxEDAOBgNVBAoTB01pZGRzb2wxEDAOBgNVBAcTB0hhbWJ1
-cmcxEDAOBgNVBAgTB0dlcm1hbnkxCzAJBgNVBAYTAkRFMRYwFAYDVQQDEw1NaWRk
-c29sRGVtb0NBMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJMY+RSPiP9KpxznPE0S
-PGHhStc25y1CDHGdR33T1PCg3cD+XX5nLDTn83Jb3KU1j/Nh5sDi7RLflrSo8oXz
-OAkCAwEAAaOBtjCBszAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBTSHOgWrKCgE3Bg
-SksGSZdJjL6pLTCBgwYDVR0jBHwweoAU0hzoFqygoBNwYEpLBkmXSYy+qS2hX6Rd
-MFsxEDAOBgNVBAoTB01pZGRzb2wxEDAOBgNVBAcTB0hhbWJ1cmcxEDAOBgNVBAgT
-B0dlcm1hbnkxCzAJBgNVBAYTAkRFMRYwFAYDVQQDEw1NaWRkc29sRGVtb0NBggEA
-MA0GCSqGSIb3DQEBBAUAA0EAHYPXGT8tDS0LyFIAor8PZ3zP+MxIHm9p87IarsFI
-elsb1+JaFNVYb3Mzh+dXY93NrTsxIjgbi8ld8X0w4KElHA==
------END CERTIFICATE-----
diff --git a/mcs/class/System/Test/tools/mutual/client.p12 b/mcs/class/System/Test/tools/mutual/client.p12
deleted file mode 100644
index f7f220e4c3a..00000000000
--- a/mcs/class/System/Test/tools/mutual/client.p12
+++ /dev/null
Binary files differ
diff --git a/mcs/class/System/Test/tools/mutual/client.pem b/mcs/class/System/Test/tools/mutual/client.pem
deleted file mode 100644
index 53c60af5f1c..00000000000
--- a/mcs/class/System/Test/tools/mutual/client.pem
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICejCCAiSgAwIBAgIBATANBgkqhkiG9w0BAQQFADBbMRAwDgYDVQQKEwdNaWRk
-c29sMRAwDgYDVQQHEwdIYW1idXJnMRAwDgYDVQQIEwdHZXJtYW55MQswCQYDVQQG
-EwJERTEWMBQGA1UEAxMNTWlkZHNvbERlbW9DQTAeFw0wNDA4MjUxNTAzMTlaFw0x
-NDA4MjMxNTAzMTlaMEsxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdHZXJtYW55MRAw
-DgYDVQQKEwdNaWRkc29sMRgwFgYDVQQDEw9NaWRkc29sRGVtb0NlcnQwXDANBgkq
-hkiG9w0BAQEFAANLADBIAkEApnQapV0DtGUrE1Z0Jn3DCdXL43f8qbvUunlKhq2P
-8errH5r4dl4ZVjod43KZV5yp0TKNQOvVRWEucNVMwCcs1wIDAQABo4HiMIHfMAwG
-A1UdEwQFMAMBAf8wHQYDVR0OBBYEFACmgZvTLGm1MEwTJM2U1aaNLVpYMIGDBgNV
-HSMEfDB6gBTSHOgWrKCgE3BgSksGSZdJjL6pLaFfpF0wWzEQMA4GA1UEChMHTWlk
-ZHNvbDEQMA4GA1UEBxMHSGFtYnVyZzEQMA4GA1UECBMHR2VybWFueTELMAkGA1UE
-BhMCREUxFjAUBgNVBAMTDU1pZGRzb2xEZW1vQ0GCAQAwCwYDVR0PBAQDAgPoMB0G
-A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjANBgkqhkiG9w0BAQQFAANBAIFM
-ji0oB+sdOqRgrjtmt9ojpul6ZvDYrN6CKunLLIO20qlqN8X91TlUMnkKuxjvZFoy
-KH/hGPS3mvKWaeN+9q0=
------END CERTIFICATE-----
diff --git a/mcs/class/System/Test/tools/mutual/mutual.cs b/mcs/class/System/Test/tools/mutual/mutual.cs
deleted file mode 100644
index 66c14884272..00000000000
--- a/mcs/class/System/Test/tools/mutual/mutual.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using System;
-using System.IO;
-using System.Net.Security;
-using System.Net.Sockets;
-using System.Security.Authentication;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-using Mono.Security.Protocol.Tls;
-
-class TestSslClientStream {
-
- static Mono.Security.X509.PKCS12 p12;
-
- [STAThread]
- static void Main(string[] args)
- {
- string host = "localhost";
- if (args.Length > 0)
- host = args[0];
-
- SslProtocols protocol = SslProtocols.Tls;
- if (args.Length > 1) {
- switch (args [1].ToUpper ()) {
- case "SSL":
- protocol = SslProtocols.Ssl3;
- break;
- }
- }
-
- X509CertificateCollection certificates = null;
- if (args.Length > 2) {
- string password = null;
- if (args.Length > 3)
- password = args [3];
-
- p12 = Mono.Security.X509.PKCS12.LoadFromFile(args [2], password);
-
- certificates = new X509CertificateCollection ();
- foreach (Mono.Security.X509.X509Certificate cert in p12.Certificates) {
- certificates.Add(new X509Certificate2(args [2], password));
- break;
- }
- }
-
- TcpClient client = new TcpClient ();
- client.Connect (host, 4433);
-
- SslStream ssl = new SslStream (client.GetStream(), false, new RemoteCertificateValidationCallback (CertificateValidation), new LocalCertificateSelectionCallback (ClientCertificateSelection));
-
- ssl.AuthenticateAsClient (host, certificates, protocol, false);
- StreamWriter sw = new StreamWriter (ssl, System.Text.Encoding.ASCII);
- sw.WriteLine ("GET /clientcert.aspx{0}", Environment.NewLine);
- sw.Flush ();
-
- StreamReader sr = new StreamReader (ssl);
- Console.WriteLine (sr.ReadToEnd ());
- }
-
- static bool CertificateValidation (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors certificateErrors)
- {
- Console.WriteLine ("CertificateValidation");
- Console.WriteLine (certificate.ToString (true));
- Console.WriteLine ("Chain");
- Console.WriteLine (chain);
- Console.WriteLine ("\tError(s)");
- Console.WriteLine (certificateErrors);
- Console.WriteLine ();
- return true;
- }
-
- static X509Certificate ClientCertificateSelection (object sender, string targetHost, X509CertificateCollection clientCertificates,
- X509Certificate serverCertificate, string [] acceptableIssuers)
- {
- Console.WriteLine ("ClientCertificateSelection");
- Console.WriteLine ("\tClient Certificates ({0})", clientCertificates.Count);
- int i = 1;
- foreach (X509Certificate client in clientCertificates)
- Console.WriteLine ("#{0} - {1}", i++, client.ToString (true));
- Console.WriteLine ("\tHost: {0}", targetHost);
- Console.Write ("SERVER {0}", serverCertificate != null ? serverCertificate.ToString (true) : null);
- Console.WriteLine ();
- if (i == 1)
- return null;
- X509Certificate2 cc = new X509Certificate2 (clientCertificates [0]);
- cc.PrivateKey = PrivateKeySelection (cc, targetHost);
- return cc;
- }
-
- static AsymmetricAlgorithm PrivateKeySelection (X509Certificate certificate, string targetHost)
- {
- Console.WriteLine ("PrivateKeySelection");
- Console.WriteLine ("\tHost: {0}", targetHost);
- Console.WriteLine (certificate.ToString (true));
- Console.WriteLine ("\tPrivateKeySelection ({0})", p12.Keys.Count);
- Console.WriteLine ();
- return (AsymmetricAlgorithm) p12.Keys [0];
- }
-}
diff --git a/mcs/class/System/Test/tools/mutual/server.sh b/mcs/class/System/Test/tools/mutual/server.sh
deleted file mode 100755
index e21f27e29d9..00000000000
--- a/mcs/class/System/Test/tools/mutual/server.sh
+++ /dev/null
@@ -1 +0,0 @@
-openssl s_server -www -cert server_cert.pem -key server_key.pem -Verify client.pem -CAfile ca.pem
diff --git a/mcs/class/System/Test/tools/mutual/server_cert.pem b/mcs/class/System/Test/tools/mutual/server_cert.pem
deleted file mode 100644
index 4ad3d6ce62d..00000000000
--- a/mcs/class/System/Test/tools/mutual/server_cert.pem
+++ /dev/null
@@ -1,66 +0,0 @@
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 1 (0x1)
- Signature Algorithm: md5WithRSAEncryption
- Issuer: C=CA, ST=Quebec, L=Quebec City, O=Novell Ximian, OU=Mono Project, CN=Test CA
- Validity
- Not Before: Apr 12 15:17:58 2005 GMT
- Not After : Apr 12 15:17:58 2006 GMT
- Subject: C=CA, ST=Quebec, L=Quebec City, O=Novell Ximian, OU=Mono Project, CN=SSL Test
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public Key: (1024 bit)
- Modulus (1024 bit):
- 00:d7:56:5b:61:f3:7b:5a:db:5c:ec:a5:c0:f6:85:
- 7f:74:67:33:b7:fc:55:72:f5:94:05:52:8c:da:73:
- 70:0a:7f:6f:f6:7a:70:d5:85:d9:64:9b:1f:82:a2:
- b7:57:d5:e5:77:6e:da:bf:a3:c5:5d:32:c5:05:1c:
- 2d:8b:98:08:a5:a5:e4:15:52:68:f5:01:b1:b8:d0:
- bb:1b:d0:80:83:bc:17:32:06:fc:05:18:e7:1e:97:
- ac:ab:de:2d:51:d5:14:78:f7:05:ac:e8:4e:25:f4:
- ff:86:d8:58:d4:9d:e1:e4:02:a1:30:23:c0:b0:19:
- 9a:15:33:ae:ba:62:08:c5:29
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Basic Constraints:
- CA:FALSE
- Netscape Comment:
- OpenSSL Generated Certificate
- X509v3 Subject Key Identifier:
- 65:BB:48:01:4B:DB:D8:9A:FE:AB:96:C1:73:26:FB:03:27:B3:06:5F
- X509v3 Authority Key Identifier:
- keyid:90:32:BC:6C:64:D2:5E:46:98:5F:20:31:DA:2F:E9:15:5D:C9:90:31
- DirName:/C=CA/ST=Quebec/L=Quebec City/O=Novell Ximian/OU=Mono Project/CN=Test CA
- serial:00
-
- Signature Algorithm: md5WithRSAEncryption
- 5a:e3:d5:c7:69:dd:f7:84:e2:19:ee:a0:0d:d6:bb:a9:28:52:
- 15:bc:dc:c3:ad:57:65:07:4c:36:ff:be:7f:15:59:c7:f4:be:
- 6c:f2:88:8a:7a:59:14:0b:fa:07:e0:35:2f:0c:89:33:2c:5f:
- bd:67:03:f5:e6:81:ad:db:f1:12:18:f5:39:63:f7:62:f4:2d:
- e2:9f:f6:e8:32:98:af:bc:ae:65:04:6f:d1:de:d8:3b:aa:b7:
- 66:1e:fa:77:16:dd:b5:eb:7d:b6:ed:a0:8f:68:cd:a0:11:e6:
- dc:bb:a6:ba:31:40:88:b1:04:fe:e8:ca:1d:57:5c:1e:89:8a:
- 07:bd
------BEGIN CERTIFICATE-----
-MIIDXzCCAsigAwIBAgIBATANBgkqhkiG9w0BAQQFADB1MQswCQYDVQQGEwJDQTEP
-MA0GA1UECBMGUXVlYmVjMRQwEgYDVQQHEwtRdWViZWMgQ2l0eTEWMBQGA1UEChMN
-Tm92ZWxsIFhpbWlhbjEVMBMGA1UECxMMTW9ubyBQcm9qZWN0MRAwDgYDVQQDEwdU
-ZXN0IENBMB4XDTA1MDQxMjE1MTc1OFoXDTA2MDQxMjE1MTc1OFowdjELMAkGA1UE
-BhMCQ0ExDzANBgNVBAgTBlF1ZWJlYzEUMBIGA1UEBxMLUXVlYmVjIENpdHkxFjAU
-BgNVBAoTDU5vdmVsbCBYaW1pYW4xFTATBgNVBAsTDE1vbm8gUHJvamVjdDERMA8G
-A1UEAxMIU1NMIFRlc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANdWW2Hz
-e1rbXOylwPaFf3RnM7f8VXL1lAVSjNpzcAp/b/Z6cNWF2WSbH4Kit1fV5Xdu2r+j
-xV0yxQUcLYuYCKWl5BVSaPUBsbjQuxvQgIO8FzIG/AUY5x6XrKveLVHVFHj3Bazo
-TiX0/4bYWNSd4eQCoTAjwLAZmhUzrrpiCMUpAgMBAAGjgf0wgfowCQYDVR0TBAIw
-ADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUw
-HQYDVR0OBBYEFGW7SAFL29ia/quWwXMm+wMnswZfMIGfBgNVHSMEgZcwgZSAFJAy
-vGxk0l5GmF8gMdov6RVdyZAxoXmkdzB1MQswCQYDVQQGEwJDQTEPMA0GA1UECBMG
-UXVlYmVjMRQwEgYDVQQHEwtRdWViZWMgQ2l0eTEWMBQGA1UEChMNTm92ZWxsIFhp
-bWlhbjEVMBMGA1UECxMMTW9ubyBQcm9qZWN0MRAwDgYDVQQDEwdUZXN0IENBggEA
-MA0GCSqGSIb3DQEBBAUAA4GBAFrj1cdp3feE4hnuoA3Wu6koUhW83MOtV2UHTDb/
-vn8VWcf0vmzyiIp6WRQL+gfgNS8MiTMsX71nA/Xmga3b8RIY9Tlj92L0LeKf9ugy
-mK+8rmUEb9He2Duqt2Ye+ncW3bXrfbbtoI9ozaAR5ty7proxQIixBP7oyh1XXB6J
-ige9
------END CERTIFICATE-----
diff --git a/mcs/class/System/Test/tools/mutual/server_key.pem b/mcs/class/System/Test/tools/mutual/server_key.pem
deleted file mode 100644
index 497199b6e96..00000000000
--- a/mcs/class/System/Test/tools/mutual/server_key.pem
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQDXVlth83ta21zspcD2hX90ZzO3/FVy9ZQFUozac3AKf2/2enDV
-hdlkmx+CordX1eV3btq/o8VdMsUFHC2LmAilpeQVUmj1AbG40Lsb0ICDvBcyBvwF
-GOcel6yr3i1R1RR49wWs6E4l9P+G2FjUneHkAqEwI8CwGZoVM666YgjFKQIDAQAB
-AoGAfYxJ50gQSZ7QBOF3KcQX1YQ+MS0bnNT1okzI9qyLTHOUkb49fyB06SVQL9gy
-0TFSglnNjCIt9fKd0CbnnxXbI7cPf35SYB8GXJKoF8wOTx/QfPHKn5GCYDX7GPcm
-Q3praI+J8XiS7DN6WVbcB+pdqsU+uEYWLhe5CiDUBaxBlqECQQD1lZjeuNzNRuF9
-ylltDfDEXmEsb/uAP6LV5rKF6bXLrXCEOp+FExqXOHHzawoI/NEioDI2r/modFKc
-xEU19gZlAkEA4HhbNWhBks0XBN6nRECjn2F40PSt9JAMoaHbC+sMEQVbQ+Qdwi2E
-261LlV22maCwEsq6AuPnMMSgjio1tapldQJAOhrlCn1OsLr+ixafRfAwcSWrdCoi
-pVtpGZb10j1TqBcnMgH00DWO6wyN2XwP6cR3buvcNZg5R6QOD81YWsYVCQJAZtTc
-O9g6Cg1oWTPC/tJ54r7dgSRGOL5w+u7SEWCpU3bXu39aXqVJsvVtpcybpT9mygUT
-N9W+CKpbPyV5G3MnLQJBAIdhgi3/X2Oc55U1Wlo3tQeKvolouSm5XVvKikFrQiDy
-x1iY5mGo93eqDIIzkxRFfYOt9HIeuhIjddNGgXHExe4=
------END RSA PRIVATE KEY-----
diff --git a/mcs/class/System/Test/tools/mutual/serveropt.sh b/mcs/class/System/Test/tools/mutual/serveropt.sh
deleted file mode 100755
index 11210e9e999..00000000000
--- a/mcs/class/System/Test/tools/mutual/serveropt.sh
+++ /dev/null
@@ -1 +0,0 @@
-openssl s_server -www -cert server_cert.pem -key server_key.pem -verify client.pem -CAfile ca.pem
diff --git a/mcs/class/System/Test/tools/server/Makefile b/mcs/class/System/Test/tools/server/Makefile
deleted file mode 100644
index f6362b8950e..00000000000
--- a/mcs/class/System/Test/tools/server/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-thisdir = class/Mono.Security/Test/tools/server
-SUBDIRS =
-include ../../../../../build/rules.make
-
-LOCAL_MCS_FLAGS = -r:System.dll -r:Mono.Security.dll
-
-all-local install-local uninstall-local:
-
-test-local:
-
-# ??? What do we run here?
-
-run-test-local:
-
-clean-local:
- rm -f *.exe *.pdb *.mdb ssl.cer ssl.pvk index.html*
-
-sources = msslserver.cs
-
-DISTFILES = $(sources) mutual.pem README Makefile
-
-dist-local: dist-default
-
-all: msslserver.exe ssl.pvk
-
-msslserver.exe: msslserver.cs
- $(CSCOMPILE) /target:exe /out:$@ $^
-
-ssl.pvk:
- makecert -r -eku 1.3.6.1.5.5.7.3.1 -n "CN=$(HOSTNAME)" -sv ssl.pvk ssl.cer
diff --git a/mcs/class/System/Test/tools/server/README b/mcs/class/System/Test/tools/server/README
deleted file mode 100644
index 7574dae24b8..00000000000
--- a/mcs/class/System/Test/tools/server/README
+++ /dev/null
@@ -1,3 +0,0 @@
-This is a ported version of sample tool from Mono.Security.
-See mcs/class/Mono.Security/Test/tools/server/README.
-
diff --git a/mcs/class/System/Test/tools/server/msslserver.cs b/mcs/class/System/Test/tools/server/msslserver.cs
deleted file mode 100644
index f4383a8186c..00000000000
--- a/mcs/class/System/Test/tools/server/msslserver.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-using System;
-using System.IO;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-
-using Mono.Security.Authenticode;
-//using Mono.Security.Protocol.Tls;
-using System.Net.Security;
-using System.Security.Authentication;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace SslHttpServer
-{
- class SslHttpServer
- {
- private static X509Certificate _certificate = null;
- private static string certfile;
- private static string keyfile;
-
- static void Main (string [] args)
- {
- certfile = (args.Length > 1) ? args [0] : "ssl.cer";
- keyfile = (args.Length > 1) ? args [1] : "ssl.pvk";
-
- Socket listenSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- IPEndPoint localEndPoint = new IPEndPoint (IPAddress.Any, 4433);
- Socket requestSocket;
-
- listenSocket.Bind (localEndPoint);
- listenSocket.Listen (10);
-
- while (true) {
- try {
- requestSocket = listenSocket.Accept ();
- using (NetworkStream ns = new NetworkStream (requestSocket, FileAccess.ReadWrite, true)) {
- using (SslStream s = new SslStream (ns, false, new RemoteCertificateValidationCallback (VerifyClientCertificate))) {
- s.AuthenticateAsServer (Certificate, false, SslProtocols.Default, false);
- StreamReader reader = new StreamReader (s);
- StreamWriter writer = new StreamWriter (s, Encoding.ASCII);
-
- string line;
- // Read request header
- do {
- line = reader.ReadLine ();
- if (line != null)
- Console.WriteLine (line);
- }
- while (line != null && line.Length > 0);
-
- string answer = String.Format ("HTTP/1.0 200{0}Connection: close{0}" +
- "Content-Type: text/html{0}Content-Encoding: {1}{0}{0}" +
- "<html><body><h1>Hello {2}!</h1></body></html>{0}",
- "\r\n", Encoding.ASCII.WebName,
- s.RemoteCertificate == null ? "World" : s.RemoteCertificate.GetName ());
-
- // Send response
- writer.Write (answer);
-
- writer.Flush ();
- s.Flush ();
- ns.Flush ();
- }
- }
- }
- catch (Exception ex) {
- Console.WriteLine ("---------------------------------------------------------");
- Console.WriteLine (ex.ToString ());
- }
- }
- }
-
- private static X509Certificate Certificate {
- get {
- if (_certificate == null) {
- X509Certificate2 ccc = new X509Certificate2 (certfile);
- ccc.PrivateKey = PrivateKey.CreateFromFile (keyfile).RSA;
- //_certificate = new X509Certificate2 (ccc.Export (X509ContentType.Pkcs12, "mono"), "mono");
- _certificate = ccc;
- }
- return _certificate;
- }
- }
-
-/*
- // note: makecert creates the private key in the PVK format
- private static AsymmetricAlgorithm GetPrivateKey (X509Certificate certificate, string targetHost)
- {
- PrivateKey key = PrivateKey.CreateFromFile (keyfile);
- return key.RSA;
- }
-*/
-
- private static bool VerifyClientCertificate (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors certificateErrors)
- {
- if (certificate != null) {
- Console.WriteLine (certificate.ToString (true));
- } else {
- Console.WriteLine ("No client certificate provided.");
- }
-
- Console.WriteLine (chain);
-
-// foreach (int error in certificateErrors)
- Console.WriteLine ("\terror #{0}", certificateErrors);
- return true;
- }
- }
-}
diff --git a/mcs/class/System/Test/tools/server/mutual.pem b/mcs/class/System/Test/tools/server/mutual.pem
deleted file mode 100644
index a28ce722e46..00000000000
--- a/mcs/class/System/Test/tools/server/mutual.pem
+++ /dev/null
@@ -1,53 +0,0 @@
-Bag Attributes
- localKeyID: 1F DC A6 8D CB 2B F4 7E 64 DC FC 54 61 58 AB 41 3E 35 45 24
- friendlyName: MiddsolDemoCert
-subject=/C=DE/ST=Germany/O=Middsol/CN=MiddsolDemoCert
-issuer=/O=Middsol/L=Hamburg/ST=Germany/C=DE/CN=MiddsolDemoCA
------BEGIN CERTIFICATE-----
-MIICejCCAiSgAwIBAgIBATANBgkqhkiG9w0BAQQFADBbMRAwDgYDVQQKEwdNaWRk
-c29sMRAwDgYDVQQHEwdIYW1idXJnMRAwDgYDVQQIEwdHZXJtYW55MQswCQYDVQQG
-EwJERTEWMBQGA1UEAxMNTWlkZHNvbERlbW9DQTAeFw0wNDA4MjUxNTAzMTlaFw0x
-NDA4MjMxNTAzMTlaMEsxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdHZXJtYW55MRAw
-DgYDVQQKEwdNaWRkc29sMRgwFgYDVQQDEw9NaWRkc29sRGVtb0NlcnQwXDANBgkq
-hkiG9w0BAQEFAANLADBIAkEApnQapV0DtGUrE1Z0Jn3DCdXL43f8qbvUunlKhq2P
-8errH5r4dl4ZVjod43KZV5yp0TKNQOvVRWEucNVMwCcs1wIDAQABo4HiMIHfMAwG
-A1UdEwQFMAMBAf8wHQYDVR0OBBYEFACmgZvTLGm1MEwTJM2U1aaNLVpYMIGDBgNV
-HSMEfDB6gBTSHOgWrKCgE3BgSksGSZdJjL6pLaFfpF0wWzEQMA4GA1UEChMHTWlk
-ZHNvbDEQMA4GA1UEBxMHSGFtYnVyZzEQMA4GA1UECBMHR2VybWFueTELMAkGA1UE
-BhMCREUxFjAUBgNVBAMTDU1pZGRzb2xEZW1vQ0GCAQAwCwYDVR0PBAQDAgPoMB0G
-A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjANBgkqhkiG9w0BAQQFAANBAIFM
-ji0oB+sdOqRgrjtmt9ojpul6ZvDYrN6CKunLLIO20qlqN8X91TlUMnkKuxjvZFoy
-KH/hGPS3mvKWaeN+9q0=
------END CERTIFICATE-----
-Bag Attributes
- friendlyName: MiddsolDemoCA
-subject=/O=Middsol/L=Hamburg/ST=Germany/C=DE/CN=MiddsolDemoCA
-issuer=/O=Middsol/L=Hamburg/ST=Germany/C=DE/CN=MiddsolDemoCA
------BEGIN CERTIFICATE-----
-MIICXjCCAgigAwIBAgIBADANBgkqhkiG9w0BAQQFADBbMRAwDgYDVQQKEwdNaWRk
-c29sMRAwDgYDVQQHEwdIYW1idXJnMRAwDgYDVQQIEwdHZXJtYW55MQswCQYDVQQG
-EwJERTEWMBQGA1UEAxMNTWlkZHNvbERlbW9DQTAeFw0wNDA4MjUxNTAyNDdaFw0x
-NDA4MjgxNTAyNDdaMFsxEDAOBgNVBAoTB01pZGRzb2wxEDAOBgNVBAcTB0hhbWJ1
-cmcxEDAOBgNVBAgTB0dlcm1hbnkxCzAJBgNVBAYTAkRFMRYwFAYDVQQDEw1NaWRk
-c29sRGVtb0NBMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJMY+RSPiP9KpxznPE0S
-PGHhStc25y1CDHGdR33T1PCg3cD+XX5nLDTn83Jb3KU1j/Nh5sDi7RLflrSo8oXz
-OAkCAwEAAaOBtjCBszAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBTSHOgWrKCgE3Bg
-SksGSZdJjL6pLTCBgwYDVR0jBHwweoAU0hzoFqygoBNwYEpLBkmXSYy+qS2hX6Rd
-MFsxEDAOBgNVBAoTB01pZGRzb2wxEDAOBgNVBAcTB0hhbWJ1cmcxEDAOBgNVBAgT
-B0dlcm1hbnkxCzAJBgNVBAYTAkRFMRYwFAYDVQQDEw1NaWRkc29sRGVtb0NBggEA
-MA0GCSqGSIb3DQEBBAUAA0EAHYPXGT8tDS0LyFIAor8PZ3zP+MxIHm9p87IarsFI
-elsb1+JaFNVYb3Mzh+dXY93NrTsxIjgbi8ld8X0w4KElHA==
------END CERTIFICATE-----
-Bag Attributes
- localKeyID: 1F DC A6 8D CB 2B F4 7E 64 DC FC 54 61 58 AB 41 3E 35 45 24
- friendlyName: MiddsolDemoCert
-Key Attributes: <No Attributes>
------BEGIN RSA PRIVATE KEY-----
-MIIBOQIBAAJBAKZ0GqVdA7RlKxNWdCZ9wwnVy+N3/Km71Lp5Soatj/Hq6x+a+HZe
-GVY6HeNymVecqdEyjUDr1UVhLnDVTMAnLNcCAwEAAQJAbg0heOeQhXrGChkE3lYT
-17LVBOXV1VrsgQWkcnraSvUXqbFe9i6K9ixA0tkYP7EDdxePy+lvL7WX2FPO87T9
-cQIhANZ14EcToA1M76WQvnVd2PykfO8yLunn3B7v2e5Uba/DAiEAxrHIKNzm8sHL
-jqAu//d8+QXW7yHcfG1cXi1cLBMOMV0CICAF9flnCs0xoc89L9NishX3kdg9zBeN
-Uack9YvK+531AiAOxJHy75A+xMajYCZ+Id/pBlUWSvb/TIWL/mUWZYgthQIgJSiW
-fr2dfTbD+cE5QdW+IPn8QTWhqiyJKR5HPXMk+iE=
------END RSA PRIVATE KEY-----
diff --git a/mcs/class/System/common_networking.sources b/mcs/class/System/common_networking.sources
index f89d6b794b6..78cb8279c88 100644
--- a/mcs/class/System/common_networking.sources
+++ b/mcs/class/System/common_networking.sources
@@ -4,8 +4,6 @@ System.Net/NtlmClient.cs
Mono.Net.Security/AsyncProtocolRequest.cs
Mono.Net.Security/CallbackHelpers.cs
Mono.Net.Security/ChainValidationHelper.cs
-Mono.Net.Security/LegacySslStream.cs
-Mono.Net.Security/LegacyTlsProvider.cs
Mono.Net.Security/MobileAuthenticatedStream.cs
Mono.Net.Security/MobileTlsContext.cs
Mono.Net.Security/MonoSslAuthenticationOptions.cs