If you want to access URIs that use the https protocol via Perl you need to install SSL support. ActiveState's repository has no SSL Perl module(s) available so you can't install it using the default settings with ppm. A solution is to use the excellent Perl repository of the University of Winnipeg.
Read the rest of HTTPS protocol with ActiveState Perl.
Thanks for link to perl SSL. Was able to get scripts to work with SSL urls in minutes with ActiveState perl.
I'm having trouble with this... I'm on an XP machine, so perhaps that's it...
I'm using ActiveState Perl 5, build 881 running on an XP professional system.
I was able to install the SSL module as described, except the order of file installation was a little different (probably no big deal) and this:
A copy of the needed library ssleay32.dll was found in
C:\WINDOWS\system32. If this is compatible with the version
(0.9.7g) used to compile the Perl module, all that is needed
to complete the installation is to ensure
C:\WINDOWS\system32 is in your PATH environment variable.
Fetch ssleay32.dll? [no]
Aborting download of ssleay32.dll.
Successfully installed Crypt-SSLeay version 0.51 in ActivePerl
5.8.6.811.
It never prompted me to do anything, it just stopped. I exited ppm and ran the test script you provided. Instead of giving the Perl errors, I get a popup error that says:
The ordinal 3212 could not be located in the dynamic link library
LIBEAY32.dll
I downloaded the DLLs provided and tried to see if that would work, no joy. I've thrice-checked my PATH to make sure it's correct and it is.
Any ideas?
Thanks -mike
I got it to work! Yes... 20 seconds AFTER emailing you. heh. Anyway, I replaced the version of the DLL files I had with the ones you provide for download and it worked.
Thanks, sorry to bug you =] -mike
No worries Mike. I leave your first post here in case other users encounter this problem as well.
By the way, I don't provide the download, I just wrote the how to.
Hi John,
I'm having problems getting the https example to work. I am trying to connect to www.helsinki.fi through a proxy. connecting to the proxy is ok but I get the following error message.
"500 SSL negotiation failed"
I have been hunting around the net trying to find a solution without success.
Great! Does this also make HTTP::Daemon support SSL connections? Because that is what I need.
I am also having a problem with the Crypt-SSLeay module on Window XP Professional as well runing ActiveState Perl 5.8.7.813. I am able to download and install the Crypt-SSLeay module from uwinnipeg and install the dlls in the /Perl/bin directory. However, when I run the perl script, I get the "Ordinal Not Found" popup box that says "The ordinal 3212 could not be located in the dynamic link library LIBEAY32.dll." Once I click OK, the script runs normally. This would be acceptable if I was always running the script from the command line but I intend to make the script automated and this behavior might make that impossible.
I have checked my path and c:\Perl\bin is the first thing in it. Can you let me know if there is something else I can do to solve this problem?
Thanks! Collin
Hi all,
I have one problem,please help me out. I am not able to understand ,how one can post the https page.Getting the https page is fine,it is working. Can you just let me know wt modules are required and what is the syntax for the post operation.
Regards, Chirag
I just fixed the "Ordinal 3212" problem on my XP machine.
(1) I did a search for all occurrences of LIBEAY32.DLL and SSLEAY32.DLL. Some were in C:\i386, others in C:\Windows\System32, and still others in C:\Perl\bin.
(2) I renamed the DLLs found in C:\i386 and in C:\Windows\System32 to remsuffix_LIBEAY32.DLL and remsuffix_SSLEAY32.DLL so that only the DLLs in C:\Perl\bin would be loaded. (Rename is safer than delete, but if you're an optimist, I suppose you could delete rather than rename.)
I did not see an error message about "Ordinal 3212" when I installed Crypt-SSLeay, however I did get serveal warnings during the install...
A copy of the needed library ssleay32.dll was found in C:\WINDOWS\system32. If this is compatible with the version (0.9.7g) used to compile the Perl module, all that is needed to complete the installation is to ensure C:\WINDOWS\system32 is in your PATH environment variable.
I saw a simimar message for libeay32.dll. When I ran the test script, I kept getting messages that Crypt:SSLeay was not installed. So aparently the pre-existing ssleay32.dll and libeay32.dll were there from some other program that I had already installed and were *not* compatible with ActiveState Perl. Once I renamed the two files located C:\WINDOWS\system32, the proper DLLs located in my Perl directory were getting called and my Perl scripts started working. The $64 question now is, I wonder what program I just broke by renaming the two DLLs in C:\WINDOWS\system32.
Hi,
Thanks for the instructions, however I am having trouble getting the example script to work.
I have a XP machine, and when I run the script I get the following error: Failed to GET 'https://www.helsinki.fi/':500 Connect failed: connect: Unknown error;
I have changed the code slightly and inserted the following before the $ua->get()
$ua->env_proxy;
$ua->proxy( 'http' , 'http://<my proxy address>:<my proxyport>' );
Thanks in advance for any help.
Pubs
I am having problems connecting to Helsinki using this package. I'm trying to test connecting to the https://www.helsinki.fi page via a proxy. I am able to reach an http://google.com just fine.
The error message I get is:
HTTP Error: 500 Can't connect to www.helsinki.fi:443 (Bad hostname 'www.helsinki.fi')
Hi, I followed the instruction to rename the libeay32.dll and ssleay32.dll every where except in /perl/bin. I also follow instruction posted by Spunk to set env_proxy And I still have errors 500 connect: unkown error 500 SSL negotiation failed
Please help,
Thanks, Hoang
Thanks for posting the instructions for getting this up and running (we'll see if they work on my system!). The only remaining question for the moment is why in jeebus' name ActiveState doesn't provide this support.
Cheers,
---Michael B.
Great! Once I renamed the DLL's in c:\windows\system32 it worked fine.
Thanks!
Wim.
Hey guys,
I'm having the same (or similar) problem as another poster. I get the following:
500 Connect failed: connect: Unknown error; Unknown error
This machine uses a proxy, but I am able to get normal http web pages to work, so I think the proxy is set up ok.
Suggestions?
Hi guys. I found the solution for the very annoying ordinal problem. That is: A solution OTHER than removing the offending different version DLLS from the windows directory.
I have a wxPerl app that I ship as an executable (with PerlApp and inno setup) and I can't just go around deleting other people's DLLs without permission.
I discovered that changing PATH doesn't work, but you CAN fix this with a chdir to the directory containing your versions of the dll's before loading Crypt::SSLeay and then chdir-ing back. Like this:
use Cwd;
use FindBin;
my $lastdir=getcwd();
chdir($FindBin::RealBin);
eval "use Crypt::SSLeay";
$ssl=($@ ? 0 : 1);
chdir($lastdir);
I found this solution while looking through the faqs on the GAIM website which has a similar problem with a different dll.
Hope this helps, X
The installation went exactly as you described, but when I run the test script, perl exits without printing wither the HTTPS response or an error message.
In running Windows 2003 Server with ActiveState perl 5.8.7.
Any idea what could cause this?
This all looks very interesting, but I recall when looking at the SSLeay module a few years ago that there were Licensing issues with the encryption. Something like, it's OK to use this module in Australia, but risky (from a Licensing point of view) in the U.S. Anybody know anything about this?
It worked like a charm for me!
Question though...what is the lifetime of the perl module? Will the University of Winnipeg continue to have this posted? Also historical, why doesn't cpan have it? Is it due to politics?
Thanks
Hi,
Despite an installation as specified in the initial message, I had a 'crypt::ssleay lib not installed' error.
I searched for and renamed every occurence of LIBEAY32.DLL and SSLEAY32.DLL as Chirag did to fix the Ordinal issue.
It works fine, now.
The chdir method proposed by workman is more beautiful and should be applied when you don't want to corrupt the other applications that had installed the 2 dlls.
A big thanks for your help. Jerome
Oups! the chdir solution was provided by Xenna not WorknMan.... Sorry
Jerome
use strict;
use warnings;
use LWP::UserAgent;
use Crypt::SSLeay;
my $url = 'https://www.helsinki.fi/';
print "Url to $url\n";
my $ua = LWP::UserAgent->new or die "Problem with the new Useragent\n";
print "New LWP\n";
my $response = $ua->get($url) or die "Problem with the get $url\n";
print "Getting responce\n";
$response->is_success or
die "Failed to GET '$url': ", $response->status_line;
print "About to print the html\n";
I've put in the above code on a Solaris 2.6.15 machine, and i get the following problem:
$ ./https_get.pl
Url to https://www.helsinki.fi/
New LWP
Segmentation fault
$
Any ideas? Or am i barking up the wrong tree with this on Solaris?
Mark
Great write-up. I added a line to print "Content-type: text/html\n\n" so I could run the script from a browser, but am having a wierd problem. When I run the script from a DOS command prompt, I get the output exactly as expected. (It prints out the content header as well as returns all of the HTML) If I run it from a browser, though, "//localhost/ssl.pl" I get the error message "Failed to GET 'https://www.helsinki.fi/': 501 Protocol scheme 'https' is not supported (Crypt::SSLeay not installed) at c:\inetpub\wwwroot\ssl.pl line 18." Is there any reason why running the script from a DOS prompt finds the module, but running it through IIS does not? I can't figure it out. Thanks for any help.
--Seth
I am trying to use https and have tested the sample script with 'https://www.helsinki.fi/' successfully. My problem is with credentials.
here is my script:
use strict;
use HTTP::Request::Common;
use LWP::UserAgent qw($ua);
use LWP::Debug qw(+);
my $pw = shift @ARGV;
my $ua = LWP::UserAgent-> new;
$ua-> credentials("https://transerv1.someserver.com",
'WWW-Authenticate', "user" => $pw); # authentication
$ua -> no_proxy;
my $request =HTTP::Request-> new(GET =>
"https://transerv1.someserver.com");
my $response =$ua-> request($request);
LWP::Debug::conns("Get Response");
print "Response is: ".$response-> status_line."\n";
if ($response-> is_success) {
print "Successfully got file\n";
}
else {
$response-> status_line;
};
I am getting:
Peer certificate not verified
Unsupported authentication scheme 'ntlm'
You are not authorized to view this page
Return Code: 401
My problem is probably with the $ua-> credentials("https://transerv1.someserver.com", 'WWW-Authenticate', "user" => $pw); statement
Any help most appreciated!
@Seth - my best guess is that IIS, running as a special user (IUSR_XXXX with XXXX the name of the machine), is not allowed to read the required DLL(s) needed for SSL. I doubt it has problems with loading the Crypt::SSLeay module.
What you could try is see if you can open the DLL(s) from a script you run in IIS. My guess is you can't, and in that case you can give the IUSR_XXXX reading rights to the DLL(s)
@MartyDavis - ntlm is an authentication scheme used by Microsoft.
I checked CPAN, and found: LWP::Authen::Ntlm. I guess installing it will fix your problem.
I used the LWP::Authen::Ntlm module and fiddled with the code having authentication problems until I specified the https port 443.
It works.
I am very greatful for the help. I looks like I will be having to do more https downloading and will keep an eye on your site.
I might have some small projects if you are interested.
Thanks again
@MartyDavis - I am always interested in small (Perl) projects.
And I am glad it works.
Thanks for the guide John.
It worked perfectly for me on Win32, and setting the perl/bin/ into the system path, my perl compilation is portable too.
However, on linux (FC4) I get the error message "Error: no suitable installation target found for package Crypt::SSLeay"
and searching through the Activestate bug tracker, this bug is usually indicating that the build of perl is different from the build of the package I am trying to install. (Although it is the same as the build which just worked fine on win32)
any suggestions? =( has anyone got Crypt::SSLeay to work on linux?
For those on Windows XP experiencing the "Can't load 'C:/Perl/site/lib/auto/Crypt/SSLeay/SSLeay.dll' for module Crypt::SSLeay: load_file:The operating system cannot run %1 at C:/Perl/lib/DynaLoader.pm" error, I believe I have found 2 separate solutions:
Solution #1) copy the 2 DLL's into C:\Windows\System32, as described above
Solution #2) copy the 2 DLL's into C:\Perl\site\lib\auto\Crypt\SSLeay
Personally, I prefer #2 just in case other programs still need the existing one in the system32 folder to function properly
I installed that package on ActivePerl 5.8.8.819 it and worked just fine out of the box even though I have quite a few copies of those DLLs on my machine.
Since i wasn't able to find the solution anywhere on the web to the 500 problem people are encountering, i thought i would post my solution here .. Stop error handling. That's what causes the problem, you are actually connected fine, its the if($Response->is_success) that causes the problem .. for those getting the 500 error try your connection without the error checking.
Hi
I am getting this error in winXP while i use LWP in module
"The ordinal 113 could not be located in the dynamic link library SSLEAY32.dll"
Please how to resolve this?
Thanks Uthay
I get the following error appear several times when I try to install the package ...
Element 'IMPLEMENTATION' cannot contain a child element 'PROVIDE' at
c:/Perl/site/lib/PPM.pm line 1703, <> line 4.
Anyone have any ideas on this one? I am trying to install this with Perl version 5.6, so that might be the problem. Although, I would expect a different error if that were the case.
Install worked fine. When I try to run the test script I get an error saying "VSINIT.dll not found. Re-installing the application may fix this problem" Im running active state 5.8.8 build 817 on Win Xp home. The two dll's ssleay32.dll and libleay32.dll are both in the perl/bin dir which is also in the path statement. While writing this I copied the 2 dll's to the windows/system32 dir for the hell of it and it worked. May want to post this for others who may have this issue. Seems the path statement may not be what is used to locate the two dll's. Its 4 am so Im crashing out. see ya.
Thx for all this. I googled the whole web, tried to compile openssl myself and finally found this website. Just a few minutes to get it work, great!!
Hi All,
I am trying to install the Crypt:SSleay but am faced with lot of problems. I am using Activeperl V5.8.8. on WIndows XP. I have succefully installed the Openssl on my system. I am trying to install the module using ppm. Following are the steps i followed.
1) Installed Openssl from Openssl.org. 2) Downloaded the Crypt::SSLeay module from the in .tar format and unzipped the files into c:/perl/lib/Crypt-SSLeay-0.53 folder. 3) Downloaded the Nmake15.exe and ran it in the above directory. 4) Then using the Nmake.exe tried to create the ppd but the following exception was thrown!
C:\Perl\lib\CRYPT-~1.53>nmake
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
cl -c -Ic:\openssl\include -Ic:\openssl\inc32 -nologo -GF -W3 -MD -Zi
-DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
-DNO_HASH_SEED -DU
SE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO -DPERL
_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION=\"0.53\"
-DXS_VERSION=\"0.53\
" "-IC:\Perl\lib\CORE" SSLeay.c
'cl' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code
'0x1'
Stop.
I also tried another method
1) I tried ppm> install http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd but i got the following error!
ppm install failed: 404 Not Found
for this i also have set HTTP_proxy ,HTTP_proxy_usr and HTTP_proxy_pass environment variables... but still i get the same error.
I tried downloading this ppd and store it on my local machine and then re fire the install c:/Crypt-SSLeay.ppd but that too doesn't work.
CAn somebody point out wher am i going wrong!
Thanks and regards Dixit
@Dixit - the "'cl' is not recognized as an internal or external command" error happens because you have no C compiler on your system, or Perl is not able to find it.
If you can't access a ppd via ppm but can download using a browser something very odd is happening. Downloading the ppd manually is not going to work because the pdd points to two files:
You might be able to install Crypt::SSLeay by downloading manually, but I think it's more important to find out why ppm is not working correctly.
Are you able to install modules from CPAN using ppm?
@Marc - Based on the error "Element 'IMPLEMENTATION' cannot contain a child element 'PROVIDE'", which has to do with the ppd version, you picked the wrong version.
For ActivePerl builds 6xx use:
ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/Crypt-SSLeay.ppd
For ActivePerl builds 8xx use:
ppm install http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd
I've added this information to the article itself as well.
Thanks for the feedback.
Thanks so much! 2:40am, found your help page. 2:44am, everything works great.
Thank you ! It is very useful with comments !!!
Thanks so much for this - I was trying all morning to get Crypt::SSLeay installed and this finally got it for me! Really appreciate it!
For everyone that use a proxy, try to modify the code in this way (this fixed the problem in my case):
my $ua = LWP::UserAgent->new;
$ENV{HTTPS_PROXY} = "<my proxy address>:<my proxyport>";
# PROXY_BASIC_AUTH
$ENV{HTTPS_PROXY_USERNAME} = '<my domain>/<my username>';
$ENV{HTTPS_PROXY_PASSWORD} = '<my password>';
# DEFAULT SSL VERSION
$ENV{HTTPS_VERSION} = '3';
my $response = $ua->get( $url );
bye
I want to connect to https site and i need provide the user name and password for authentication. I am able to connect to the https site those don't prompt for userid and password, but i am unable to access site if it prompt for username i tried with proxy_authorization_basic method, but its not working. I am getting error as Error 401, access denied
Great deal.
Your description, how to install sslleay is very easy to handle. I've tried to install sslleay manually for hours and it failed again and again.
Thanks a lot.
Kind regards, Norbert
btw: When authorization to a website is required (error code 401), modul http mechanize is very helpfull. Please see this simple sample:
#!C:/Perl/bin/perl.exe -w
use strict;
use Crypt::SSLeay;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new( autocheck => 1 );
$mech->credentials( $ARGV[1], $ARGV[2]); # user + pw
$mech->get( "https://......."); # enter URL here
my $page = $mech->content( format => 'text' ) ;
print "\n".$page;
Hi everyone,
I need to access an HTTPS site that requires client certificates for authentication.I'm using Crypt::SSLeay and keep getting the error: OPENSSL_Uplink<022A9010,06>: no OPENSSL_Applink. but I was able to access a different https site that did not use client certification. Here is the relevant part of my code:
use strict;
use LWP::UserAgent;
# DEBUGGING SWITCH / LOW LEVEL SSL DIAGNOSTICS
$ENV{HTTPS_DEBUG} = 1;
# DEFAULT SSL VERSION
$ENV{HTTPS_VERSION} = '3';
# CLIENT PKCS12 CERT SUPPORT
$ENV{HTTPS_PKCS12_FILE} = 'test.p12';
$ENV{HTTPS_PKCS12_PASSWORD} = 'password';
my $ua = new LWP::UserAgent;
my $req = new (HTTP::Request'GET', 'https://example.com');
my $res = $ua->request($req);
print $res->status_line."\n";
I'm running on ActiveState 5.8 using Crypt::SSLeay from theoryx5. Could
anyone tell me what I'm doing wrong?
Thanks
BingShu Ni
Hi frens,
i am also getting problems with ssl module installation in perl (Windows xp os).
plz anyone help me by providing detailed steps to install that module (or) manual steps to place the files into perl installation directory. plz provide me as i need it urgently.....
Thanks in advance
Hi
I'm getting a similar error trying to use a client certificate. Likewise, I have an exsiting download over https (without client cert) that works, but now tring to access a site that requires one. Error I get is: [code] OPENSSL_Uplink(01A04010,06): no OPENSSL_Applink [/code] Using Active state 5.8.1.807
Seems to be linked to including the PKCS12 env vars to point the script to the cert.
Anyone have any ideas on this issue?
cheers
ash.
Hello
I am getting this error while installing flash cs3
"The ordinal 113 could not be located in the dynamic link library SSLEAY32.dll"
Please how to resolve this?
Thanks Uthay
I trie to rename the original ssleay32.dll to test_ssleay.dll reboot the XP client. But when i check a https site on the command line, i recieve a error from the Perl command line interpreter "AppName: perl.exe AppVer: 5.6.1.631 ModName: ssleay32.dll ModVer: 0.9.8.4 Offset: 00017e3c"
what's happend?
Note that your comment doesn't show up immediately. I review each comment before I add it to this site.
Check the Follow this page option if you want to receive an email each time a comment is posted to this page, including yours. A link to turn this option off will be included with each email.
Internet adresses will be converted automatically. You can use the following notation to specify anchor text for a link: [url=http://example.com/]example text[/url].
Thanks, I had a script which broke, and I had forgotten about all the 'good stuff' being at uwinnipeg.
Cheers -bob c