Hi!

I've been trying to get an all-TLSv1 session set up with a very finicky server and have had no luck getting the handshake to go through. I've had some limitied luck using this:

if(!($sock = IO::Socket::SSL->new( PeerAddr => 'localhost', PeerPort => '444', Proto => 'tcp', SSL_version => 'TLSv1'))) { exit(0); }

I can get an open socket, but I wanted all the fancy POST capabilities of LWP and HTTP::Request::Common. I've been trying to get things working using the following, but end up with handshake failures.

$ENV{HTTPS_VERSION} = 3; $ENV{HTTPS_DEBUG} = 1; # Variables for the URL retrieving my $ua = new LWP::UserAgent; $ua->cookie_jar($cookie_jar); my $res; my $post = POST $url, \%form; $post->authorization_basic('_api_', $key); print $post->content . "\n"; $res = $ua->request( $post );

Using ssltap, I see these handshake failures coming back.

Connection #194 [Wed Nov 9 11:31:43 2011] Connected to localhost:443 --> [ recordLen = 108 bytes (108 bytes of 108) [Wed Nov 9 11:31:43 2011] [ssl2] ClientHelloV2 { version = {0x03, 0x01} cipher-specs-length = 81 (0x51) sid-length = 0 (0x00) ... ] <-- [ (7 bytes of 2) SSLRecord { [Wed Nov 9 11:31:43 2011] type = 21 (alert) version = { 3,1 } length = 2 (0x2) fatal: handshake_failure } ]

Any idea what's going on? I'm assuming it's getting dropped based on the ClientHelloV2, as it's not v3 with TLS.

Thanks!

-nate


In reply to Forcing all TLSv1 with LWP? by AmishPhysicist

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.