This commit is contained in:
Ajinkya Kulkarni 2024-12-04 22:00:18 +01:00
parent 64c0fc43de
commit 29c642d64c

View file

@ -9,6 +9,7 @@ use serde_json::{json, Value};
use std::collections::HashMap;
use std::{fs, path::Path};
use x509_cert::Certificate;
type TcbInfo = String;
type Fmspc = String;
type Update = String;
@ -122,9 +123,11 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> {
fn verify_signature(tcbinfo: String, key: VerifyingKey) -> bool {
let signed_tcbinfo =
SignedTcbInfo::try_from(tcbinfo.as_ref()).expect("tcbinfo string parsing failed");
signed_tcbinfo
if let Err(_) = signed_tcbinfo
.verify(Some(&key), None)
.expect("could not verify signature");
{
return false
}
true
}