无法连接到 TLS 1.2 安全邮箱服务器
我有一个简单的 C# 代码,尝试使用 Limilabs 电子邮件库访问 tls 安全邮箱服务器。
但我收到有关 Tls 1.2 的错误:
Authenticate as SSL/TLS client failed.
You might be connecting to non SSL/TLS port -or- using incorrect SSL/TLS version.
Consider using TLS 1.2: client.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;
Please examine the inner exception for details.
然而,在尝试访问安全邮箱服务器之前,我在代码中使用了 Tls 1.2:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault | SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12;
而且我已在 Windows 10 注册表中添加了这些密钥:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client\Enabled = 0x00000001
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client\DisabledByDefault = 0x00000000
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SchUseStrongCrypto = 0x00000001
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\SchUseStrongCrypto = 0x00000001
您有想法吗?
预先非常感谢。
埃里克.
I have a simple C# code that tries to access to a tls secured mail box server using Limilabs email library.
But I get an error about Tls 1.2 :
Authenticate as SSL/TLS client failed.
You might be connecting to non SSL/TLS port -or- using incorrect SSL/TLS version.
Consider using TLS 1.2: client.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;
Please examine the inner exception for details.
Yet I use Tls 1.2 in my code before trying to access the secured mail box server :
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault | SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12;
And I have added those keys in my Windows 10 registry :
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client\Enabled = 0x00000001
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client\DisabledByDefault = 0x00000000
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SchUseStrongCrypto = 0x00000001
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\SchUseStrongCrypto = 0x00000001
Do you have an idea ?
Thanks a lot in advance.
Eric.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Mail.dll 不使用
ServicePointManager
选择 SSL/TLS 协议版本。要强制使用特定协议,请使用客户端的
SSLConfiguration
属性:对于 IMAP,您的代码应如下所示:
对于 SMTP(Office365 需要显式 TLS/SSL - 连接后的 StartTLS 方法):
Mail.dll doesn't use
ServicePointManager
to select SSL/TLS protocol versions.To force specific protocol use client's
SSLConfiguration
property:For IMAP your code should look like this:
For SMTP (Office365 requires explicit TLS/SSL - StartTLS method after Connect):