add support for CMW evidence format - agent side#1051
Open
HarshvMahawar wants to merge 2 commits intokeylime:masterfrom
Open
add support for CMW evidence format - agent side#1051HarshvMahawar wants to merge 2 commits intokeylime:masterfrom
HarshvMahawar wants to merge 2 commits intokeylime:masterfrom
Conversation
Signed-off-by: HarshvMahawar <hv062727@gmail.com>
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:
|
30 tasks
Member
|
@HarshvMahawar make sure that all the test pass. @ansasaki can you have a look? |
ansasaki
reviewed
Jul 30, 2025
Comment on lines
+187
to
+218
| 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) | ||
| } |
Contributor
There was a problem hiding this comment.
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.
30 tasks
30 tasks
36 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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