Skip to content

X509Certificate in Android permissions #6

@jhalbrecht

Description

@jhalbrecht

Also see; X509Certificate2 in UWP #5

The UWP app of this sample xamarinforms application is working. The android app not so much.

I'm not sure of what permissions for the Android Manifest. I searched a bit and found this issue on eclipse/paho.mqtt.android Permissions #98 I used these;

<!-- Permissions the Application Requires -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />

I'm getting this error at runtime.

uPLibrary.Networking.M2Mqtt.Exceptions.MqttConnectionException: Exception connecting to the broker ---> System.AggregateException: One or more errors occurred. ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
  at /Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/external/boringssl/ssl/handshake_client.c:1132
  at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00038] in <fb6d78e506844b3b96d5b35aa047fbbd>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status) [0x0003e] in <fb6d78e506844b3b96d5b35aa047fbbd>:0 
  at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus)
  at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00006] in <fb6d78e506844b3b96d5b35aa047fbbd>:0 
  at Mono.Net.Security.AsyncProtocolRequest+<ProcessOperation>d__24.MoveNext () [0x000ff] in <fb6d78e506844b3b96d5b35aa047fbbd>:0 
--- End of stack trace from previous location where exception was thrown ---
  at Mono.Net.Security.AsyncProtocolRequest+<StartOperation>d__23.MoveNext () [0x0008b] in <fb6d78e506844b3b96d5b35aa047fbbd>:0 
   --- End of inner exception stack trace ---
  at Mono.Net.Security.MobileAuthenticatedStream+<ProcessAuthentication>d__47.MoveNext () [0x00254] in <fb6d78e506844b3b96d5b35aa047fbbd>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 
  at uPLibrary.Networking.M2Mqtt.MqttNetworkChannel.Connect () [0x000a3] in <e87b8d9e7cd447a9bd7e888c0ab94dbb>:0 
  at uPLibrary.Networking.M2Mqtt.MqttClient.Connect (System.String clientId, System.String username, System.String password, System.Boolean willRetain, System.Byte willQosLevel, System.Boolean willFlag, System.String willTopic, System.String willMessage, System.Boolean cleanSession, System.UInt16 keepAlivePeriod) [0x0001e] in <e87b8d9e7cd447a9bd7e888c0ab94dbb>:0 
   --- End of inner exception stack trace ---
  at uPLibrary.Networking.M2Mqtt.MqttClient.Connect (System.String clientId, System.String username, System.String password, System.Boolean willRetain, System.Byte willQosLevel, System.Boolean willFlag, System.String willTopic, System.String willMessage, System.Boolean cleanSession, System.UInt16 keepAlivePeriod) [0x00037] in <e87b8d9e7cd447a9bd7e888c0ab94dbb>:0 
  at uPLibrary.Networking.M2Mqtt.MqttClient.Connect (System.String clientId) [0x00000] in <e87b8d9e7cd447a9bd7e888c0ab94dbb>:0 
  at MqttDataService.MqttDataService+<Initialize>d__5.MoveNext () [0x00226] in C:\jstuff\MqttSample\MqttDataService\MqttDataService.cs:118 

02-18 09:16:34.026 D/Mono    (28136): Found as 'mono_btls_error_get_error_line'.
02-18 09:16:34.027 D/Mono    (28136): DllImport searching in: 'libmono-btls-shared' ('./libmono-btls-shared.so').
02-18 09:16:34.027 D/Mono    (28136): Searching for 'mono_btls_error_get_error_string_n'.
02-18 09:16:34.027 D/Mono    (28136): Probing 'mono_btls_error_get_error_string_n'.
02-18 09:16:34.027 D/Mono    (28136): Found as 'mono_btls_error_get_error_string_n'.
02-18 09:16:44.466 W/zygote  (28136): Checksum mismatch for dex base.apk

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions