Skip to content

Commit

Permalink
UGH I NEED TO FIX THE TYPES
Browse files Browse the repository at this point in the history
  • Loading branch information
labbott committed Aug 5, 2024
1 parent 66405ae commit 68261bf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,26 @@ impl PkiPathSignatureVerifier {
}
}

pub fn verify_signature(
alias: &Certificate,
hash: &[u8],
signature: &[u8; 64],
) -> Result<()> {
use ed25519_dalek::{Signature, Verifier, VerifyingKey};

let signature = Signature::from_bytes(signature);

let alias = alias
.tbs_certificate
.subject_public_key_info
.subject_public_key
.as_bytes()
.ok_or_else(|| anyhow!("Invalid / unaligned public key"))?;

let verifying_key = VerifyingKey::from_bytes(alias.try_into()?)?;
Ok(verifying_key.verify(&hash, &signature)?)
}

pub fn verify_attestation(
alias: &Certificate,
attestation: &Attestation,
Expand Down

0 comments on commit 68261bf

Please sign in to comment.