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

Method get_verified_chain

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

Source from the content-addressed store, hash-verified

4001
4002 #[pymethod]
4003 fn get_verified_chain(&self, vm: &VirtualMachine) -> PyResult<Option<PyListRef>> {
4004 // Get peer certificates (what peer sent during handshake)
4005 let conn_guard = self.connection.lock();
4006 let Some(ref conn) = *conn_guard else {
4007 return Ok(None);
4008 };
4009
4010 let peer_certs = conn.peer_certificates();
4011
4012 let Some(peer_certs_slice) = peer_certs else {
4013 return Ok(None);
4014 };
4015
4016 // Build the verified chain using cert module
4017 let ctx_guard = self.context.read();
4018 let ca_certs_der = ctx_guard.ca_certs_der.read();
4019
4020 let chain_der = cert::build_verified_chain(peer_certs_slice, &ca_certs_der);
4021
4022 // Convert DER chain to Python list of Certificate objects
4023 let cert_list: Vec<PyObjectRef> = chain_der
4024 .into_iter()
4025 .map(|der_bytes| PySSLCertificate { der_bytes }.into_ref(&vm.ctx).into())
4026 .collect();
4027
4028 Ok(Some(vm.ctx.new_list(cert_list)))
4029 }
4030
4031 #[pymethod]
4032 fn shutdown(&self, vm: &VirtualMachine) -> PyResult<PyObjectRef> {

Callers

nothing calls this directly

Calls 10

build_verified_chainFunction · 0.85
peer_certificatesMethod · 0.80
collectMethod · 0.80
new_listMethod · 0.80
SomeClass · 0.50
lockMethod · 0.45
readMethod · 0.45
mapMethod · 0.45
into_iterMethod · 0.45
into_refMethod · 0.45

Tested by

no test coverage detected