Skip to content

Commit

Permalink
Bump base64 dependency to 0.21.0
Browse files Browse the repository at this point in the history
Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
  • Loading branch information
ema committed Jun 20, 2023
1 parent 4fb5620 commit 234957b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions src/key_info_managers/on_disk_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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()),
)
}

Expand All @@ -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<String, String> {
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()),
Expand Down

0 comments on commit 234957b

Please sign in to comment.