Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: using Net SSLeay to send Client Certificate connect to remote host

by hippo (Bishop)
on Mar 03, 2020 at 13:49 UTC ( [id://11113703]=note: print w/replies, xml ) Need Help??


in reply to using Net SSLeay to send Client Certificate connect to remote host

Like haukex I wouldn't use such a low-level module by default. Here is an example using LWP::UserAgent and a known, public endpoint. Perhaps you can start from here and then modify to your needs?

#!/usr/bin/env perl use strict; use warnings; use LWP::UserAgent; use Data::Dumper; my $url = 'https://server.cryptomix.com/secure/'; my $keyfile = 'foo.key'; my $certfile = 'foo.cert'; my $ua = LWP::UserAgent->new ( ssl_opts => { SSL_cert_file => $certfile, SSL_key_file => $keyfile } ); my $res = $ua->get ($url); print $res->status_line; print $res->decoded_content;

This assumes that you have the RSA key in foo.key and the PEM client cert in foo.cert. You'll get lots of info back from that server.

Replies are listed 'Best First'.
Re^2: using Net SSLeay to send Client Certificate connect to remote host
by newperldeveloper (Sexton) on Mar 03, 2020 at 15:52 UTC
    Thanks this worked. I had this before but I was using IO::Socket module it should have worked but I will look into this a little more. I do not have a key file so I had to use
    my $ua = LWP::UserAgent->new ( ssl_opts => { SSL_cert_file => $certfile, SSL_passwd_cb => sub {$my_key}, } );
    I am new to perl and don't have to touch it often. Thanks
Re^2: using Net SSLeay to send Client Certificate connect to remote host
by newperldeveloper (Sexton) on Mar 03, 2020 at 14:28 UTC
    Thanks I will give this a shot. I tried this earlier but it did not work. I kept getting errors. I will do a post here to show results.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-19 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found