Select to view content in your preferred language

ArcGISRuntime .Net SDK to connect to Enterprise GIS portal giving SSL client certificate error

286
3
Jump to solution
03-17-2025 07:07 PM
Labels (3)
RonakPatel2
Emerging Contributor

I am using the ArcGIS SDK for .Net 8.0 in my Xaml App. When trying to get authenticate user using this function, await AuthenticationManager.Current.GenerateCredentialAsync I am getting SSL error. I am unable to find a sample code that illustrates how we attach HttpClient handler to the ArcGISRuntime or alternative way of supplying client cert with when the server certificate validation happens.

I am using Visual Studio 2022 and targeting to Android 15.0.

Tags (1)
0 Kudos
2 Solutions

Accepted Solutions
JoeHershman
MVP Alum

As mentioned in this thread Certificate Trust Issue using Domain CA for VPN connected App there is a method RemoteCertificateValidationCallback on AuthenticationManager which gets called on validation.

In iOS you also need to add information to the info.plist if you are using a non-public domain

Thanks,
-Joe

View solution in original post

RonakPatel2
Emerging Contributor

Thanks @JoeHershman it helped to move forward with this to make sure the device can connect to the portal. We will now add client cert validation logic to ensure it is secured.
AuthenticationManager.Current.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;

View solution in original post

0 Kudos
3 Replies
JoeHershman
MVP Alum

As mentioned in this thread Certificate Trust Issue using Domain CA for VPN connected App there is a method RemoteCertificateValidationCallback on AuthenticationManager which gets called on validation.

In iOS you also need to add information to the info.plist if you are using a non-public domain

Thanks,
-Joe
RonakPatel2
Emerging Contributor

Thanks @JoeHershman it helped to move forward with this to make sure the device can connect to the portal. We will now add client cert validation logic to ensure it is secured.
AuthenticationManager.Current.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;

0 Kudos
dotMorten_esri
Esri Notable Contributor

Just to add a note to this: The above code is totally fine for testing, but don't deploy this into production since you'd completely bypass all SSL checks by always returning true here. You could improve it a little by at least only returning true for the specific endpoint with the very specific certificate you'd expect from that server.

0 Kudos