1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-12-20 04:49:21 +00:00

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
commit 46e0f3c43a
No known key found for this signature in database
GPG key ID: FC8A7D14C3CD543A
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();