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 authored and ionut-arm committed Sep 11, 2023
1 parent 34b45f3 commit f8a5e4d
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 @@ -28,6 +28,7 @@ use crate::providers::tpm::Provider as TpmProvider;
#[cfg(feature = "trusted-service-provider")]
use crate::providers::trusted_service::Provider as TrustedServiceProvider;
use anyhow::{Context, Result};
use base64::Engine;
use log::{error, info, warn};
use parsec_interface::requests::{AuthType, ProviderId};
use std::collections::HashMap;
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 f8a5e4d

Please sign in to comment.