TLS1.2を使用してXamarin.FormsからPOSTトランザクションを送信しようとしていますが、TLS 1.1としてサーバーに到着しています。Xamarin.FormsとVisualStudioでTLS 1.2を送信できません2017
私が設定されているAndroidのオプション:
のHttpClient impletemtationアンドロイドとして
SSL/TLSの実装としてネイティブTLS 1.2+
私が実装し、VisualStudioを2017年に実行し、使用していますエミュレータのAndroid 6.0コードについて
は、私はいくつかの的環境変数を設定します。
Constants.ApiBaseUrlがhttpsでURLが含まれusing (HttpClient client = new HttpClient())
or
using (HttpClient client = new HttpClient(new NativeMessageHandler()))
or
using (HttpClient client = new HttpClient(new Xamarin.Android.Net.AndroidClientHandler()))
{
try
{
HttpResponseMessage responseHttp = await client.PostAsync(new Uri(new Uri(Constants.ApiBaseUrl), "authorize"), content);
...
:// <>の形式を
System.Environment.SetEnvironmentVariable("MONO_TLS_PROVIDER", "btls");
System.Environment.SetEnvironmentVariable("XA_TLS_PROVIDER", "btls");
System.Environment.SetEnvironmentVariable("XA_HTTP_CLIENT_HANDLER_TYPE", "Xamarin.Android.Net.AndroidClientHandler");
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
最後に、POSTがで送られます。 Wiresharkのと
POSTが送信されたときに問題が、私は例外を持っていませんが、私のサーバーに私が見たトランザクションのように:
HttpWebRequest httpWebRequest = WebRequest.CreateHttp(new Uri(new Uri(Constants.ApiBaseUrl), "authorize"));
httpWebRequest.Method = "POST";
httpWebRequest.Credentials = CredentialCache.DefaultNetworkCredentials;
Stream sw = httpWebRequest.GetRequestStream();
sw.Write(contentByte, 0, contentByte.Length);
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
を:
私も使用して、他の方法で試してみました使用して独自の証明書付きとなし
:この場合
httpWebRequest.ClientCertificates = cryptoSvc.x509HostCertificates;
を、私は
を使用している場合ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
私はそれはまた、TLS1.1として到着された行がなければ例外
RestService-SendJsonDataAsync ERROR: Error: SecureChannelFailure
(**Ssl error:100000f0:SSL routines:OPENSSL_internal:UNSUPPORTED_PROTOCOL**
at /Users/builder/jenkins/workspace/xamarin-android/xamarin-android/external/mono/external/boringssl/ssl/handshake_client.c:808)
を取得します。
誰も私の場合に何が間違っているかについてのアイデアや提案はありますか?
お時間をいただきありがとうございます。私は、Android 6.0を信じ
あなたのコメント@DanielMacleanをありがとう、私はそれらの線なしにしようとしたが、同じ結果を得ました。一方、私のサーバーは両方の接続を現時点で許可しています。 – santiPipes
サーバーで1.1を無効にすることはできますか? – LewisT
私はできません、サーバーは両方の接続を許可する必要があります。私は実際にTLS1.1とTLS1.2を使用してこのサーバに支払い端末を接続します。 – santiPipes