blackbeam / mysql_async

Asyncronous Rust Mysql driver based on Tokio.
Apache License 2.0
372 stars 113 forks source link

Allow specifying root certs and Client Identity [for native-tls] as bytes rather than via a file #288

Closed rjobanp closed 4 months ago

rjobanp commented 5 months ago

👋🏽 In our use-case we'd prefer not to have to generate files for providing root certs and client keys to mysql_async -- we already have those values as bytes and for security reasons don't want to expose them to the filesystem.

This PR adds a with_root_cert option to SslOpts to allow providing root CA certs directly, which are merged with any other certs specified by with_root_cert_path. This also adds a ClientIdentity::new_from_bytes method to allow instantiating a native-tls ClientIdentity using the pkcs12 archive directly. In both cases I avoided changing any existing APIs, but feel free to suggest an alternative design or implementation. Thanks!