Thread View: borland.public.cppbuilder.internet.socket
8 messages
8 total messages
Started by Hans Galema
Fri, 06 Oct 2006 11:05
Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50)
Author: Hans Galema
Date: Fri, 06 Oct 2006 11:05
Date: Fri, 06 Oct 2006 11:05
31 lines
1793 bytes
1793 bytes
Got this exception: // First chance exception at $7C81EB33. // Exception class EIdOSSLCouldNotLoadSSLLibrary with message // 'Could not load SSL library.'. // Process OpenSSLIndy9.exe (3164) The German magazine 'Der Entwickler' 6.06 offers some exercises with OpenSLL for C++Builder. I use Turbo C++ Explorer with Indy 9.0.50. The first exercise using raw sockets went ok. The second exercise uses Indy with a TIdHTTP and a TIdSSLIOHandlerSocket. For the latter I have: #include <IdSSLOpenSSL.hpp> // for TIdSSLIOHandlerSocket #include <IdHTTP.hpp> and added IdHTTP.pas to the project Compiling and linking are ok. But at runtime I got above exeption at IdHTTP->Connect(); Unfortunately the message does not tell which file/path could not be found. Are they libeay32.dll or ssleay32.dll? Well they are in the same directory as the .exe. (More over they are in system32). What is exactly missing? Hans.
Re: Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50)
Author: Hans Galema
Date: Fri, 06 Oct 2006 15:56
Date: Fri, 06 Oct 2006 15:56
20 lines
1725 bytes
1725 bytes
Hans Galema wrote: > Got this exception: Well I see in the Event Log window: .... Module Load: WLDAP32.dll. No Debug Info. Base Address: $76F20000. Process OpenSSLIndy9.exe (2472) Module Load: rasadhlp.dll. No Debug Info. Base Address: $76F80000. Process OpenSSLIndy9.exe (2472) Module Load: LIBEAY32.dll. No Debug Info. Base Address: $10000000. Process OpenSSLIndy9.exe (2472) Module Load: SSLEAY32.dll. No Debug Info. Base Address: $01240000. Process OpenSSLIndy9.exe (2472) First chance exception at $7C81EB33. Exception class EIdOSSLCouldNotLoadSSLLibrary with message 'Could not load SSL library.'. Process OpenSSLIndy9.exe (2472) so it looks that libeay32.dll and slleay32.dll are found and loaded. But what is going on on the last line? Hans.
Re: Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50)
Author: Bob Gonder
Date: Fri, 06 Oct 2006 18:18
Date: Fri, 06 Oct 2006 18:18
9 lines
1263 bytes
1263 bytes
Hans Galema wrote: >Are they libeay32.dll or ssleay32.dll? Well they are in the >same directory as the .exe. (More over they are in system32). I have One copy of ssleay32.dll, but it is in ...System32\ZoneLabs\ Maybe you are picking up a wrong copy?
Re: Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50)
Author: Remy Lebeau (TeamB)
Date: Fri, 06 Oct 2006 19:27
Date: Fri, 06 Oct 2006 19:27
32 lines
1735 bytes
1735 bytes
"Hans Galema" <notused@notused.nl> wrote in message news:452638cc$1@newsgroups.borland.com... > Got this exception: You do not have the correct version of the OpenSSL DLLs installed. Which versions do you have installed? Where did you get them? > and added IdHTTP.pas to the project You should not have done that. You should have linked to the Indy library instead. > Compiling and linking are ok. But at runtime I got above > exeption at IdHTTP->Connect(); Do not call Connect() directly. Use Get() or Post() instead, which will call Connect() internally as needed. > Unfortunately the message does not tell which file/path could not be found. The IdSSLOpenSSLHeaders unit has a WhichFailedToLoad() function that provides that information. > Are they libeay32.dll or ssleay32.dll? Yes. Gambit
Re: Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50)
Author: Hans Galema
Date: Mon, 09 Oct 2006 14:40
Date: Mon, 09 Oct 2006 14:40
87 lines
3978 bytes
3978 bytes
Remy Lebeau (TeamB) wrote:
> You do not have the correct version of the OpenSSL DLLs installed. Which
> versions do you have installed? Where did you get them?
According to the article one of the url's where I could get them was
http://www.slproweb.com where I downloaded Win32OpenSSL-0_9_8d.exe.
There was another installer but this one was recommended. Explorer
tells the version of the .dll's is 0.9.8.4
I choosed for that one because I got it all at once: headers, lib and
dll's. (I neaded the headers and lib for the first exercise with
raw sockets. As mentioned that exercise went ok). So -on request- I
installed all in D:\OpenSSL but did not find the .dll's in it. It
appeared that this was one of such installers which ask you for a
destination directory and then copy a whole bunch of files to system32.
Searching for the mentioned .dlls I found them in directories for
FileZilla, php4 and php5. And in system32.
With the Indy example I only needed the .dll's.
So better get them from http://www.indyproject.org?
>>and added IdHTTP.pas to the project
>
> You should not have done that. You should have linked to the Indy library
> instead.
That I have to investigate further then.
> Do not call Connect() directly. Use Get() or Post() instead, which will
> call Connect() internally as needed.
I do not know what I should post or get. I merely followed the example
in the article. This is all the code:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
AnsiString Host = "www.verisign.com";
int Port = 443;
IdHTTP = new TIdHTTP ( this );
IdSSLIOHandlerSocket = new TIdSSLIOHandlerSocket ( this );
IdHTTP->Host = Host;
IdHTTP->Port = Port;
IdHTTP->IOHandler = IdSSLIOHandlerSocket;
IdSSLIOHandlerSocket->SSLOptions->Mode = sslmClient;
IdSSLIOHandlerSocket->SSLOptions->Method = sslvSSLv23;
Label2->Caption = "Indy " + IdHTTP->Version;
// 9.0.50
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Memo1->Clear();
IdHTTP->Connect(); // this brings the exception
//'Could not load SSL library.'.
Memo1->Lines->Add (
IdSSLIOHandlerSocket->SSLSocket->PeerCert->Subject->OneLine );
Memo1->Lines->Add ( "" );
Memo1->Lines->Add (
IdSSLIOHandlerSocket->SSLSocket->PeerCert->FingerprintAsString);
}
>>Unfortunately the message does not tell which file/path could not be
>>found.
>
> The IdSSLOpenSSLHeaders unit has a WhichFailedToLoad() function that
> provides that information.
Now that is another problem as I do not know if I should instantiate an
instance of that class or that is is part of one of the classes I use here.
Googling for it brings that name used also in the builder groups but there
is not a single code example.
>>Are they libeay32.dll or ssleay32.dll?
> Yes.
I will first try to get these dll's from the indy website.
Hans.
Re: Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50)
Author: Hans Galema
Date: Mon, 09 Oct 2006 15:17
Date: Mon, 09 Oct 2006 15:17
19 lines
1633 bytes
1633 bytes
Hans Galema wrote: > I will first try to get these dll's from the indy website. On http://indyproject.org I clicked Indy.Sockets (VCL) Indy Project � Indy (VCL) � Downloads And then 'Official Indy demos' where I found: TIdTCPClient/Server with SSL Ralph Sickinger Hee that looks like a nice start! Clicked the Download link behind it and then choose the http://indy.fulgan.com/SSL/ link for the libeay32.dll and ssleay32.dll Finally I found them in indy_OpenSSL096m.zip. Now the exercise does work. He he. Hans.
Re: Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50)
Author: Remy Lebeau (TeamB)
Date: Mon, 09 Oct 2006 16:57
Date: Mon, 09 Oct 2006 16:57
103 lines
4233 bytes
4233 bytes
"Hans Galema" <notused@notused.nl> wrote in message
news:452a5f9e@newsgroups.borland.com...
> According to the article
Which article are you referring to?
> one of the url's where I could get them was http://www.slproweb.com
> where I downloaded Win32OpenSSL-0_9_8d.exe.
That is the official version of OpenSSL. You cannot use that version of the
DLLs with the version of Indy that you are using. It requires the use of
custom-built versions of those DLLs instead, which are available through
Indy's own website (http://www.indyproject.org/Sockets/SSL.en.aspx). In
order to use the official OpenSSL DLLs, you would have to upgrade to the
latest Indy 10 version, except that it is not yet available for C++ at this
time.
> I do not know what I should post or get.
Then you need to read the documentation, and learn how HTTP works in
general.
> I merely followed the example in the article.
From what I can tell from the code you shown, all it is trying to do is
connect to the server in order to obtain certificate information. It is not
actually requesting any pages from the server. Is that what you are trying
to accomplish? If you want to download an actual page, then the code should
look more like the following instead:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
IdHTTP = new TIdHTTP(this);
IdSSLIOHandlerSocket = new TIdSSLIOHandlerSocket(IdHTTP);
IdHTTP->IOHandler = IdSSLIOHandlerSocket;
IdSSLIOHandlerSocket->SSLOptions->Mode = sslmClient;
IdSSLIOHandlerSocket->SSLOptions->Method = sslvSSLv23;
Label2->Caption = "Indy " + IdHTTP->Version;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Memo1->Clear();
AnsiString Content = IdHTTP->Get("https://www.verisign.com");
// use Content as needed ...
Memo1->Lines->Add(IdSSLIOHandlerSocket->SSLSocket->PeerCert->Subject->OneLin
e);
Memo1->Lines->Add("");
Memo1->Lines->Add(IdSSLIOHandlerSocket->SSLSocket->PeerCert->FingerprintAsSt
ring);
}
> IdHTTP = new TIdHTTP ( this );
> IdSSLIOHandlerSocket = new TIdSSLIOHandlerSocket ( this );
Why are you instantiating those in code instead of dropping them onto the
form at design-time?
> IdHTTP->Host = Host;
> IdHTTP->Port = Port;
You need to specify the Host and Port as a single URL string when calling
Get() or Post().
> IdHTTP->Connect(); // this brings the exception
> //'Could not load SSL library.'.
Because you are using the wrong DLLs.
> Now that is another problem as I do not know if I should instantiate
> an instance of that class or that is is part of one of the classes I use
here.
It is not a class. It is a global function. Just include the
IdSSLOpenSSLHeaders.hpp header file into your code, and then call the
function. For example:
#include "IdSSLOpenSSLHeaders.hpp"
try
{
// IdHTTP->Connect();
// or
// IdHTTP->Get(...);
}
catch(const EIdOSSLCouldNotLoadSSLLibrary &)
{
Memo1->Lines->Add("SSL Error:");
Memo1->SelStart = Memo1->GetTextLen();
Memo1->SelText = WhichFailedToLoad();
}
Gambit
Re: Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50)
Author: Hans Galema
Date: Mon, 09 Oct 2006 17:54
Date: Mon, 09 Oct 2006 17:54
40 lines
2322 bytes
2322 bytes
Remy Lebeau (TeamB) wrote:
> Which article are you referring to?
<quote from op>
The German magazine 'Der Entwickler' 6.06 offers some exercises with
OpenSLL for C++Builder. I use Turbo C++ Explorer with Indy 9.0.50.
</quote from op>
> From what I can tell from the code you shown, all it is trying to do is
> connect to the server in order to obtain certificate information. It is not
> actually requesting any pages from the server. Is that what you are trying
> to accomplish?
Yes. Yes. Yes.
> If you want to download an actual page, then the code should
> look more like the following instead:
Ok. Thanks.
> Why are you instantiating those in code instead of dropping them onto the
> form at design-time?
I have to: Using Turbo C++ Explorer.
> catch(const EIdOSSLCouldNotLoadSSLLibrary &)
> {
> Memo1->Lines->Add("SSL Error:");
> Memo1->SelStart = Memo1->GetTextLen();
> Memo1->SelText = WhichFailedToLoad();
> }
Thanks.
FYI: In the next edition of Der Entwickler there will be an example
of how to tunnel trough a proxy with OpenSSL. Indy 9 would not be able
to do that. One would need nonblocking sockets also.
Hans.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads