This commit is contained in:
Ajinkya Kulkarni 2024-12-04 20:32:56 +01:00
parent 02cfb3f998
commit 84dac5a47e

View file

@ -98,12 +98,14 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> {
}
fn verify_signature (tcbinfo: Value, key: VerifyingKey) {
let tcbinfo_json = tcbinfo.as_str();
if let Err(e) = tcbinfo_json {
println!("{tcbinfo:?}");
}
let signed_tcbinfo = SignedTcbInfo::try_from().expect("tcbinfo string parsing failed");
let tcbinfo_str = tcbinfo.as_str();
if let Some(st) = tcbinfo_str {
let signed_tcbinfo = SignedTcbInfo::try_from(st).expect("tcbinfo string parsing failed");
signed_tcbinfo.verify(Some(&key), None).expect("could not verify signature");
}
else {
println!("{tcbinfo:?}");
}
}