11// cspell: ignore accessdescs
22
3- #![ allow(
4- clippy:: disallowed_methods,
5- reason = "remaining certificate file access has not been extracted into rustpython-host-env yet"
6- ) ]
7-
83//! Certificate parsing, validation, and conversion utilities for SSL/TLS
94//!
105//! This module provides reusable functions for working with X.509 certificates:
@@ -644,7 +639,7 @@ impl<'a> CertLoader<'a> {
644639 ///
645640 /// Returns statistics about loaded certificates
646641 pub fn load_from_file ( & mut self , path : & str ) -> Result < CertStats , std:: io:: Error > {
647- let contents = std :: fs :: read ( path) ?;
642+ let contents = rustpython_host_env :: fileutils :: read ( path) ?;
648643 self . load_from_bytes ( & contents)
649644 }
650645
@@ -653,7 +648,7 @@ impl<'a> CertLoader<'a> {
653648 /// Reads all files in the directory and attempts to parse them as certificates.
654649 /// Invalid files are silently skipped (matches OpenSSL capath behavior).
655650 pub fn load_from_dir ( & mut self , dir_path : & str ) -> Result < CertStats , std:: io:: Error > {
656- let entries = std :: fs :: read_dir ( dir_path) ?;
651+ let entries = rustpython_host_env :: fileutils :: read_dir ( dir_path) ?;
657652 let mut stats = CertStats :: default ( ) ;
658653
659654 for entry in entries {
@@ -663,7 +658,7 @@ impl<'a> CertLoader<'a> {
663658 // Skip directories and process all files
664659 // OpenSSL capath uses hash-based naming like "4e1295a3.0"
665660 if path. is_file ( )
666- && let Ok ( contents) = std :: fs :: read ( & path)
661+ && let Ok ( contents) = rustpython_host_env :: fileutils :: read ( & path)
667662 {
668663 // Ignore errors for individual files (some may not be certs)
669664 if let Ok ( file_stats) = self . load_from_bytes ( & contents) {
@@ -1134,7 +1129,7 @@ pub(super) fn load_cert_chain_from_file(
11341129 password : Option < & str > ,
11351130) -> Result < ( Vec < CertificateDer < ' static > > , PrivateKeyDer < ' static > ) , Box < dyn core:: error:: Error > > {
11361131 // Load certificate file - preserve io::Error for errno
1137- let cert_contents = std :: fs :: read ( cert_path) ?;
1132+ let cert_contents = rustpython_host_env :: fileutils :: read ( cert_path) ?;
11381133
11391134 // Parse certificates (PEM format)
11401135 let mut cert_cursor = std:: io:: Cursor :: new ( & cert_contents) ;
@@ -1147,7 +1142,7 @@ pub(super) fn load_cert_chain_from_file(
11471142 }
11481143
11491144 // Load private key file - preserve io::Error for errno
1150- let key_contents = std :: fs :: read ( key_path) ?;
1145+ let key_contents = rustpython_host_env :: fileutils :: read ( key_path) ?;
11511146
11521147 // Parse private key (supports PKCS8, RSA, EC formats)
11531148 let private_key = if let Some ( pwd) = password {
0 commit comments