I'm having trouble accessing a web-page that requires a certificate. The page is actually a SOAP web-service but once I installed the .pfx certificate into Firefox then if I simply enter the URL it comes up with some technical info.

To test out my Perl code certificate handling I tried to access this same page using LWP::UserAgent but I'm getting error messages. From what I can tell the certification is OK (I translated the .pfx file to .pem certificate & key using OpenSSL) but I'm at a bit of a loss as to what the issue is and what to try next.

#!/usr/bin/perl use warnings; use strict; use IO::Socket::SSL qw(debug4); use LWP::UserAgent; my $url = 'https://xxxxx.xxxxx.com/xxxx/Cms.asmx'; my $ua = LWP::UserAgent->new; $ua->ssl_opts( SSL_use_cert => 1, verify_hostname => 0, SSL_cert_file => "BW_cert.pem", SSL_key_file => "BW_key.pem" ); my $response = $ua->get( $url ); if ($response->is_success) { print $response->decoded_content; } else { die $response->status_line; }

The output that I get is as follows:

DEBUG: .../IO/Socket/SSL.pm:1482: new ctx 42693424 DEBUG: .../IO/Socket/SSL.pm:334: socket not yet connected DEBUG: .../IO/Socket/SSL.pm:336: socket connected DEBUG: .../IO/Socket/SSL.pm:349: ssl handshake not started DEBUG: .../IO/Socket/SSL.pm:392: Net::SSLeay::connect -> 1 DEBUG: .../IO/Socket/SSL.pm:447: ssl handshake done DEBUG: .../IO/Socket/SSL.pm:1213: SSL read errorerror:140940E5:SSL rou +tines:SSL3_READ_BYTES:ssl handshake failure DEBUG: .../IO/Socket/SSL.pm:1519: free ctx 42693424 open=42693424 DEBUG: .../IO/Socket/SSL.pm:1527: OK free ctx 42693424 500 Status read failed: at testUA.pm line 29.

In reply to Perl Certificate Problems for Accessing Web-page by agnome

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.