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

Function cert_to_py

crates/stdlib/src/openssl/cert.rs:350–357  ·  view source on GitHub ↗

For getpeercert() - returns bytes or dict depending on binary flag

(vm: &VirtualMachine, cert: &X509Ref, binary: bool)

Source from the content-addressed store, hash-verified

348
349 // For getpeercert() - returns bytes or dict depending on binary flag
350 pub(crate) fn cert_to_py(vm: &VirtualMachine, cert: &X509Ref, binary: bool) -> PyResult {
351 if binary {
352 let b = cert.to_der().map_err(|e| convert_openssl_error(vm, e))?;
353 Ok(vm.ctx.new_bytes(b).into())
354 } else {
355 cert_to_dict(vm, cert)
356 }
357 }
358
359 #[pyfunction]
360 pub(crate) fn _test_decode_cert(path: FsPath, vm: &VirtualMachine) -> PyResult {

Callers 3

get_ca_certsMethod · 0.85
getpeercertMethod · 0.85
_test_decode_certFunction · 0.85

Calls 3

convert_openssl_errorFunction · 0.85
cert_to_dictFunction · 0.70
new_bytesMethod · 0.45

Tested by

no test coverage detected