- Home /
How do I properly initialize X509Store on iOS and Android?
I am using SslStream in Unity to communicate with our backend network services. I have been trying to properly validate the X509 certificates, and have found that it is necessary to add the CA's public certificate as well as intermediate certificates to the X509Store in order for validation to succeed. This works on the editor, however when I try the same method on iOS or Android, I get an error creating a path when calling X509Store.Add().
Here is the exception I get on Android:
11-17 04:54:37.922 9510 9537 I Unity : UnauthorizedAccessException: Access to the path "/.config" is denied. 11-17 04:54:37.922 9510 9537 I Unity : at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in :0 11-17 04:54:37.922 9510 9537 I Unity :
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in :0 11-17 04:54:37.922 9510 9537 I Unity :
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in :0 11-17 04:54:37.922 9510 9537 I Unity :
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in :0 11-17 04:54:37.922 9510 9537 I Unity :
at Mono.Security.X509.X509Store.CheckStore (System.String path, Boolean throwException) [0x00000] in unknown>:0 11-17 04:54:37.922 9510 9537 I Unity : at Mono.Security.X509.X509Store.Import (Mono.Security.X509.X509Certificate certificate) [0x00000] in unknown>:0 11-17 04:54:37.922 9510 9537 I Unity : at System.Security.Cryptography.X509Certificates.X509Store.Add (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x00000] in unknown>:0 11-17 04:54:37.922 9510 9537 I Unity : at ServiceClient.InitializeTLS () [0x00000] in :0 11-17 04:54:37.922 9510 9537 I Unity : at Game.OnBundleInfoAvail
The iOS error is similiar, but is trying a different path. Is there some initialization I need to do on iOS/Android in order for the X509Store to function properly?
Your answer
Follow this Question
Related Questions
Why is my app hitting the Unity Analytics endpoints if I have analytics disabled? 0 Answers
why unity IPA file size increased after installation as compare to unity APK? 1 Answer
I can change the iOS splash screen but I can't change the Android splash screen. Why? 0 Answers
Is PlayerPrefs still slow? 3 Answers