c# - "The authentication or decryption has failed." error while using twitterizer in mono

13,526

Solution 1

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

Solution 2

See the Mono project wiki:

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).

Share:
13,526

Related videos on Youtube

Julio Abdilla
Author by

Julio Abdilla

Updated on July 11, 2022

Comments

  • Julio Abdilla
    Julio Abdilla almost 2 years

    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. i have tried this code with visual studio in my windows, and worked perfectly. 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;
    }
    
    • skolima
      skolima almost 12 years
      Please start with trying out Mono 2.10.8, not the 3 year old version.
  • Ricky Smith
    Ricky Smith almost 12 years
    Do this. Also, I haven't personally tested Twitterizer with mono, but I've relied heavily on mono users to debug, report issues, and submit patches. Please do the same.
  • MushroomSoda
    MushroomSoda almost 12 years
    Same as below mozroots --import --ask-remove will add mozilla's default trusted certificates to mono's local trusted certificate list.
  • David
    David about 11 years
    This fixed the problem for me
  • Palani
    Palani about 11 years
    It fixed the problem for me, can you please explain, what the statement do ? What is its relation with mono ?
  • Vova Bilyachat
    Vova Bilyachat about 11 years
    @Palani It import ssl certificates into mono repository
  • rr-
    rr- over 10 years
    Worked for me as well.
  • Muhammad Hewedy
    Muhammad Hewedy about 10 years
    This also helped me when using "MonoDevelop 4.x" with .NET 4.5 accessing Parse.com ... +1
  • Axel
    Axel almost 10 years
    This worked for me too. For anyone wondering, mozroots is a program bundled in mono and the answer itself is what you're supposed to write in the terminal
  • Cristiano Araujo
    Cristiano Araujo over 8 years
    It solved my problem with nuget packages not downloading if it's worth for anyone.
  • Abdul Saleem
    Abdul Saleem over 8 years
    Just wanna say. I Love you.. I was absolutely lost.