[英]c# - “The authentication or decryption has failed.” error while using twitterizer in mono
why i get this error 为什么我得到这个错误
Unhandled Exception: Twitterizer.TwitterizerException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at Twitterizer.WebRequestBuilder.ExecuteRequest () [0x00000] in <filename unknown>:0
at Twitterizer.OAuthUtility.GetRequestToken (System.String consumerKey, System.String consumerSecret, System.String callbackAddress) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Twitterizer.OAuthUtility.GetRequestToken (System.String consumerKey, System.String consumerSecret, System.String callbackAddress) [0x00000] in <filename unknown>:0
at terminal_twitt.Program.Main (System.String[] args) [0x00000] in /home/julio/Projects/terminal-twitt/terminal-twitt/Program.cs:18
[ERROR] FATAL UNHANDLED EXCEPTION: Twitterizer.TwitterizerException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at Twitterizer.WebRequestBuilder.ExecuteRequest () [0x00000] in <filename unknown>:0
at Twitterizer.OAuthUtility.GetRequestToken (System.String consumerKey, System.String consumerSecret, System.String callbackAddress) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Twitterizer.OAuthUtility.GetRequestToken (System.String consumerKey, System.String consumerSecret, System.String callbackAddress) [0x00000] in <filename unknown>:0
at terminal_twitt.Program.Main (System.String[] args) [0x00000] in /home/julio/Projects/terminal-twitt/terminal-twitt/Program.cs:18
The application was terminated by a signal: SIGHUP
i use twitterizer and mono 2.6 for linux with .NET 4.0 runtime in it. 我使用twitterizer和mono 2.6 for linux with .NET 4.0 runtime。 i have tried this code with visual studio in my windows, and worked perfectly. 我已经在我的窗口中使用visual studio尝试了这个代码,并且工作得很好。 but when i tried to build it with mono i get this error. 但当我试图用单声道构建它我得到这个错误。 here is my code: 这是我的代码:
static void Main(string[] args)
{
string requestToken = OAuthUtility.GetRequestToken("my consumer key", "my consumer secret", "oob").Token;
}
I had the same problems so simply talking i choose to import all certificates using 我有同样的问题所以简单地说我选择使用导入所有证书
mozroots --import --ask-remove
and now I can login with twitter 现在我可以用twitter登录了
See the Mono project wiki : 查看Mono项目维基 :
FAQ Security on SSL/TLS; 常见问题解答 SSL / TLS的安全性 ; and 和
Using Trusted Roots Respectfully article 恭敬地使用Trusted Roots文章
They will show you how to add the missing x.509 certificates on your system (users) and how to best deal with such situations inside your own application (developers). 他们将向您展示如何在您的系统(用户)上添加缺少的x.509证书,以及如何在您自己的应用程序(开发人员)中最好地处理此类情况。
Works for setup of kvm with mono and vNext too - otherwise you can't do 也适用于使用mono和vNext设置kvm - 否则你无法做到
kpm restore -s https://www.myget.org/F/aspnetvnext/
Many thanks for the tip! 非常感谢小费!
From mono's documentation: 来自mono的文档:
Note that if you are using a web application (ie not the current user) you must add the --machine option like this: 请注意,如果您使用的是Web应用程序(即不是当前用户),则必须添加--machine选项,如下所示:
mozroots --import --ask-remove --machine
*you might want to run this with sudo
*你可能想用sudo
运行它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.