Question

I have a website that I need to download files from. The website requires a digital certificate which I have. I have a p12 file that the site provided which is very easy to import into Windows which allows access to the site. What I want to do is download a bunch of csv files from the site and parse them.

I found the Net::SSLeay and Crypt::SSLeay packages. I also see that LWP::Useragent has mention of SSL but I'm not sure if that is sufficient for what I'm trying to do.

So basically I need to know where to get started and which packages will be the easiest to use for this purpose.
I am running windows 7 with strawberry perl 5.16.2

Was it helpful?

Solution 2

Providing you have your P12 converted into PEM format, you can use:

use Mojo::UserAgent;
my $url = 'https://some.site.com/path/to/file.zip';
my $ua = Mojo::UserAgent->new( max_redirects=>5, 
                               cert=>'client_cert.crt.pem', 
                               key=>'client_cert.key.pem' );
$ua->get($url)->res->content->asset->move_to('downloaded_file.zip');

If you are using strawberry perl you need first to install Mojo::UserAgent module like this:

c:\> cpan -i Mojo::UserAgent

OTHER TIPS

Convert the PKCS #12 certificate to PEM format with the help of the openssl pkcs12 command. Install LWP::Protocol::https. Set the SSL_ca_file parameter to point to the PEM file.

From this post it looks like to me that openssl supports 64bit linux since 2006:

http://www.mail-archive.com/openssl-users@openssl.org/msg47285.html

It could be possible to install it on Windows 64bit How do you compile OpenSSL for x64?

So it is definitly possible to install it on linux. Please give us the error you have got.

Regards,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top