From 234957bcadf1c15648cea55e795a8e177a7e554d Mon Sep 17 00:00:00 2001 From: Emanuele Rocca Date: Tue, 20 Jun 2023 10:44:43 +0200 Subject: [PATCH] Bump base64 dependency to 0.21.0 Signed-off-by: Emanuele Rocca --- Cargo.toml | 2 +- src/key_info_managers/on_disk_manager/mod.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4293ba5b..25604526 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ path = "src/bin/main.rs" [dependencies] parsec-interface = "0.28.0" rand = { version = "0.8.3", features = ["small_rng"], optional = true } -base64 = "0.13.0" +base64 = "0.21.0" uuid = "0.8.2" threadpool = "1.8.1" signal-hook = "0.3.4" diff --git a/src/key_info_managers/on_disk_manager/mod.rs b/src/key_info_managers/on_disk_manager/mod.rs index 632ae429..26bd1593 100644 --- a/src/key_info_managers/on_disk_manager/mod.rs +++ b/src/key_info_managers/on_disk_manager/mod.rs @@ -40,6 +40,7 @@ use std::ops::Deref; use std::os::unix::fs::PermissionsExt; use std::path::{Path, PathBuf}; use std::{fmt, fs}; +use base64::Engine; /// Default path where the mapping files will be stored on disk pub const DEFAULT_MAPPINGS_PATH: &str = "/var/lib/parsec/mappings"; @@ -240,9 +241,9 @@ pub struct OnDiskKeyInfoManager { #[allow(deprecated)] fn key_triple_to_base64_filenames(key_triple: &KeyTriple) -> (String, String, String) { ( - base64::encode_config(key_triple.app_name.as_bytes(), base64::URL_SAFE), + base64::engine::general_purpose::URL_SAFE.encode(key_triple.app_name.as_bytes()), (key_triple.provider_id as u8).to_string(), - base64::encode_config(key_triple.key_name.as_bytes(), base64::URL_SAFE), + base64::engine::general_purpose::URL_SAFE.encode(key_triple.key_name.as_bytes()), ) } @@ -252,7 +253,7 @@ fn key_triple_to_base64_filenames(key_triple: &KeyTriple) -> (String, String, St /// /// Returns an error as a string if either the decoding or the bytes conversion to UTF-8 failed. fn base64_data_to_string(base64_bytes: &[u8]) -> Result { - match base64::decode_config(base64_bytes, base64::URL_SAFE) { + match base64::engine::general_purpose::URL_SAFE_NO_PAD.decode(base64_bytes) { Ok(decode_bytes) => match String::from_utf8(decode_bytes) { Ok(string) => Ok(string), Err(error) => Err(error.to_string()),