What is boost::asio::ssl::context::load_verify_file and how to work with it?

﹥>﹥吖頭↗ 提交于 2019-12-04 04:03:14

In simple terms :

The .pem file can contain a certificate (public key), or a private key, or a combination of both. PEM is a way to encode data, and X509 certificated are usually used with PEM. For example the server reads the .pem file and sends the certificate to a client so that the client can verify it before connecting.

A server with a self-signed certificate will pop a warning on today's browsers saying that it's not trusted (unless signed by a CA, and browsers have a database of signed CA's which they use in order to verify if the certificate is "valid" or not) and you can examine the certificate details and decide if you want to trust that site or not. A good example is the IETF.org link since their certificate expired not so long ago :)

  1. As a client, it may mean something but it doesn't need to unless you need it to be. That it to say, if the server sends the certificate, your client may want to verify it before continuing and in that case you will need the information from the CA that signed the server certificate, which can be loaded from a .pem file containing the CA information. If your client doesn't care about verification then it doesn't need it.

    Basically the load_verify_file() function loads the CA information in order to perform verification of a certificate send by the server.

    You can create your own CA file and sign your own server certificate and then use your own CA file with the client in order to verify that you are connecting to your own server.

  2. read 1. No the client does not send it.

  3. If you want to learn more, here is a guide straight from duckduckgo.

  4. Read 3 and the beginning of this post.

  5. If the client accept the servers certificate just fine and is not rejecting it since it can't verify it then it's fine. Easy to check, enable only ssl connection to/from the server and see if the client will connect and perform the work it should or just sniff the traffic and look it up.

  6. Not sure what you mean there. Buying a ssl host? If so, the problem will still be with your client if it wants to accept the connection or not.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!