2016-08-23 13:20:38 +00:00
|
|
|
// Copyright 2015 Xamarin Inc. All rights reserved.
|
|
|
|
#if SECURITY_DEP
|
2017-04-10 11:41:01 +00:00
|
|
|
|
|
|
|
#if MONO_SECURITY_ALIAS
|
|
|
|
extern alias MonoSecurity;
|
|
|
|
using MSI = MonoSecurity::Mono.Security.Interface;
|
|
|
|
#else
|
2016-08-23 13:20:38 +00:00
|
|
|
using MSI = Mono.Security.Interface;
|
2017-04-10 11:41:01 +00:00
|
|
|
#endif
|
|
|
|
|
2016-11-10 13:04:39 +00:00
|
|
|
#if MONO_FEATURE_BTLS
|
2016-08-23 13:20:38 +00:00
|
|
|
using Mono.Btls;
|
|
|
|
#endif
|
|
|
|
|
2017-04-10 11:41:01 +00:00
|
|
|
using System;
|
|
|
|
|
2016-08-23 13:20:38 +00:00
|
|
|
namespace Mono.Net.Security
|
|
|
|
{
|
|
|
|
static partial class MonoTlsProviderFactory
|
|
|
|
{
|
|
|
|
static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
|
|
|
|
{
|
|
|
|
MSI.MonoTlsProvider provider = null;
|
|
|
|
var type = Environment.GetEnvironmentVariable ("XA_TLS_PROVIDER");
|
|
|
|
switch (type) {
|
|
|
|
case null:
|
|
|
|
case "default":
|
|
|
|
case "legacy":
|
2016-11-10 13:04:39 +00:00
|
|
|
return new LegacyTlsProvider ();
|
|
|
|
#if MONO_FEATURE_BTLS
|
2016-08-23 13:20:38 +00:00
|
|
|
case "btls":
|
2016-11-10 13:04:39 +00:00
|
|
|
if (!IsBtlsSupported ())
|
2016-08-23 13:20:38 +00:00
|
|
|
throw new NotSupportedException ("BTLS in not supported!");
|
|
|
|
return new MonoBtlsProvider ();
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
throw new NotSupportedException (string.Format ("Invalid TLS Provider: `{0}'.", provider));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|