- Home /
AWS .net issue with iOS - ServicePointManager[tls/ssl]
I'm currently trying to access AWS S3 through a secure connection and I'm currently using the following callback to establish the connection:
public bool MyRemoteCertificateValidationCallback(System.Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
bool isOk = true;
// If there are errors in the certificate chain, look at each error to determine the cause.
if (sslPolicyErrors != SslPolicyErrors.None)
{
for (int i = 0; i < chain.ChainStatus.Length; i++)
{
if (chain.ChainStatus[i].Status != X509ChainStatusFlags.RevocationStatusUnknown)
{
chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain;
chain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0);
chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllFlags;
Debug.Log("apple is great...");
bool chainIsValid = chain.Build((X509Certificate2)certificate);
if (!chainIsValid)
{
isOk = false;
}
}
}
}
return isOk;
}
The method works find on the unity editor on macOS. However, it fails when the application is built for iPhone. I get the following error in xCode. Any suggestions?
A smiliar issue: https://answers.unity.com/questions/166097/aws-net-sdk-on-iphone.html
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
MissingMethodException: The method 'System.Void System.Configuration.ConfigurationManager::.cctor()' has no implementation. at System.Configuration.ConfigurationManager..cctor () [0x00000] in :0 at System.Net.ServicePointManager..cctor () [0x00000] in :0 at AwsController.RunAws () [0x00000] in :0 at InternetConnectionHandler+c__Iterator2.MoveNext () [0x00000] in :0 at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in :0 Rethrow as TypeInitializationException: The type initializer for 'System.Configuration.ConfigurationManager' threw an exception. at System.Net.ServicePointManager..cctor () [0x00000] in :0 at AwsController.RunAws () [0x00000] in :0
at InternetConnectionHandler+c_Iterator2.MoveNext () [0x00000] in :0 at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in :0 Rethrow as TypeInitializationException: The type initializer for 'System.Net.ServicePointManager' threw an exception. at AwsController.RunAws () [0x00000] in :0 at InternetConnectionHandler+c_Iterator2.MoveNext () [0x00000] in :0 at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in :0
(Filename: currently not available on il2cpp Line: -1)