I've created a network XML service that needs SSL encryption. Since it's socket based I wanted to use IO::Socket:SSL (instead of INET), but I have problems:

When I run:

$sock = new IO::Socket::SSL (
Listen => 5,
LocalAddr => 'localhost',
LocalPort => 9000,
Proto => 'tcp',
SSL_verify_mode => 0x01
) or die "unable to create socket: $!\n";

I get the error message 'No such file or directory'. I assume that it means it can't find the certificate or the key.

(I got this code from Jukka Juslins paper on his work at CERN (http://elan.cs.hut.fi:9090/erikoistyo.html).)

I have created the certificate and the key with openssl and put them both in certs/ and in @INC's path to IO::Socket::SSL but there's no difference.

I've also put in an 'init_context' before the above command:

IO::Socket::SSL::context_init (
SSL_use_cert => 1,
SSL_key_file => 'certs/server-key.pem',
SSL_cert_file => 'certs/server-cert.pem'
);

But then I get the error message:
Can't use string ("SSL_use_cert") as a HASH ref while "strict refs" in use at /usr/local/lib/perl5/site_perl/5.6.1/IO/Socket/SSL.pm line 684.

If soneone has successfully used IO::Socket:SSL (without LWP), I would appreciate a few pointers to get me going.

Thanks
kebex


In reply to IO::Socket:SSL 'No such file or directory' by kebex

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.