0

I am working on Monodroid. I have added a Dropnet DLL (I have compiled it in Monodevelop).

I am trying to retrieve account info, below is my code

DropNetClient _client;
string dropbox_appkey = "XXX";
string dropbox_appsecret = "XXXX";
_client = new DropNetClient(dropbox_appkey, dropbox_appsecret);
_client.UserLogin = new DropNet.Models.UserLogin { Token = "XXX", Secret = "XXXX" };
var accountInfo = _client.AccountInfo();

I am getting error when the below code gets executed

return (HttpWebResponse)request.GetResponse();

error received is:

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 :0 at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in :0 at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in :0 at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in :0 at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in :0 --- End of inner exception stack trace --- at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in :0 --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in :0 at System.Net.HttpWebRequest.GetResponse () [0x00000] in :0 at RestSharp.Http.GetRawResponse (System.Net.HttpWebRequest request) [0x00002] in e:\sujit\development\try5\restsharp-RestSharp-eef0c86\RestSharp\Http.Sync.cs:170

When I run URL in browser which is something like this:

https://api.dropbox.com/1/account/info?oauth_consumer_key=XXXX&oauth_nonce=3064850&oauth_signature_method=PLAINTEXT&oauth_timestamp=1347899148&oauth_token=XXXX&oauth_version=1.0&oauth_signature=XXX%26XXX

I get proper response like this:

{"referral_link": "https://www.dropbox.com/referrals/XXXX", "display_name": "XXX XXX", "uid": XXXX, "country": "IN", "quota_info": {"shared": XXX, "quota": XXXX, "normal": XXXX}, "email": "[email protected]"}

My question is why am I getting strange error using Monodroid Emulator ( I am using Monodevelop version 3.0.4.6 and I am testing on API_10 EMulator.

What should I do?

Note:

Just to add, using Authentication token of dropbox obtained by authenticating it in desktop application. I think we can reuse token of a user which uses our Desktop application for a Mobile application. Right?

2
  • I'd suggest you need to rethink how you're approaching all this. This is the third question on the same thing you're attempting. Perhaps try Google first instead of StackOverflow. By the way, entering the first line of your error into Google provides the cause and some solution options inside the first couple of results.
    – manadart
    Sep 18, 2012 at 7:46
  • Hi, sorry to bother you, but i searched google a lot, none of the solutions work. And as I didn't any reply, i posted another question. Sep 18, 2012 at 15:12

1 Answer 1

1

I had a similar problem using RestSharp with Mono for Android. The cause was an invalid certificate for the development environment. I was using a static IP address (192.168.1.122) for the domain so that my phone could connect with a web service on my development machine. You can override this by adding the following line somewhere before making the web request:

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
2
  • This workaround is only acceptable for your own hacked up development environment. A change like this should never be checked in, and absolutely must never appear in shipping code, as it defeats most of the protections provided by HTTPS. Jan 12, 2013 at 15:42
  • @AndrewArnott I figured the terms "development environment" and "development machine" made that obvious, but maybe you're right and people have to be hit over the head.
    – Mark
    Jan 16, 2013 at 21:22

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.