Delphi XE2 DataSnap 服务器 - HTTPS“无法加载证书”
我有一个现有的 DataSnap 服务器(Windows 服务),它在 HTTP 上运行良好,现在我想添加 HTTPS 作为附加协议。我已获取并安装了 SSL 证书并生成了证书文件 (.crt) 和私钥文件 (.key)。作为测试,当使用 Delphi XE2 DataSnap Server 向导并勾选“HTTPS”来获取证书页面时,我可以引用这两个文件并单击“测试”按钮,结果成功。我添加了一个额外的 TDSHTTPService 组件并将其链接到 TDSCertFiles 组件。在我的服务启动事件中,我在启动 DSServer 之前在 DSCertFiles.CertFile 和 DSCertFiles.KeyFile 属性中设置 2 个证书文件的路径。当尝试启动服务时,我收到错误:
无法加载证书。错误:140AD002:SSL 例程:SSL_CTX_use_certificate_file:系统lib
我缺少什么吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
XE2 和 XE3 中有一个众所周知的错误。
我找到了这个解决方法。
设置 TDSCert 属性之后并启动 DSHTTPServer 之前,调用此方法:
There is a well known bug in XE2 and XE3.
I've found this workaround.
After set the TDSCert properties and before start the DSHTTPServer, call this method:
错误代码
0x140AD002
表示SSL_CTX_use_certificate_file()
无法打开该文件。Error code
0x140AD002
meansSSL_CTX_use_certificate_file()
was not able to open the file.