Merge pull request #3670 from lambdageek/dev/mempool-loader-error-msg
[mono.git] / mcs / class / System / Mono.Net.Security / LegacyTlsProvider.cs
1 //
2 // LegacyTlsProvider.cs
3 //
4 // Author:
5 //       Martin Baulig <martin.baulig@xamarin.com>
6 //
7 // Copyright (c) 2015 Xamarin, Inc.
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 // THE SOFTWARE.
26 #if SECURITY_DEP
27 #if MONO_SECURITY_ALIAS
28 extern alias MonoSecurity;
29 #endif
30
31 #if MONO_SECURITY_ALIAS
32 using MSI = MonoSecurity::Mono.Security.Interface;
33 #else
34 using MSI = Mono.Security.Interface;
35 #endif
36
37 using System;
38 using System.IO;
39 using System.Net;
40 using System.Net.Security;
41 using System.Security.Cryptography.X509Certificates;
42 using System.Security.Authentication;
43
44 namespace Mono.Net.Security
45 {
46         /*
47          * Strictly private - do not use outside the Mono.Net.Security directory.
48          */
49         class LegacyTlsProvider : MSI.MonoTlsProvider
50         {
51                 static readonly Guid id = new Guid ("809e77d5-56cc-4da8-b9f0-45e65ba9cceb");
52
53                 public override Guid ID {
54                         get { return id; }
55                 }
56
57                 public override string Name {
58                         get { return "legacy"; }
59                 }
60
61                 public override bool SupportsSslStream {
62                         get { return true; }
63                 }
64
65                 public override bool SupportsConnectionInfo {
66                         get { return false; }
67                 }
68
69                 public override bool SupportsMonoExtensions {
70                         get { return false; }
71                 }
72
73                 internal override bool SupportsTlsContext {
74                         get { return false; }
75                 }
76
77                 public override SslProtocols SupportedProtocols {
78                         get { return SslProtocols.Tls; }
79                 }
80
81                 public override MSI.IMonoSslStream CreateSslStream (
82                         Stream innerStream, bool leaveInnerStreamOpen,
83                         MSI.MonoTlsSettings settings = null)
84                 {
85                         var impl = new Private.LegacySslStream (innerStream, leaveInnerStreamOpen, this, settings);
86                         return new Private.MonoSslStreamImpl (impl);
87                 }
88
89                 internal override MSI.IMonoTlsContext CreateTlsContext (
90                         string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
91                         X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
92                         bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
93                         MSI.MonoTlsSettings settings)
94                 {
95                         throw new NotSupportedException ();
96                 }
97         }
98 }
99 #endif
100