我在Ubuntu 16.04.2 LTS上运行Mono(版本4.2.1)代码;该代码尝试使用Amazon SES发送电子邮件失败。从其他搜索中我读到错误是由于证书不存在于单一信任存储中。修复此问题的命令是: mozroots --import --ask-remove
接下来是:
certmgr -ssl smtps://email-smtp.eu-west-1.amazonaws.com:587
(因为email-smtp.eu-west-1.amazonaws.com是我使用的SMTP服务器;在端口587上)
第一个命令工作正常,并将162个证书导入我的商店。 第二个命令失败并出现异常。我究竟做错了什么?
这是堆栈跟踪:
Unhandled Exception:
System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
at Mono.Security.Protocol.Tls.RecordProtocol.EndReceiveRecord (IAsyncResult asyncResult) <0x402e7020 + 0x00132> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (IAsyncResult ar, Boolean ignoreEmpty) <0x402e6f50 + 0x00031> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (IAsyncResult result) <0x402e3aa0 + 0x00225> in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) <0x402e7cf0 + 0x000ec> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) <0x402e7a40 + 0x0007f> in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.EndNegotiateHandshake (Mono.Security.Protocol.Tls.InternalAsyncResult asyncResult) <0x402e1190 + 0x0007b> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.NegotiateHandshake () <0x402da8b0 + 0x000b6> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.Write (System.Byte[] buffer, Int32 offset, Int32 count) <0x402da4d0 + 0x000af> in <filename unknown>:0
at System.IO.StreamWriter.Flush (Boolean flushStream, Boolean flushEncoder) <0x7f07ce354da0 + 0x000fa> in <filename unknown>:0
at System.IO.StreamWriter.Flush () <0x7f07ce354d70 + 0x0001f> in <filename unknown>:0
at Mono.Tools.CertificateManager.GetCertificatesFromSslSession (System.String url) <0x402a43e0 + 0x00357> in <filename unknown>:0
at Mono.Tools.CertificateManager.Ssl (System.String host, Boolean machine, Boolean verbose) <0x402a39f0 + 0x0013a> in <filename unknown>:0
at Mono.Tools.CertificateManager.Main (System.String[] args) <0x4029ed70 + 0x004f0> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
at Mono.Security.Protocol.Tls.RecordProtocol.EndReceiveRecord (IAsyncResult asyncResult) <0x402e7020 + 0x00132> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (IAsyncResult ar, Boolean ignoreEmpty) <0x402e6f50 + 0x00031> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (IAsyncResult result) <0x402e3aa0 + 0x00225> in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) <0x402e7cf0 + 0x000ec> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) <0x402e7a40 + 0x0007f> in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.EndNegotiateHandshake (Mono.Security.Protocol.Tls.InternalAsyncResult asyncResult) <0x402e1190 + 0x0007b> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.NegotiateHandshake () <0x402da8b0 + 0x000b6> in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.Write (System.Byte[] buffer, Int32 offset, Int32 count) <0x402da4d0 + 0x000af> in <filename unknown>:0
at System.IO.StreamWriter.Flush (Boolean flushStream, Boolean flushEncoder) <0x7f07ce354da0 + 0x000fa> in <filename unknown>:0
at System.IO.StreamWriter.Flush () <0x7f07ce354d70 + 0x0001f> in <filename unknown>:0
at Mono.Tools.CertificateManager.GetCertificatesFromSslSession (System.String url) <0x402a43e0 + 0x00357> in <filename unknown>:0
at Mono.Tools.CertificateManager.Ssl (System.String host, Boolean machine, Boolean verbose) <0x402a39f0 + 0x0013a> in <filename unknown>:0
at Mono.Tools.CertificateManager.Main (System.String[] args) <0x4029ed70 + 0x004f0> in <filename unknown>:0
答案 0 :(得分:0)