From 8530a4218521056b7a12ad6493de5605b620a9a5 Mon Sep 17 00:00:00 2001 From: Juliette Pretot Date: Mon, 20 May 2024 15:03:05 +0000 Subject: [PATCH] Update deprecated method use for base64 crate Change-Id: Ic8a145734fddfe8dda4c99051c62af11286c9a7a --- Cargo.lock | 8 +++++++- oak_attestation_explain/src/lib.rs | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3dca545715..8e88ca324bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -342,6 +342,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -2322,7 +2328,7 @@ name = "oak_attestation_explain" version = "0.1.0" dependencies = [ "anyhow", - "base64 0.13.1", + "base64 0.22.1", "hex", "oak_attestation_verification", "oak_attestation_verification_test_utils", diff --git a/oak_attestation_explain/src/lib.rs b/oak_attestation_explain/src/lib.rs index 1eb482790b7..50352239b7d 100644 --- a/oak_attestation_explain/src/lib.rs +++ b/oak_attestation_explain/src/lib.rs @@ -24,6 +24,7 @@ extern crate std; use alloc::{format, string::String}; use anyhow::{Context, Result}; +use base64::{prelude::BASE64_STANDARD, Engine as _}; use oak_proto_rust::oak::{ attestation::v1::{ root_layer_data::Report, ApplicationLayerData, ApplicationLayerReferenceValues, @@ -85,8 +86,9 @@ fn make_reference_values_human_readable(value: &mut serde_yaml::Value) { // The proto3 JSON mapping spec uses base64 encoding. let base64_encoded_hash = hash_value.as_str().expect("validated as string in prior conditional"); - let hash = - base64::decode(base64_encoded_hash).expect("invalid base64 digest hash"); + let hash = BASE64_STANDARD + .decode(base64_encoded_hash) + .expect("invalid base64 digest hash"); *hash_value = serde_yaml::Value::String(hex::encode(hash)); }) };