AWS S3 .NET SDK
我正在使用 Unity3D,并尝试使用 S3 .NET SDK。但不断出现以下错误:
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 ()
我的 javascript 代码:
function Start()
{
client = Amazon.AWSClientFactory.CreateAmazonS3Client(Conf.AWSAccessKey, Conf.AWSSecretKey);
var response : ListBucketsResponse = client.ListBuckets();
}
我搜索了一整天,可能找到了原因:
事实证明 Mono 安装时没有根证书,因此默认情况下 Mono 拒绝信任任何受 SSL 保护的 Web 服务。 Mono 安全常见问题解答 对于如何处理该问题有一些建议。”
我有尝试了以下方法:
- <前><代码>mcs am1.cs 单声道 am1.exe https://www.amazonaws.com
当我运行编译的 am1.exe 时,它给了我很多异常错误
使用mozroots.exe工具下载并安装所有Mozilla的根证书。
C:\Program Files (x86)\Mono-2.6.7\lib\mono\1.0>mozroots --import --machine --sync
尽管输出表示证书已成功导入。但在Unity3D中仍然提示“从服务器收到无效证书”
我已经为此工作了一整天,但无法解决它,希望有人能帮助我。
I am using Unity3D, and have try to use S3 .NET SDK. 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 searched a whole day and probably found 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 has a couple suggestions for how to handle the issue."
I have tried below methods:
mcs am1.cs mono am1.exe https://www.amazonaws.com
When I run compiled am1.exe, it gives me a lot of exception errors
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 the whole day and can't get it solved, hope someone can help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当无法验证证书是否已吊销时,会出现0x80092012。
从版本 2.8 开始,Mono 将默认为 X509RevitationMode.NoCheck,除非设置了 MONO_X509_REVOCATION_MODE 环境变量(在这种情况下,它将检查证书存储区中的 CRL)。
我不知道你的 Unity3D 版本相对于 Mono 来说有多新。但是,您应该能够使用 ICertificatePolicy 或 ServicePointManager.ServerCertificateValidationCallback 来解决此问题。如果0x80092012错误代码来自颁发给亚马逊的证书,则只需忽略它即可。
0x80092012 occurs when the certificate could not be verified for revocation.
Since version 2.8, Mono will default to X509RevocationMode.NoCheck unless the MONO_X509_REVOCATION_MODE environment variable is set (in this case it will check for CRLs inside the certificate stores).
I don't know how recent is your version of Unity3D wrt Mono itself. However you should be able to use ICertificatePolicy or ServicePointManager.ServerCertificateValidationCallback to work around this issue. Simply disregard the 0x80092012 error code if it comes from a certificate issued to Amazon.
因此,在与远程服务器建立 HTTPS 连接(通过 WebRequest、WebServices 或其他)之前,只需调用:
Enjoy
So before establishing HTTPS connection (either via WebRequest, WebServices or other) to remote server just call:
Enjoy
如果您在 Mono 中使用 ASP,则需要使用用户 www-data 下载并安装 Mozilla 的根证书
If you are using ASP for in mono, you need download and install the Mozilla's root certificates with the user www-data