boostorg / mysql

MySQL C++ client based on Boost.Asio
https://www.boost.org/doc/libs/master/libs/mysql
Boost Software License 1.0
259 stars 33 forks source link

Exemple of how set CA certificate using "any_connection". #353

Closed Malkverbena closed 2 months ago

Malkverbena commented 2 months ago

Hi! It's not clear to me how to set a CA certificate using "any_connection". Is there any exemple?

anarthal commented 2 months ago

Hi!

Apologies, there is none at the moment - but they're planned. The steps are very similar to what you'd do with regular connection. You need to create an asio::ssl::context, populate it with the CA information, then pass it to any_connection constructor wrapped in any_connection_params. It would be similar to this.

If I'm not mistaken, you need to call add_certificate_authority (see docs) on the ssl context to add the CA.

Let me know if that solves your question.

Thanks, Ruben.

Malkverbena commented 2 months ago

Works fine! Thanks. And thank you for your work. This client saved me a lot of headaches.

anarthal commented 2 months ago

That's great! Feel free to ask any other questions you may have.