Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Could not load SSL library
#1
Hello,
I use registerd Intraweb 14.2.8 Ultimate and Indy 10.6.2.5366 Delphi 10.2.3
And openssl-1.0.2o-i386-win32.zip from Fulgan
I have put the dll’s in the same map as the program dll (and in windows/system32, and windows/SysWow64 for trying)
The prog is 32 bit
Snippet from program:

Code:
try
    try
      Strm := TStringStream.Create;
      IdHTTP1 := TIdHTTP.Create(nil);
      LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
      LHandler.SSLOptions.certfile := certfile;
      LHandler.SSLOptions.keyfile := keyfile;
      LHandler.SSLOptions.Method := sslvTLSv1_2; // sslvSSLv23;
      LHandler.SSLOptions.Mode := sslmBoth;
      LHandler.SSLOptions.VerifyMode := [];
      LHandler.SSLOptions.VerifyDepth := 0;
      IdHTTP1.IOHandler := LHandler;
      // alleen voor debug anders regel hieronder: Strm.LoadFromFile(UserSession.Exportfilenaam);
      UserSession.XMLDoc1.SaveToStream(Strm);
      IdHTTP1.Request.ContentType := 'text/xml';
      IWMemo1.Lines.Add(IdHTTP1.Post(UserSession.nxT_Algpar.FieldByName('IDeal_Site_URL').AsString, Strm));
    finally
      Strm.Free;
      LHandler.Free;
      IdHTTP1.Free;
    end;
  except
    on E: Exception do
    begin
      IWMemo1.Lines.Add(E.ClassName);
      IWMemo1.Lines.Add(E.Message);
      // Writeln(E.ClassName, ': ', E.Message);
    end;
  end;

When I run the prog as SA all goes well.
When I run it as a ISAPI dll under Abyss or IIS I get an error:
EIdOSSLCouldNotLoadSSLLibrary
Could not load SSL library.
Who knows what is wrong?
Reply
#2
(08-23-2018, 08:06 PM)mail@hvdboogaard.nl Wrote: I have put the dll’s in ... windows/system32, and windows/SysWow64

DO NOT do that (especially the System32 folder on a 64bit Windows, as 32-bit DLLs do not belong in that folder!  Non-system DLLs should not be placed in any system folder to begin with).

If the DLLs are not in a folder that is in the system search path, you can use Indy's IdSSLOpenSSLHeaders.IdOpenSSLSetLibPath() function at runtime to specify the folder path where they are located.

(08-23-2018, 08:06 PM)mail@hvdboogaard.nl Wrote:
Code:
LHandler.SSLOptions.Mode := sslmBoth;

That should be set to sslmClient instead, or left as sslmUnassigned.

(08-23-2018, 08:06 PM)mail@hvdboogaard.nl Wrote:
Code:
UserSession.XMLDoc1.SaveToStream(Strm);
IWMemo1.Lines.Add(IdHTTP1.Post(UserSession.nxT_Algpar.FieldByName('IDeal_Site_URL').AsString, Strm));

You should reset the Strm.Position property back to 0 before posting.

(08-23-2018, 08:06 PM)mail@hvdboogaard.nl Wrote: When I run the prog as SA all goes well.
When I run it as a ISAPI dll under Abyss or IIS I get an error:
EIdOSSLCouldNotLoadSSLLibrary
Could not load SSL library.

That usually means either:

- Indy could not load the DLLs because Windows could not find them.

- Windows loaded a different version of the DLLs found on the system search path, instead of loading your DLLs, and those other DLLs do not export functions that Indy requires.

What does Indy's IdSSLOpenSSLHeaders.WhichFailedToLoad() function report after that error occurs?

Reply
#3
I altered the code:

Code:
try
    try
     // IdSSLOpenSSLHeaders.IdOpenSSLSetLibPath('c:\AVNWEBS\AVN1\');
      Strm := TStringStream.Create;
      IdHTTP1 := TIdHTTP.Create(nil);
      LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
      LHandler.SSLOptions.certfile := certfile;
      LHandler.SSLOptions.keyfile := keyfile;
      LHandler.SSLOptions.Method := sslvTLSv1_2; // sslvSSLv23;
      LHandler.SSLOptions.Mode := sslmUnassigned;
      LHandler.SSLOptions.VerifyMode := [];
      LHandler.SSLOptions.VerifyDepth := 0;
      IdHTTP1.IOHandler := LHandler;
      // alleen voor debug anders regel hieronder: Strm.LoadFromFile(UserSession.Exportfilenaam);
      UserSession.XMLDoc1.SaveToStream(Strm);
      IdHTTP1.Request.ContentType := 'text/xml';
      Strm.Position := 0;
      IWMemo1.Lines.Add(IdHTTP1.Post(UserSession.nxT_Algpar.FieldByName('IDeal_Site_URL').AsString, Strm));
    finally
      Strm.Free;
      LHandler.Free;
      IdHTTP1.Free;
    end;
  except
    on E: Exception do
    begin
      IWMemo1.Lines.Add(E.ClassName);
      IWMemo1.Lines.Add(E.Message);
      IWMemo1.Lines.Add(IdSSLOpenSSLHeaders.WhichFailedToLoad);
      // Writeln(E.ClassName, ': ', E.Message);
    end;
  end;

When I run I get the errors in the memo:

EIdOSSLCouldNotLoadSSLLibrary
Could not load SSL library.
DES_set_odd_parity,DES_set_key,DES_ecb_encrypt,EVP_des_cfb64

When I uncomment the first row I get an error see Attachment

Thanks you wil help me.
Henk


Attached Files Thumbnail(s)
   
Reply
#4
(08-24-2018, 07:55 AM)mail@hvdboogaard.nl Wrote: When I run I get the errors in the memo:

EIdOSSLCouldNotLoadSSLLibrary
Could not load SSL library.
DES_set_odd_parity,DES_set_key,DES_ecb_encrypt,EVP_des_cfb64

I can't reproduce that error when using the latest Indy SVN rev 5475 with OpenSSL 1.0.2o from Fulgan. You are using rev 5366, which is 2 years old. There have been numerous updates to the IdSSLOpenSSLHeaders.pas unit since that time.

(08-24-2018, 07:55 AM)mail@hvdboogaard.nl Wrote: When I uncomment the first row I get an error see Attachment

At what point does the error happen? At app startup, or later? Is your project static linking to the OpenSSL DLLs in any way, by chance? Indy dynamically loads the DLLs at runtime, and does not load OpenSSL's functions by ordinal.

Reply
#5
I replaced the dll's Also in the map from Abyss where there where old dll's.
When I run now I don't get the integer error anymore.
Also not loading error's from DLL's

But new errors:

C:\AVNWEBS\
EIdOSSLLoadingCertError
Could not load certificate.
error:140DC002:lib(20):func(220):reason(2)


The C:\AVNWEBS\  is a info row where the ssl dll's are

Seems that now the is a certificate error
Do you what the error means?

=========== here is the altered code:
try
    try
      Strm := TStringStream.Create;
      IdHTTP1 := TIdHTTP.Create(nil);
      LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
      IdSSLOpenSSLHeaders.IdOpenSSLSetLibPath(UserSession.SSL_Pad);
      LHandler.SSLOptions.certfile := certfile;
      LHandler.SSLOptions.keyfile := keyfile;
      LHandler.SSLOptions.Method :=   sslvTLSv1_2;  // sslvSSLv23;
      LHandler.SSLOptions.Mode := sslmUnassigned;
      LHandler.SSLOptions.VerifyMode := [];
      LHandler.SSLOptions.VerifyDepth := 0;
      IdHTTP1.IOHandler := LHandler;
      // alleen voor debug anders regel hieronder: Strm.LoadFromFile(UserSession.Exportfilenaam);
      UserSession.XMLDoc1.SaveToStream(Strm);
      IdHTTP1.Request.ContentType := 'text/xml';
      Strm.Position := 0;
      IWMemo1.Lines.Add(IdHTTP1.Post(UserSession.nxT_Algpar.FieldByName('IDeal_Site_URL').AsString, Strm));
    finally
      Strm.Free;
      LHandler.Free;
      IdHTTP1.Free;
    end;
  except
    on E: Exception do
    begin
      IWMemo1.Lines.Add(UserSession.SSL_Pad);
      IWMemo1.Lines.Add(E.ClassName);
      IWMemo1.Lines.Add(E.Message);
      IWMemo1.Lines.Add(IdSSLOpenSSLHeaders.WhichFailedToLoad);
      // Writeln(E.ClassName, ': ', E.Message);
    end;
  end;
================
Henk

[quote pid='1376' dateline='1535146609']
(08-24-2018, 07:55 AM)mail@hvdboogaard.nl Wrote: When I run I get the errors in the memo:

EIdOSSLCouldNotLoadSSLLibrary
Could not load SSL library.
DES_set_odd_parity,DES_set_key,DES_ecb_encrypt,EVP_des_cfb64

I can't reproduce that error when using the latest Indy SVN rev 5475 with OpenSSL 1.0.2o from Fulgan.  You are using rev 5366, which is 2 years old.  There have been numerous updates to the IdSSLOpenSSLHeaders.pas unit since that time.

(08-24-2018, 07:55 AM)mail@hvdboogaard.nl Wrote: When I uncomment the first row I get an error see Attachment

At what point does the error happen?  At app startup, or later?  Is your project static linking to the OpenSSL DLLs in any way, by chance?  Indy dynamically loads the DLLs at runtime, and does not load OpenSSL's functions by ordinal.
[/quote]
Reply
#6
(08-24-2018, 10:16 PM)mail@hvdboogaard.nl Wrote: EIdOSSLLoadingCertError
Could not load certificate.
error:140DC002:lib(20):func(220):reason(2)

That error code comes from OpenSSL's SSL_CTX_use_certificate_chain_file() function. It means that OpenSSL could not open the certificate file specified in the IOHandler's SSLOptions.CertFile property. Make sure the file exists at the path you are specifying, and it is in a proper PEM format.

Reply
#7
(08-24-2018, 10:47 PM)rlebeau Wrote: That error code comes from OpenSSL's SSL_CTX_use_certificate_chain_file() function.  It means that OpenSSL could not open the certificate file specified in the IOHandler's SSLOptions.CertFile property.  Make sure the file exists at the path you are specifying, and it is in a proper PEM format.

The program is working well now. Very, Many thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)