Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: How to convert curl authentication method to perl (client certificate)

by hippo (Bishop)
on Feb 28, 2020 at 16:53 UTC ( [id://11113551]=note: print w/replies, xml ) Need Help??


in reply to How to convert curl authentication method to perl

SSL_ca_file is for specifying the CA cert file. You want instead to specify your Client cert file and key. Take a look at the SSL_cert_file section of https://metacpan.org/pod/IO::Socket::SSL for some examples and try taking it from there.

  • Comment on Re: How to convert curl authentication method to perl (client certificate)
  • Download Code

Replies are listed 'Best First'.
Re^2: How to convert curl authentication method to perl (client certificate)
by newperldeveloper (Sexton) on Feb 28, 2020 at 19:27 UTC
    Here is what I have so far and the error I have encountered.
    my $client = IO::Socket::SSL->new( # where to connect PeerHost => "example/gettoken", PeerPort => "https" SSL_cert_file => $cert_file, # typical CA file on BSD SSL_passwd_cb => sub {"secret_key"}, ) or die "failed connect or ssl handshake: $!,$SSL_ERROR"; # send and receive over SSL connection print $client "GET / HTTP/1.0\r\n\r\n"; print <$client>;
    The above code give an error failed connect or ssl handshake: Invalid argument,IO::Socket::IP configuration failed When I comment out peerhost and port I nothing happens. Not sure what to do next. When I print dumper is outputs $VAR1 = bless( \*Symbol::GEN0, 'IO::Socket::SSL' ); Any help is greatly appreciated.
      PeerHost => "example/gettoken"

      This does not look right. PeerHost should be a hostname, not some URL or whatever you think example/gettoken is.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11113551]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 16:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found