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

Method shared_ciphers

crates/stdlib/src/ssl.rs:4436–4463  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

4434
4435 #[pymethod]
4436 fn shared_ciphers(&self, vm: &VirtualMachine) -> Option<PyListRef> {
4437 // Return None for client-side sockets
4438 if !self.server_side {
4439 return None;
4440 }
4441
4442 // Check if handshake completed
4443 if !*self.handshake_done.lock() {
4444 return None;
4445 }
4446
4447 // Get negotiated cipher suite from rustls
4448 let conn_guard = self.connection.lock();
4449 let conn = conn_guard.as_ref()?;
4450
4451 let suite = conn.negotiated_cipher_suite()?;
4452
4453 // Extract cipher information using unified helper
4454 let cipher_info = extract_cipher_info(&suite);
4455
4456 // Return as list with single tuple (name, version, bits)
4457 let tuple = vm.ctx.new_tuple(vec![
4458 vm.ctx.new_str(cipher_info.name).into(),
4459 vm.ctx.new_str(cipher_info.protocol).into(),
4460 vm.ctx.new_int(cipher_info.bits).into(),
4461 ]);
4462 Some(vm.ctx.new_list(vec![tuple.into()]))
4463 }
4464
4465 #[pymethod]
4466 fn verify_client_post_handshake(&self, vm: &VirtualMachine) -> PyResult<()> {

Callers

nothing calls this directly

Calls 7

extract_cipher_infoFunction · 0.85
new_listMethod · 0.80
SomeClass · 0.50
lockMethod · 0.45
as_refMethod · 0.45
new_tupleMethod · 0.45

Tested by

no test coverage detected