diff --git a/src/part/gen2.rs b/src/part/gen2.rs index 358b198..3f98d7f 100644 --- a/src/part/gen2.rs +++ b/src/part/gen2.rs @@ -18,6 +18,17 @@ pub struct DirPartition { pub data: Vec, } +impl DirPartition { + pub fn check_signature(&self) -> Result<(), String> { + let (m, mdata) = &self.dir.manifest; + if m.verify(&mdata) { + return Ok(()); + } else { + return Err("hash mismatch".into()); + } + } +} + #[derive(Serialize, Deserialize, Clone, Debug)] pub enum Gen2Partition { Dir(DirPartition),