MCPcopy Index your code
hub / github.com/RustPython/RustPython / normalize_cipher_name

Function normalize_cipher_name

crates/stdlib/src/ssl/compat.rs:2265–2273  ·  view source on GitHub ↗

Normalize cipher suite name for OpenSSL compatibility Converts rustls cipher names to OpenSSL format: - TLS_AES_256_GCM_SHA384 → AES256-GCM-SHA384 - Replaces "AES-256" with "AES256" and "AES-128" with "AES128"

(rustls_name: &str)

Source from the content-addressed store, hash-verified

2263/// - TLS_AES_256_GCM_SHA384 → AES256-GCM-SHA384
2264/// - Replaces "AES-256" with "AES256" and "AES-128" with "AES128"
2265pub(super) fn normalize_cipher_name(rustls_name: &str) -> String {
2266 rustls_name
2267 .strip_prefix("TLS_")
2268 .unwrap_or(rustls_name)
2269 .replace("_WITH_", "_")
2270 .replace('_', "-")
2271 .replace("AES-256", "AES256")
2272 .replace("AES-128", "AES128")
2273}
2274
2275/// Get cipher key size in bits from cipher suite name
2276///

Callers 1

get_ciphersMethod · 0.85

Calls 2

strip_prefixMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected