@@ -215,6 +215,31 @@ impl MySqlConnectOptions {
215
215
self
216
216
}
217
217
218
+ /// Sets the SSL client certificate as a PEM-encoded byte slice.
219
+ ///
220
+ /// This should be an ASCII-encoded blob that starts with `-----BEGIN CERTIFICATE-----`.
221
+ ///
222
+ /// # Example
223
+ /// Note: embedding SSL certificates and keys in the binary is not advised.
224
+ /// This is for illustration purposes only.
225
+ ///
226
+ /// ```rust
227
+ /// # use sqlx_core::mysql::{MySqlSslMode, MySqlConnectOptions};
228
+ ///
229
+ /// const CERT: &[u8] = b"\
230
+ /// -----BEGIN CERTIFICATE-----
231
+ /// <Certificate data here.>
232
+ /// -----END CERTIFICATE-----";
233
+ ///
234
+ /// let options = MySqlConnectOptions::new()
235
+ /// .ssl_mode(MySqlSslMode::VerifyCa)
236
+ /// .ssl_client_cert_from_pem(CERT);
237
+ /// ```
238
+ pub fn ssl_client_cert_from_pem ( mut self , cert : impl AsRef < [ u8 ] > ) -> Self {
239
+ self . ssl_client_cert = Some ( CertificateInput :: Inline ( cert. as_ref ( ) . to_vec ( ) ) ) ;
240
+ self
241
+ }
242
+
218
243
/// Sets the name of a file containing SSL client key.
219
244
///
220
245
/// # Example
@@ -230,6 +255,31 @@ impl MySqlConnectOptions {
230
255
self
231
256
}
232
257
258
+ /// Sets the SSL client key as a PEM-encoded byte slice.
259
+ ///
260
+ /// This should be an ASCII-encoded blob that starts with `-----BEGIN PRIVATE KEY-----`.
261
+ ///
262
+ /// # Example
263
+ /// Note: embedding SSL certificates and keys in the binary is not advised.
264
+ /// This is for illustration purposes only.
265
+ ///
266
+ /// ```rust
267
+ /// # use sqlx_core::mysql::{MySqlSslMode, MySqlConnectOptions};
268
+ ///
269
+ /// const KEY: &[u8] = b"\
270
+ /// -----BEGIN PRIVATE KEY-----
271
+ /// <Private key data here.>
272
+ /// -----END PRIVATE KEY-----";
273
+ ///
274
+ /// let options = MySqlConnectOptions::new()
275
+ /// .ssl_mode(MySqlSslMode::VerifyCa)
276
+ /// .ssl_client_key_from_pem(KEY);
277
+ /// ```
278
+ pub fn ssl_client_key_from_pem ( mut self , key : impl AsRef < [ u8 ] > ) -> Self {
279
+ self . ssl_client_key = Some ( CertificateInput :: Inline ( key. as_ref ( ) . to_vec ( ) ) ) ;
280
+ self
281
+ }
282
+
233
283
/// Sets the capacity of the connection's statement cache in a number of stored
234
284
/// distinct statements. Caching is handled using LRU, meaning when the
235
285
/// amount of queries hits the defined limit, the oldest statement will get
0 commit comments