Merge pull request #2247 from ivmai/match-ext-libgc-api
[mono.git] / mcs / class / Mono.Security.Providers.OldTls / Mono.Security.Providers.OldTls / OldTlsProvider.cs
1 //
2 // OldTlsProvider.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 using System;
27 using System.IO;
28 using System.Net;
29 using System.Net.Security;
30 using System.Security.Authentication;
31 using System.Security.Cryptography.X509Certificates;
32 using Mono.Security.Interface;
33 using MNS = Mono.Net.Security;
34
35 namespace Mono.Security.Providers.OldTls
36 {
37         public class OldTlsProvider : MonoTlsProvider
38         {
39                 static readonly Guid id = new Guid ("cf8baa0d-c6ed-40ae-b512-dec8d097e9af");
40
41                 public override Guid ID {
42                         get { return id; }
43                 }
44
45                 public override string Name {
46                         get { return "old"; }
47                 }
48
49                 public override bool SupportsSslStream {
50                         get { return true; }
51                 }
52
53                 public override bool SupportsMonoExtensions {
54                         get { return false; }
55                 }
56
57                 public override bool SupportsTlsContext {
58                         get { return false; }
59                 }
60
61                 public override SslProtocols SupportedProtocols {
62                         get { return SslProtocols.Tls; }
63                 }
64
65                 public override IMonoSslStream CreateSslStream (
66                         Stream innerStream, bool leaveInnerStreamOpen,
67                         MonoTlsSettings settings = null)
68                 {
69                         var impl = new MNS.LegacySslStream (innerStream, leaveInnerStreamOpen, this, settings);
70                         return new MNS.MonoSslStreamImpl (impl);
71                 }
72
73                 public override IMonoTlsContext CreateTlsContext (
74                         string hostname, bool serverMode, TlsProtocols protocolFlags,
75                         X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
76                         bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
77                         MonoTlsSettings settings)
78                 {
79                         throw new NotSupportedException ();
80                 }
81         }
82 }
83