perlnewbie9292 has asked for the wisdom of the Perl Monks concerning the following question:

Hello all, I'm having trouble getting the following code to work and at a point where I am stuck. I am trying to perform client side authentication using a certificate during a POST request. I'm only interested in sending the client cert to the server and don't really need to check the server certificate.

Here is the cUrl command that trying to replicate: curl --cacert caCertificate.pem --cert clientCerticate.pem -d "string" https://xx.xx.xx.xx:8443/postRf

I keep getting the following error in my Perl script: ssl handshake failure

I guess I have two questions: what should I be pointing to for CRT7 AND KEY8 variables? and is this the best way to send a POST request using client cert authentication?
!/usr/bin/perl use warnings; use strict; use Net::SSLeay qw(post_https); my $$hostIp = "xx.xx.xx.xx" my $hostPort = "8443" my $postCommand = "/postRf/string"; my $http_method = 'plain/text'; my $path_to_crt7 = 'pathToCert.pem'; my $path_to_key8 = 'pathToKey.pem'; my ($page, $response, %reply_headers) = post_https($hostIp, $hostPort, $postCommand, '', $http_method, $path_to_crt7, $path_to_key8 ); print $page . "\n"; print $response . "\n";

Replies are listed 'Best First'.
Re: ssl client authentication
by zentara (Cardinal) on May 15, 2012 at 15:06 UTC
    Here is the cUrl command that trying to replicate: curl --cacert caCertificate.pem --cert clientCerticate.pem -d "string" https://xx.xx.xx.xx:8443/postRf

    Have you thought about just using one of the Curl modules?


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh