Skip to content

Commit

Permalink
cdh/kms: cckbc use AA to get evidence rather than token
Browse files Browse the repository at this point in the history
When we use one AA and multiple CDH to connect to different KBS in one
confidential VM, AATokenProvider will strict the KBS be the same. If we
use AAEvidenceProvider, the target KBS address can be specified in CDH's
config and share a same AA.

This will also make the workflow simpler. Before this commit, if we want
to get a confidential resource from KBS, AA should connect to a KBS to
get a token. Then CDH get the token from AA. Then CDH access the KBS.

After this commit, only CDH will access the KBS.

Signed-off-by: Xynnn007 <[email protected]>
  • Loading branch information
Xynnn007 committed Jan 6, 2025
1 parent 198e196 commit b0ee403
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions confidential-data-hub/hub/src/kms/plugins/kbs/cc_kbc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::env;
use async_trait::async_trait;
use kbs_protocol::{
client::KbsClient as KbsProtocolClient,
token_provider::{AATokenProvider, TokenProvider},
evidence_provider::{AAEvidenceProvider, EvidenceProvider},
KbsClientCapabilities, ResourceUri,

Check failure on line 12 in confidential-data-hub/hub/src/kms/plugins/kbs/cc_kbc.rs

View workflow job for this annotation

GitHub Actions / Check (ubuntu-24.04, stable)

unused import: `KbsClientCapabilities`
};
use log::{info, warn};
Expand All @@ -18,16 +18,16 @@ use super::{Error, Result};
use super::Kbc;

pub struct CcKbc {
client: KbsProtocolClient<Box<dyn TokenProvider>>,
client: KbsProtocolClient<Box<dyn EvidenceProvider>>,
}

impl CcKbc {
pub async fn new(kbs_host_url: &str) -> Result<Self> {
let token_provider = AATokenProvider::new().await.map_err(|e| {
Error::KbsClientError(format!("create AA token provider failed: {e:?}"))
let evidence_provider = AAEvidenceProvider::new().await.map_err(|e| {
Error::KbsClientError(format!("create AA evidence provider failed: {e:?}"))
})?;
let client = kbs_protocol::KbsClientBuilder::with_token_provider(
Box::new(token_provider),
let client = kbs_protocol::KbsClientBuilder::with_evidence_provider(
Box::new(evidence_provider),
kbs_host_url,
);

Expand Down

0 comments on commit b0ee403

Please sign in to comment.