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

Function DER_cert_to_PEM_cert

crates/stdlib/src/ssl.rs:4944–4953  ·  view source on GitHub ↗
(der_cert: ArgBytesLike, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

4942
4943 #[pyfunction]
4944 fn DER_cert_to_PEM_cert(der_cert: ArgBytesLike, vm: &VirtualMachine) -> PyResult<PyStrRef> {
4945 let der_bytes = der_cert.borrow_buf();
4946 let bytes_slice: &[u8] = der_bytes.as_ref();
4947
4948 // Use pem-rfc7468 for RFC 7468 compliant PEM encoding
4949 let pem_str = encode_string("CERTIFICATE", LineEnding::LF, bytes_slice)
4950 .map_err(|e| vm.new_value_error(format!("PEM encoding failed: {e}")))?;
4951
4952 Ok(vm.ctx.new_str(pem_str))
4953 }
4954
4955 #[pyfunction]
4956 fn PEM_cert_to_DER_cert(pem_cert: PyUtf8StrRef, vm: &VirtualMachine) -> PyResult<PyBytesRef> {

Callers

nothing calls this directly

Calls 4

encode_stringFunction · 0.70
borrow_bufMethod · 0.45
as_refMethod · 0.45
new_strMethod · 0.45

Tested by

no test coverage detected