-
Notifications
You must be signed in to change notification settings - Fork 67
add support for CMW evidence format - agent side #1051
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: HarshvMahawar <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
@HarshvMahawar make sure that all the test pass. @ansasaki can you have a look? |
pub fn decode_cmw(cmw: &CMW) -> Result<HashMap<String, Value>, String> { | ||
let mut result = HashMap::new(); | ||
|
||
let tpms_attest = general_purpose::URL_SAFE_NO_PAD | ||
.decode(&cmw.evidence.tpms_attest.1) | ||
.map_err(|e| format!("Failed to decode TPMS_ATTEST: {}", e))?; | ||
result.insert("TPMS_ATTEST".to_string(), json!(tpms_attest)); | ||
|
||
let tpmt_signature = general_purpose::URL_SAFE_NO_PAD | ||
.decode(&cmw.evidence.tpmt_signature.1) | ||
.map_err(|e| format!("Failed to decode TPMT_SIGNATURE: {}", e))?; | ||
result.insert("TPMT_SIGNATURE".to_string(), json!(tpmt_signature)); | ||
|
||
let pcrs = general_purpose::URL_SAFE_NO_PAD | ||
.decode(&cmw.evidence.pcr_values.1) | ||
.map_err(|e| format!("Failed to decode PCRs: {}", e))?; | ||
result.insert("PCRs".to_string(), json!(pcrs)); | ||
|
||
let event_log_bin = general_purpose::URL_SAFE_NO_PAD | ||
.decode(&cmw.evidence.event_log.1) | ||
.map_err(|e| format!("Failed to decode event_log: {}", e))?; | ||
result.insert("event_log".to_string(), json!(event_log_bin)); | ||
|
||
let metadata_str = general_purpose::URL_SAFE_NO_PAD | ||
.decode(&cmw.evidence.keylime_metadata.1) | ||
.map_err(|e| format!("Failed to decode keylime_metadata: {}", e))?; | ||
let metadata_json: Value = serde_json::from_slice(&metadata_str) | ||
.map_err(|e| format!("Invalid metadata JSON: {}", e))?; | ||
result.insert("keylime_metadata".to_string(), metadata_json); | ||
|
||
Ok(result) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be possible to derive the Deserialiaze
trait for the Evidence
structure (and all internal structures) and set the method used for deserialization using serde annotations (maybe deserialize_with
)?
Maybe it would be possible to reuse the methods in keylime/src/serialization
.
Then you could use the Evidence
structure directly instead of using a generic HashMap
.
Server side - keylime/keylime#1777
Concise Summary
Support CMW-based evidence serving instead of custom quote format
This PR adds initial support for sending attestation evidence encoded using the Conceptual Message Wrapper (CMW), as prescribed by the IETF draft. It introduces encoding logic and also introduced an api-version
v2.4
(subject to approval) to serve the CMWe.g.
curl -vk --cert /var/lib/keylime/cv_ca/client-cert.crt --key /var/lib/keylime/cv_ca/client-private.pem "https://localhost:9002/v2.4/quotes/integrity?nonce=1234567890ABCDEF&mask=0x10401&partial=0" | jq