Sending a client certificate to a SOAP server using Soap::Lite

Viewed 156

I have a .p12 certificate file (PKCS#12), which I've convert to PEM format and I'm trying to send it to the server to prove I yam what I yam. I'm using SOAP::Lite. The support folks at the service I'm trying to access say the certificate isn't being sent. Can you pinpoint what I might be doing wrong?

We've been able to succeed using a powershell script, but only by sending the .p12 file and a password, so I'm not sure whether the issue is the certificate format or the way I'm trying to send it. Here's the program (service, passwords and stuff munged for security). So question #2 is, are there any options for sending a .p12 formatted x509 cert and password?

Thanks in advance!

use strict vars;
use strict subs;
use warnings;
use feature 'say';
use SOAP::Lite 'trace', 'debug';
use XML::Twig;
use XML::LibXML;

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
my $proxy = "https://wxyzervices.service.com/los/webservice/AuthService.asmx";
my $uri = "http://www.thing.com/los/wxyzervices/";

my $soap = SOAP::Lite
            -> proxy($proxy, ssl_opts=> {
                 SSL_cert_file => '/scripts/data/lqbcert/mydata.pem',
                 SSL_key_file => '/scripts/data/lqbcert/mydata.key.pem',
                }
            );
$soap->default_ns($uri);

# Tricky stuff necessary for working with .NET SOAP server.

$soap->on_action( sub { sprintf '%s%s', @_});


my $ticket = $soap->call(
    SOAP::Data->name('GetUserAuthTicket')->attr({xmlns => $uri}),
    SOAP::Data->name('userName')->value('MyName')->type(''),
    SOAP::Data->name('passWord')->value('MyPassword')->type(''));

if ($ticket->fault)
{
    print "\nERROR:\n";
    print join(', ', ($ticket->faultcode, $ticket->faultstring, $ticket->faultdetail));
}

else
{
    print "Ok? \n";
    Dumper($ticket);
}
0 Answers
Related