pub fn load_private_key(filename: &str) -> io::Result<rustls::PrivateKey> {
    // Open keyfile.
    let keyfile = fs::File::open(filename)
        .map_err(|e| error(format!("failed to open {}: {}", filename, e)))?;
    let mut reader = io::BufReader::new(keyfile);

    // Load and return a single private key.
    let keys = pemfile::rsa_private_keys(&mut reader)
        .map_err(|_| error("failed to load private key".into()))?;
    if keys.len() != 1 {
        return Err(error("expected a single private key".into()));
    }
    Ok(keys[0].clone())
}
// Load private key from file.
Load private key from file.
Load private key from file .
pub fn load_private_key(filename: &str) -> io::Result<rustls::PrivateKey> {
    // Open keyfile.
    let keyfile = fs::File::open(filename)
        .map_err(|e| error(format!("failed to open {}: {}", filename, e)))?;
    let mut reader = io::BufReader::new(keyfile);
    // Load and return a single private key.
    let keys = pemfile::rsa_private_keys(&mut reader)
        .map_err(|_| error("failed to load private key".into()))?;
    if keys.len() != 1 {
        return Err(error("expected a single private key".into()));
    }
    Ok(keys[0].clone())
}
pub fn load_private_key ( filename : & str ) -> io :: Result < rustls :: PrivateKey > { // Open keyfile. let keyfile = fs :: File :: open ( filename ) . map_err ( | e | error ( format ! ( " " filename e ) ) ) ? ; let mut reader = io :: BufReader :: new ( keyfile ) ; // Load and return a single private key. let keys = pemfile :: rsa_private_keys ( & mut reader ) . map_err ( | _ | error ( " " . into ( ) ) ) ? ; if keys . len ( ) != 1 { return Err ( error ( " " . into ( ) ) ) ; } Ok ( keys [ 0 ] . clone ( ) ) }
Load private key from file.
Load private key from file .
filename
&str
filename
&str