From 32d6bae60b40a71efebd3b8cb7e5e67cd4dba289 Mon Sep 17 00:00:00 2001 From: Mikko Ylinen Date: Thu, 25 Jul 2024 12:55:30 +0300 Subject: [PATCH] chore(deps): Bump kbs-types from 0.6.0 to 0.7.0 kbs-types introduces a break in JSON semantics so we bump the kbs protocol version from 0.1.0 to 0.1.1. Signed-off-by: Mikko Ylinen --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- attestation-agent/kbs_protocol/src/client/mod.rs | 2 +- attestation-agent/kbs_protocol/src/client/rcar_client.rs | 4 ++-- attestation-agent/kbs_protocol/src/keypair.rs | 5 ++--- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca04bac31..598fdd1de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3074,9 +3074,9 @@ dependencies = [ [[package]] name = "kbs-types" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "febd73b2b1df274ea454d81ddf76f596af9754410b7ed6f988f2e1782a175da3" +checksum = "9b6441ed73b0faa50707d4de41c6b45c76654b661b96aaf7b26a41331eedc0a5" dependencies = [ "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index d01757083..e96b53e42 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ env_logger = "0.11.3" hex = "0.4.3" hmac = "0.12.1" jwt-simple = { version = "0.12", default-features = false, features = ["pure-rust"] } -kbs-types = "0.6.0" +kbs-types = "0.7.0" lazy_static = "1.4.0" log = "0.4.22" nix = "0.28" diff --git a/attestation-agent/kbs_protocol/src/client/mod.rs b/attestation-agent/kbs_protocol/src/client/mod.rs index c9077f6c9..5febb6911 100644 --- a/attestation-agent/kbs_protocol/src/client/mod.rs +++ b/attestation-agent/kbs_protocol/src/client/mod.rs @@ -48,7 +48,7 @@ pub struct KbsClient { pub(crate) token: Option, } -pub const KBS_PROTOCOL_VERSION: &str = "0.1.0"; +pub const KBS_PROTOCOL_VERSION: &str = "0.1.1"; pub const KBS_GET_RESOURCE_MAX_ATTEMPT: u64 = 3; diff --git a/attestation-agent/kbs_protocol/src/client/rcar_client.rs b/attestation-agent/kbs_protocol/src/client/rcar_client.rs index a2f46b1b7..3493a7e81 100644 --- a/attestation-agent/kbs_protocol/src/client/rcar_client.rs +++ b/attestation-agent/kbs_protocol/src/client/rcar_client.rs @@ -104,7 +104,7 @@ impl KbsClient> { let request = Request { version: String::from(KBS_PROTOCOL_VERSION), tee, - extra_params: String::new(), + extra_params: serde_json::Value::String(String::new()), }; debug!("send auth request to {auth_endpoint}"); @@ -147,7 +147,7 @@ impl KbsClient> { let attest_endpoint = format!("{}/{KBS_PREFIX}/attest", self.kbs_host_url); let attest = Attestation { tee_pubkey, - tee_evidence: evidence, + tee_evidence: serde_json::from_str(&evidence)?, // TODO: change attesters to return Value? }; debug!("send attest request."); diff --git a/attestation-agent/kbs_protocol/src/keypair.rs b/attestation-agent/kbs_protocol/src/keypair.rs index 12670a83e..897724e3e 100644 --- a/attestation-agent/kbs_protocol/src/keypair.rs +++ b/attestation-agent/kbs_protocol/src/keypair.rs @@ -7,7 +7,7 @@ use anyhow::{Context, Result}; use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; use crypto::{ - rsa::{PaddingMode, RSAKeyPair, RSA_KTY}, + rsa::{PaddingMode, RSAKeyPair}, WrapType, }; use kbs_types::{Response, TeePubKey}; @@ -31,11 +31,10 @@ impl TeeKeyPair { let k_mod = URL_SAFE_NO_PAD.encode(self.keypair.n()); let k_exp = URL_SAFE_NO_PAD.encode(self.keypair.e()); - Ok(TeePubKey { + Ok(TeePubKey::RSA { alg: PaddingMode::PKCS1v15.as_ref().to_string(), k_mod, k_exp, - kty: RSA_KTY.to_string(), }) }