Executing a WP7 POST request with an untrusted certificate?

I am working on a Windows Phone 7 application that calls a REST service call. The third party hosting the web services has an invalid certificate in the current environment. When I hit the URL in Firefox, I get a certificate warning and they ask me if I want to continue. I also use the Poster FF extension to verify the call. It works with a poster if I first accept an invalid certificate in Firefox. If I do not, POSTER will not make a request.

In my WP7 emulator, I cannot complete the request at all. I get 404 in the EndGetResponse method. I am making the same request as in Poster, so I know that there is nothing wrong with the request. I successfully hit another web service using the same code (no certificates), so I don't think this is code. The only thing I can think of is that WP7 does not allow requests for an invalid certificate. Has anyone had experience in this situation? Is there any way around this?

Is there a way that I can say that my application accepts all messages even if there is an invalid certificate?

+3
source share
3 answers

Unfortunately, there is no way to do this by telephone. Usually, that is, on the desktop, this simple line of code disables certificate verification.

System.Net.ServicePointManager.ServerCertificateValidationCallback = (se, cert, chain, sslError) => { return true; }; 

If you look at the ServicePointManager on the phone, there is no callback to connect. This is a huge pain at the airport.

Did you think that you are contacting the owner of the service and asking why they are bad Internet citizens? (essentially, what you see here is security on the Internet, for better or worse)

As Matt says, you can program a simple relay on a web server. This should not be a special service, but maybe just a web page that makes a call and spills out RAW or XML text. Your phone client will simply GET this page and manually select the answer.

Where there will be a way.

Luke

+1
source

You need to install the root CA certificate of the issuer on the phone.

You can do this by sending RootCA to the phone user. They click on the attachment and he will ask them to ask if they want to install the certificate on the phone.

Once you do, your requests should go through.

I do not believe that there is a way to do this programmatically in your application.

+1
source

I do not know how to install additional certificates on the phone.

In this situation, I would create a proxy service between your application and a third-party site and ask for its application. If you need, you can put a proxy server for a valid certificate.

0
source

All Articles