Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump base64 crate to 0.22.0 #24

Merged
merged 4 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --all -- --check

Expand All @@ -17,11 +17,11 @@ jobs:
run:
working-directory: ./clevis-pin-tpm2
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: clevis-pin-tpm2
- name: Check out the policy signtool
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: clevis-pin-tpm2-signtool
repository: puiterwijk/clevis-pin-tpm2-signtool
Expand All @@ -31,10 +31,11 @@ jobs:
tpm2-tss-devel clevis \
swtpm swtpm-tools \
rust cargo clippy \
golang clang-devel
golang clang-devel \
git-core
- name: Remove clevis-pin-tpm2
run: |
dnf erase -y clevis-pin-tpm2
rm -f /usr/bin/clevis-pin-tpm2 /usr/bin/clevis-*-tpm2plus
- name: Build
run: cargo build
- name: Start swtpm
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ tss-esapi = { version = "7.2", features = ["generate-bindings"] }
serde = "1.0"
josekit = "0.7.4"
serde_json = "1.0"
base64 = "0.12.1"
base64 = "0.22.0"
atty = "0.2.14"
tpm2-policy = "0.6.0"
7 changes: 5 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::fs;
use std::str::FromStr;

use anyhow::{Context as anyhow_context, Result};
use base64::Engine;
use serde::Deserialize;
use tpm2_policy::{PublicKey, SignedPolicyList, TPMPolicyStep};
use tss_esapi::{
Expand Down Expand Up @@ -68,15 +69,17 @@ pub(crate) fn serialize_as_base64_url_no_pad<S>(
where
S: serde::Serializer,
{
serializer.serialize_str(&base64::encode_config(bytes, base64::URL_SAFE_NO_PAD))
serializer.serialize_str(&base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(bytes))
}

pub(crate) fn deserialize_as_base64_url_no_pad<'de, D>(deserializer: D) -> Result<Vec<u8>, D::Error>
where
D: serde::Deserializer<'de>,
{
String::deserialize(deserializer).and_then(|string| {
base64::decode_config(&string, base64::URL_SAFE_NO_PAD).map_err(serde::de::Error::custom)
base64::engine::general_purpose::URL_SAFE_NO_PAD
.decode(string)
.map_err(serde::de::Error::custom)
})
}

Expand Down