X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FSystem%2FAndroidPlatform.cs;h=dc4f4aaa54ec0200a97c579834cc1af691bc7012;hb=8784e2e1cbbd88b4872536d3a8077702dc547216;hp=e2e89448d18c80e02e9a17b116b8e040054e4541;hpb=48992d4b3f8b568be17180372160d2f3e03b8ccb;p=mono.git diff --git a/mcs/class/System/System/AndroidPlatform.cs b/mcs/class/System/System/AndroidPlatform.cs index e2e89448d18..dc4f4aaa54e 100644 --- a/mcs/class/System/System/AndroidPlatform.cs +++ b/mcs/class/System/System/AndroidPlatform.cs @@ -33,6 +33,9 @@ using System.Net.Security; using System.Security.Cryptography.X509Certificates; #if SECURITY_DEP using MSX = Mono.Security.X509; +#if MONO_FEATURE_BTLS +using Mono.Btls; +#endif #endif namespace System { @@ -43,6 +46,7 @@ namespace System { #if SECURITY_DEP static readonly Converter, bool> trustEvaluateSsl; + static readonly Func certStoreLookup; #endif // SECURITY_DEP static readonly Func getDefaultProxy; static readonly GetInterfaceAddressesDelegate getInterfaceAddresses; @@ -58,6 +62,14 @@ namespace System { "TrustEvaluateSsl", ignoreCase:false, throwOnBindFailure:true); +#if MONO_FEATURE_BTLS + certStoreLookup = (Func) + Delegate.CreateDelegate (typeof (Func), + t, + "CertStoreLookup", + ignoreCase:false, + throwOnBindFailure:true); +#endif // MONO_FEATURE_BTLS #endif // SECURITY_DEP getDefaultProxy = (Func)Delegate.CreateDelegate ( typeof (Func), t, "GetDefaultProxy", @@ -76,13 +88,33 @@ namespace System { } #if SECURITY_DEP - internal static bool TrustEvaluateSsl (MSX.X509CertificateCollection collection, object sender, X509Certificate2 certificate, X509Chain chain, SslPolicyErrors errors) + internal static bool TrustEvaluateSsl (X509CertificateCollection collection) { var certsRawData = new List (collection.Count); - foreach (MSX.X509Certificate cert in collection) - certsRawData.Add (cert.RawData); + foreach (var cert in collection) + certsRawData.Add (cert.GetRawCertData ()); return trustEvaluateSsl (certsRawData); } + +#if MONO_FEATURE_BTLS + internal static MonoBtlsX509 CertStoreLookup (MonoBtlsX509Name name) + { + var hash = name.GetHash (); + var hashOld = name.GetHashOld (); + var result = certStoreLookup (hash, false); + if (result == null) + result = certStoreLookup (hashOld, false); + if (result == null) + result = certStoreLookup (hash, true); + if (result == null) + result = certStoreLookup (hashOld, true); + + if (result == null) + return null; + + return MonoBtlsX509.LoadFromData (result, MonoBtlsX509Format.DER); + } +#endif // MONO_FEATURE_BTLS #endif // SECURITY_DEP internal static IWebProxy GetDefaultProxy ()