pjsmith has asked for the wisdom of the Perl Monks concerning the following question:
I can handle all of the other pages with LWP::UserAgent. As far as I can tell, Net::SSLeay and Crypt::SSLeay are the modules that can handle certificates. Since Net::SSLeay is not an LWP module, I'd like to use Crypt::SSLeay if possible.
According to the documentation for Crypt::SSLeay, this is how you include PEM encoded certificate and private key files:
$ENV{HTTPS_CERT_FILE} = 'cert.pem'; $ENV{HTTPS_KEY_FILE} = 'key.pem';
It looks like the PEM files that I have aren't being loaded, because when I use nonexistent filenames, it doesn't give me any errors.
Here's a snippet of the code I'm using to make my request:
my $cookie_jar = HTTP::Cookies->new; my $ua = new LWP::UserAgent; if ( $proxy ne "" ) { $ua->proxy(['http', 'https'], $proxy); } my $request = new HTTP::Request("POST", $url); $request->content_type('application/x-www-form-urlencoded'); $request->content($content); $ua->agent("Mozilla/4.7"); $cookie_jar->add_cookie_header($request); my $response = $ua->request($request); $cookie_jar->extract_cookies($response);
$content is the data that I'm posting (user name and password). Of course, I've set $url to the URL I'm trying to post to, and $proxy is the proxy server. With a little bit of extra code to handle timeouts, this is the same code that I've used for other POSTs.
I've got OpenSSL version 0.9.6b installed, all the latest versions of the LWP modules, and version 0.29 of Crypt::SSLeay.
Am I using Crypt:SSLeay correctly? Do I need to add code to my request? Or should I be using Net:SSLeay, or some other module?
Thanks in advance.
P.J.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sending a certificate with an https request
by shotgunefx (Parson) on Jul 27, 2001 at 03:57 UTC | |
Re: Sending a certificate with an https request
by Anonymous Monk on Jul 27, 2001 at 10:25 UTC | |
Re: Sending a certificate with an https request
by pjsmith (Monk) on Jul 27, 2001 at 19:01 UTC |