Article View: borland.public.cppbuilder.internet.socket
Article #1829Re: Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50)
From: 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
Technical Details
Message-ID:
<452a7fe7$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<452638cc$1@newsgroups.borland.com> <4526ae80$1@newsgroups.borland.com> <452a5f9e@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,997613c5798fd0ad X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <452638cc$1@newsgroups.borland.com> <4526ae80$1@newsgroups.borland.com> <452a5f9e@newsgroups.borland.com> Subject: Re: Exception class EIdOSSLCouldNotLoadSSLLibrary (Indy 9.0.50) Date: Mon, 9 Oct 2006 09:57:29 -0700 Lines: 105 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 69.169.4.232 Message-ID: <452a7fe7$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1160413159 69.169.4.232 (9 Oct 2006 09:59:19 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail