Search code examples
delphihttpscertificatedatasnap

Delphi XE2 DataSnap Server - HTTPS 'Could not load certificate'


I have an existing DataSnap server (Windows service) which is running fine on HTTP, and I now want to add HTTPS as an additional protocol. I've obtained and installed an SSL certificate and generated a certificate file (.crt) and private key file (.key). As a test, when using the Delphi XE2 DataSnap Server wizard and ticking 'HTTPS' to get the certificate page, I can reference the 2 files and click the 'Test' button which succeeds. I've added an additional TDSHTTPService component and linked it to a TDSCertFiles component. In my service startup event I'm setting the path to the 2 certificate files before starting the DSServer, in the DSCertFiles.CertFile and DSCertFiles.KeyFile properties. When trying to start the service I get the error :

Could not load certificate. error:140AD002:SSL routines:SSL_CTX_use_certificate_file:system lib

Is there something I'm missing?


Solution

  • Error code 0x140AD002 means SSL_CTX_use_certificate_file() was not able to open the file.