C# - “身份验证或解密失败。”的错误,而在单用twitterizer(c# - “The aut

2019-07-29 14:14发布

为什么我得到这个错误

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

我使用twitterizer和Mono 2.6在它.NET 4.0运行Linux操作系统。 我曾尝试这个代码与Visual Studio在我的窗户,和完美。 但是当我试图用单打造它,我得到这个错误。 这里是我的代码:

static void Main(string[] args)
{
    string requestToken = OAuthUtility.GetRequestToken("my consumer key", "my consumer secret", "oob").Token;
}

Answer 1:

我有同样的问题,所以简单地说话时,我选择使用进口的所有证书

mozroots --import --ask-remove 

现在我可以与Twitter登录



Answer 2:

参见Mono项目维基 :

  • FAQ安全的SSL / TLS; 和

  • 使用受信任的根恭敬地文章

他们会告诉你如何增加你的系统(用户)以及如何最好地使用自己的应用程序(开发商)内这种情况处理上缺少的X.509证书。



Answer 3:

适用于单声道和vNext KVM的设置太 - 否则你不能做

kpm restore -s https://www.myget.org/F/aspnetvnext/

非常感谢您的提示!



Answer 4:

从单声道的文件:

请注意,如果您使用的是Web应用程序(即不是当前用户),您必须添加--machine选项是这样的:

mozroots --import --ask-remove --machine

*您可能要与运行这个sudo



文章来源: c# - “The authentication or decryption has failed.” error while using twitterizer in mono