Openssl需要使用CA捆绑文件(中级证书)
我刚刚从 GoDaddy 购买了 SSL 证书。 价格很高,但似乎有一个缺点。
它似乎需要bundle.crt才能在必须的浏览器上正常工作。 我还不确定它是什么,据我所知,它是来自证书颁发机构的中间证书。如果我错了请纠正我 所以在我的软件中我有 openssl
SSL_CTX_set_default_passwd_cb(SSL_ctx, pem_passwd_cb);
SSL_CTX_use_PrivateKey_file(SSL_ctx, _private_key, SSL_FILETYPE_PEM);
SSL_CTX_use_certificate_file(SSL_ctx, _certificate, SSL_FILETYPE_PEM);
SSL_CTX_use_certificate_chain_file(SSL_ctx, "./ssl_key/bundle.pem");
SSL_CTX_set_session_cache_mode(SSL_ctx,SSL_SESS_CACHE_SERVER|SSL_SESS_CACHE_NO_INTERNAL);
SSL_CTX_set_quiet_shutdown(SSL_ctx, 1);
我得到的错误是:
您没有正确运行 init 或发生错误。
使用最后的证书(geotrust)我不需要捆绑中间体,我真的迷失在这里了。
由于 SSL_CTX_use_certificate_chain_file 仅接受 PEM 文件,因此我已使用 openssl 将 bundle.crt 文件转换为 PEM。
有什么想法吗?
谢谢!
编辑1: 显然,中级证书必须位于 /etc/ssl/certs 文件夹中。 我已将 go-daddy 的所有中级证书都放在此文件夹中,但仍然没有运气...... 我已经删除了这行
SSL_CTX_use_certificate_chain_file(SSL_ctx, "./ssl_key/bundle.pem");
似乎对我来说没有用......
I just purchased a SSL certificate from Go Daddy.
Great price, but it seems that it has a draw back.
It seems to need the bundle.crt in order to work correctly on must browser.
I'm not yet really sure what it is, from what I have understand it is an intermediate certificate from Certificate Authority. Correct me if I'm wrong
So in my software I have openssl
SSL_CTX_set_default_passwd_cb(SSL_ctx, pem_passwd_cb);
SSL_CTX_use_PrivateKey_file(SSL_ctx, _private_key, SSL_FILETYPE_PEM);
SSL_CTX_use_certificate_file(SSL_ctx, _certificate, SSL_FILETYPE_PEM);
SSL_CTX_use_certificate_chain_file(SSL_ctx, "./ssl_key/bundle.pem");
SSL_CTX_set_session_cache_mode(SSL_ctx,SSL_SESS_CACHE_SERVER|SSL_SESS_CACHE_NO_INTERNAL);
SSL_CTX_set_quiet_shutdown(SSL_ctx, 1);
The error I get is :
You didn't run init properly or an error occured.
With lasts certs (geotrust) I didn't need the bundle intermediate, I'm really lost here.
Since SSL_CTX_use_certificate_chain_file accepts only PEM files, I have converted the bundle.crt file to PEM using openssl.
Any idea ?
Thanks!
EDIT 1 :
Apparently Intermediate certificate must be on the /etc/ssl/certs folder.
I have putted every intermediate certificate from go-daddy on this folder, and still no luck...
I have removed the line
SSL_CTX_use_certificate_chain_file(SSL_ctx, "./ssl_key/bundle.pem");
Which seems to be no use for me here...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,在测试了一百万件事之后我终于发现了。
我没有将bundle.crt转换为PEM。
我已将证书文件直接粘贴到bundle.crt中(在文件的开头)
我已删除了代码中的这一行:
所以这是SSL init的最终代码:
希望这对某人有帮助,并为他们节省很多时间(对我来说一整天;-))
Okay, after testing one million things I finally found out.
I didn't convert the bundle.crt into PEM.
I have pasted the certificate file directly in the bundle.crt (at the beginning of the file)
I have removed this line on my code :
So here's the final code for SSL init :
Hope this helps someone, and save them a lot of time (1 full day for me ;-))