Integrate AWS .NET SDK

I am try to integrate AWS S3 .NET SDK with Unity. But keep getting below error:

TlsException: Invalid certificate received from server. Error code: 0xffffffff80092012 Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 ()

My javascript code:

function Start (){
client = Amazon.AWSClientFactory.CreateAmazonS3Client(Conf.AWSAccessKey, Conf.AWSSecretKey);

var response:ListBucketsResponse = client.ListBuckets();

}

I have searching whole day and probably find the reason: “It turns out that Mono installs with no root certs, so by default Mono refuses to trust any SSL-protected web services. The Mono Security FAQ (Redirecting…) has a couple suggestions for how to handle the issue.”

I have tried below methods:

1 Reference

mcs am1.cs

mono am1.exe https://www.amazonaws.com

When I run compiled am1.exe, it gives me a lot of exception erros

2 Use the mozroots.exe tool to download and install all Mozilla’s root certificates.

C:\Program Files (x86)\Mono-2.6.7\lib\mono\1.0>mozroots --import --machine --sync

Although the output said the certs have successfully imported. But in Unity3D it still prompts “Invalid certificate received from server”

I have been working on this whole day and can’t get it solved, hope someone can help me. Thank you

Putting this in my Start() method worked for me (source)

System.Net.ServicePointManager.ServerCertificateValidationCallback
  = (a, b, c, d) => { return true; };

mcs am1.cs

I hope you were using mcs which comes with Unity? Cause if you were using mcs which comes from mono site, then it could be that you’ve used incorrect version. Unity uses Mono 2.6, while on official mono site, the latest version is Mono 2.10

Having the same problems you were and this worked for me.

su { mono user } → mozroots --import --sync