From 3ec58c3ca245930979469b276d909678e830c2e3 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Tue, 29 Jun 2021 11:27:54 -0700 Subject: [PATCH] Ensure launch occurs with minimal ciphersuites. Co-authored-by: Abdullah Alyan --- core/lib/tests/can-launch-tls.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 core/lib/tests/can-launch-tls.rs diff --git a/core/lib/tests/can-launch-tls.rs b/core/lib/tests/can-launch-tls.rs new file mode 100644 index 00000000..4cdeb3aa --- /dev/null +++ b/core/lib/tests/can-launch-tls.rs @@ -0,0 +1,21 @@ +use rocket::fs::relative; +use rocket::config::{Config, TlsConfig, CipherSuite}; +use rocket::local::asynchronous::Client; + +#[rocket::async_test] +async fn can_launch_tls() { + let cert_path = relative!("examples/tls/private/rsa_sha256_cert.pem"); + let key_path = relative!("examples/tls/private/rsa_sha256_key.pem"); + + let tls = TlsConfig::from_paths(cert_path, key_path) + .with_ciphers([ + CipherSuite::TLS_AES_128_GCM_SHA256, + CipherSuite::TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, + ]); + + let rocket = rocket::custom(Config { tls: Some(tls), ..Config::debug_default() }); + let client = Client::debug(rocket).await.unwrap(); + + client.rocket().shutdown().notify(); + client.rocket().shutdown().await; +}