NetTalk Central

Author Topic: SSL Failed to Load Certificate  (Read 5021 times)

rupertvz

  • Sr. Member
  • ****
  • Posts: 323
    • View Profile
    • Email
SSL Failed to Load Certificate
« on: May 19, 2013, 02:17:11 PM »
Hi Guys,

I added SSL to an application, but I get the following error message:

A network communication error has occurred.
Error = Unable to Listen to TCP Port.
The error number was -65 which means that the SSL Failed to Load Certificate.
Error occurred in function NetSimple(Server),Open

In my application, under WebServer, Extensions, NetTalk Object, Settings
The listening port is 443 (default)
Use SSL is on, certificate = 'certificates\settings'

I created a certificate sub-folder in my application folder and copied both the *.crt & *.key files into this folder.
(according to the Secure Web Sites documentation)

I noticed that the 'certificates' folder for the example SSL application was located in the 'web' folder instead;

I tried both locations, but keeps on receiving the above error message.

Thinking that my *.crt file might have the wrong format, I tried copying the *.crt & *.key files from the SSL example (6) application, copying it to my application\certificates folder (with 'certificates\settings') in my app, but still the same error message ...

Any help will be appreciated.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: SSL Failed to Load Certificate
« Reply #1 on: May 19, 2013, 10:39:01 PM »
what is the _name_ of your crt and key files?

cheers
Bruce

rupertvz

  • Sr. Member
  • ****
  • Posts: 323
    • View Profile
    • Email
Re: SSL Failed to Load Certificate
« Reply #2 on: May 19, 2013, 10:55:10 PM »
Hi Bruce,

They were itcontact.co.za.crt & itcontact.co.za.key
Then as a test I renamed them to settings.crt & settings.key

As per docs I put them in C:\CLARION6\MYAPP\CERTIFICATES
Then I noticed in the example they were in WEB folder,
So I copied them ALSO to C:\CLARION6\MYAPP\WEB\CERTIFICATES

I even tried copying the settings.crt & settings.key files from the example (6) '\certificates' folder.
Same error message.

Regards
Rupert
« Last Edit: May 19, 2013, 10:57:03 PM by rupertvz »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: SSL Failed to Load Certificate
« Reply #3 on: May 19, 2013, 11:18:06 PM »
ok, let's cover a couple of bases;

a) the correct place is in
appfolder\certificates
not \web\certificates

(and indeed the exe will likely move them out of \web\certificates if \app\certificates does not exist).

b) the "name" in the template setting must match the name of the file. so if the template says
certificates\settings
then that implies settings.crt and settings.key

given that the app won't work with the example -
have you copied the correct DLL's into the app folder? (The _4_ SSL DLLs?)

and - if you run the example, does that work?

cheers
Bruce

rupertvz

  • Sr. Member
  • ****
  • Posts: 323
    • View Profile
    • Email
Re: SSL Failed to Load Certificate
« Reply #4 on: May 20, 2013, 12:08:46 AM »
Hi Bruce,

I found the problem.

In my app 'web' folder location, I am having CLIP(VARIABLE)&'\web'
I added this sometime ago, as I am running the application as a service and needed a specific path for the 'web' folder.

Where "variable" is the installed data-path of the application.
Everything in the application (running as a service) worked fine up this point, except for the SSL.

I now compiled the application back into a service and again it is not working, as I guess it requires a variable to indicate the path for the application / web folder?





rupertvz

  • Sr. Member
  • ****
  • Posts: 323
    • View Profile
    • Email
Re: SSL Failed to Load Certificate
« Reply #5 on: May 20, 2013, 12:34:39 AM »
Hi Bruce,

I did further testing, as soon as I replace the 'web' value in the web-folder location with a variable,
The certificate error message appears.

Even if I set the variable directly = 'web'

Please advise,

rupertvz

  • Sr. Member
  • ****
  • Posts: 323
    • View Profile
    • Email
Re: SSL Failed to Load Certificate
« Reply #6 on: May 20, 2013, 12:46:29 AM »
Hi Bruce,

Just to recap;

1.  I have my SSL certificates in the app\certificates folder all along.
2.  I copied them to the web\certificates folder ALSO when I realised that the example app (6) had it this way
3.  I have all 4 x SSL DDL's in my app folder (although it is in the system-path on the developers w/s)
4.  The certificate name in the template, matches the exact file names (without extension)

As soon as I change the WEB-DIRECTORY to a variable, the application produces an SSL error message;
Even when I set the variable to 'web'

I need to use a variable as I am using a Windows Service,

Please let me know how I can get this working?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: SSL Failed to Load Certificate
« Reply #7 on: May 20, 2013, 01:57:19 AM »
>> 3.  I have all 4 x SSL DDL's in my app folder (although it is in the system-path on the developers w/s)

They need to be in the app folder. You should not rely on the path because it loads them at runtime, not at start-up time. Plus you may be getting different versions of the dll.

>> As soon as I change the WEB-DIRECTORY to a variable, the application produces an SSL error message;

which SSL error message?

>> Even when I set the variable to 'web'
>> I need to use a variable as I am using a Windows Service,

I'm not sure how using a service makes the need for a variable. Typically the web folder is relative to the exe. Whether it runs as a service or a program.

If you leave the web folder fixes as 'web' then do you get an SSL error?

cheers
Bruce


rupertvz

  • Sr. Member
  • ****
  • Posts: 323
    • View Profile
    • Email
Re: SSL Failed to Load Certificate
« Reply #8 on: May 20, 2013, 02:07:25 AM »
Hi Bruce,

If I leave the Web Directory as 'web' the application works 100%.

When I change the Web Directory to a variable, it produces the error message:

A network communication error has occurred.
Error = Unable to Listen to TCP Port.
The error number was -65 which means that the SSL Failed to Load Certificate.
Error occurred in function NetSimple(Server),Open


If I don't use a variable and compile the application into a service, I get all sorts of errors, including the certificate error, as it is unable to find the web folder.  I guess as a service it is looking for the web folder in C:\WINDOWS\SYSTEM32 ... somewhere?

This application has been running fine for quite sometime (with a variable in the web directory)

Why would the certificate cause a problem?