Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl client side authe using certicate

Status
Not open for further replies.

perlnewbie9292

Programmer
Jul 15, 2009
25
US
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
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?

Code:
#!/usr/bin/perl
use warnings;
use strict;
use Net::SSLeay qw(post_https);

my $$hostIp = "xx.xx.xx.xx"
my $hostPort = "8443"
my $postCommand = "";
my $http_method = 'plain/text';
my $path_to_crt7 = 'pathToCert.pem'; #using clientCerticate.pem is this correct?
my $path_to_key8 = 'pathToKey.pem';  #using clientCerticateKey.pem is this correct?


my ($page, $response, %reply_headers) =
        post_https($hostIp, $hostPort, $postCommand, '',
        $http_method, $path_to_crt7, $path_to_key8
);

print $page . "\n";
print $response . "\n";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top