Sending a certificate with Android?

I've been using CURL and php to send the following:

$ch = curl_init($url);
curl_setopt_array($ch, array(
    CURLOPT_POST => count($postfields),
    CURLOPT_POSTFIELDS => $postfields,
    CURLOPT_SSL_VERIFYPEER => false,  
    CURLOPT_SSL_VERIFYHOST => 2,
    CURLOPT_VERBOSE => true,    
    CURLOPT_SSLCERT => 'C:\mycert.pem',
    CURLOPT_SSLCERTPASSWD => 'mypass', 
    CURLOPT_SSLCERTTYPE => 'PEM'
));

I've not included the postfields to keep it brief.

This works very well. However after much googling I can't find a simple way to do this using HTTPClient. I just want to include a certificate with the POST.

TIA

Answers


You need to create a trust store containing your certificate.

My blog post at http://blog.chariotsolutions.com/2013/01/https-with-client-certificates-on.html contains a little more than you need (it includes supporting self-signed client and server certs), but should give you everything you need.


Need Your Help

UnicodeEncodeError with csvwriter

python

I have one more error to fix.

CLLocationManager Disable use of the location by the application

ios cocoa-touch core-location cllocationmanager

I have a switch for the user to disable / enable the use of the location by the application. I am having two problems.