Merge pull request #4195 from lateralusX/jlorenss/win-build-dependency
[mono.git] / mcs / class / System / Mono.Net.Security / MonoTlsProviderFactory.Droid.cs
1 // Copyright 2015 Xamarin Inc. All rights reserved.
2 #if SECURITY_DEP
3
4 #if MONO_SECURITY_ALIAS
5 extern alias MonoSecurity;
6 using MSI = MonoSecurity::Mono.Security.Interface;
7 #else
8 using MSI = Mono.Security.Interface;
9 #endif
10
11 #if MONO_FEATURE_BTLS
12 using Mono.Btls;
13 #endif
14
15 using System;
16
17 namespace Mono.Net.Security
18 {
19         static partial class MonoTlsProviderFactory
20         {
21                 static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
22                 {
23                         MSI.MonoTlsProvider provider = null;
24                         var type = Environment.GetEnvironmentVariable ("XA_TLS_PROVIDER");
25                         switch (type) {
26                         case null:
27                         case "default":
28                         case "legacy":
29                                 return new LegacyTlsProvider ();
30 #if MONO_FEATURE_BTLS
31                         case "btls":
32                                 if (!IsBtlsSupported ())
33                                         throw new NotSupportedException ("BTLS in not supported!");
34                                 return new MonoBtlsProvider ();
35 #endif
36                         default:
37                                 throw new NotSupportedException (string.Format ("Invalid TLS Provider: `{0}'.", provider));
38                         }
39                 }
40         }
41 }
42 #endif