c中用socket传输和验证证书(openssl)
我必须用c 编写这些代码。我已经生成了一个终止t1的证书:t1.pem,它是由openssl生成的。终端 t1 和 t2 之间的通信已通过 c 中的套接字建立。
现在我想将此证书发送到另一个终止 t2。并且我希望 t2 接收该证书,验证它并向 t1 作出接受答复。当 t1 获得接受时,剩下的事情就会发生。
但我不知道如何做这些事情。
例如我将t1.pem作为字符串传输?但在t2端,我该如何验证呢?我知道openssl中有这样做的函数,但我不太清楚。最后,正常情况下,验收应该是怎样的呢?
@[email protected] 这里有很多问题.. 抱歉...如果有人可以给我一些指导.. 预先非常感谢!
I have to write these codes in c. I have already generate the certificate of one terminate t1: t1.pem, which is generated by openssl. The communication between the terminates t1 and t2 has been established via socket in c.
Now I want to send this certificate to another terminate t2.and I want t2 to receive the certificate, verify it and answer with an acceptance to t1. When t1 get this acceptance, it will the rest of stuffs..
But I don't know how to do these things.
For example, I transmit t1.pem as a string? But in t2 side, how can I do to verify? I know there are functions in openssl to do so, but I'm not so clear about it. At last, normally, the acceptance should be like how?
@[email protected] lot of questions here.. sorry...if someone could give me some guide..
Thanks a lot in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您尝试使用 openssl 建立通信,请查看此 OpenSSL 教程。
If you are trying to establish communication using openssl have a look at this OpenSSL tutorial.
这是给您的一些起始注释...
here's some starting notes for you ...
下面是一个示例代码,应该可以帮助您:
服务器
客户端
这些代码简单且不言自明。
Here is a sample code which should help you:
Server
Client
The codes are simple and self explanatory.