Load RSA keys as pem format directly, and using openssl crate, backported from async branch

This commit is contained in:
Daniel García
2021-06-25 20:49:44 +02:00
parent 2cd17fe7af
commit 46e0f3c43a
7 changed files with 55 additions and 63 deletions

View File

@ -219,6 +219,14 @@ pub fn read_file(path: &str) -> IOResult<Vec<u8>> {
Ok(contents)
}
pub fn write_file(path: &str, content: &[u8]) -> Result<(), crate::error::Error> {
use std::io::Write;
let mut f = File::create(path)?;
f.write_all(content)?;
f.flush()?;
Ok(())
}
pub fn read_file_string(path: &str) -> IOResult<String> {
let mut contents = String::new();