Skip to content

Commit 3a80a3b

Browse files
committed
WIP Update RPK
1 parent 5f29272 commit 3a80a3b

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

tokio-quiche/src/settings/config.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,25 @@ fn quiche_config_with_tls(
233233
},
234234
#[cfg(feature = "rpk")]
235235
CertificateKind::RawPublicKey => {
236-
let mut ssl_ctx_builder = boring::ssl::SslContextBuilder::new_rpk()?;
236+
// boring 5.x replaced the dedicated `SslContextBuilder::new_rpk()`
237+
// entry point with a credential-based API: build an
238+
// `SslCredential` configured for raw public keys and add it
239+
// to a regular `SslContextBuilder` via `add_credential`.
237240
let raw_public_key = read_file(tls.cert)?;
238-
ssl_ctx_builder.set_rpk_certificate(&raw_public_key)?;
239-
240241
let raw_private_key = read_file(tls.private_key)?;
241242
let pkey =
242243
boring::pkey::PKey::private_key_from_pem(&raw_private_key)?;
243-
ssl_ctx_builder.set_null_chain_private_key(&pkey)?;
244+
245+
let mut credential_builder =
246+
boring::ssl::SslCredential::new_raw_public_key()?;
247+
credential_builder.set_spki_bytes(Some(&raw_public_key))?;
248+
credential_builder.set_private_key(&pkey)?;
249+
let credential = credential_builder.build();
250+
251+
let mut ssl_ctx_builder = boring::ssl::SslContextBuilder::new(
252+
boring::ssl::SslMethod::tls(),
253+
)?;
254+
ssl_ctx_builder.add_credential(&credential)?;
244255

245256
Ok(quiche::Config::with_boring_ssl_ctx_builder(
246257
quiche::PROTOCOL_VERSION,

0 commit comments

Comments
 (0)