Skip to main content

verify_consistency_proof

Function verify_consistency_proof 

Source
pub fn verify_consistency_proof(
    perv_size: u64,
    next_size: u64,
    server_provided_proof: &[[u8; 32]],
    perv_root: &[u8; 32],
    next_root: &[u8; 32],
) -> Result<Vec<ConsistencyProofPart>, String>
Expand description

Verify that the consistency proof given by server_provided_proof gets us from perv_root to next_root, returning an Ok(Vec<ConsistencyProofPart>) if the proof checks, otherwise a Err(String) describing why the proof is invalid.

This function is only useful to those who want to do some custom API calling. If you’re using a CTClient, it will handle proof checking for you.

To fetch the consistency proof from the server and verifies it, call check_consistency_proof.

§Ok(Vec<ConsistencyProofPart>)

The Ok result of this function contains all components of the proof which describes a new tree (that’s not in the previous tree). This can be useful if you want to then get all the new certificates and verify that those forms the new tree.

To do this, calculate the leaf hash of all the new certificates, and call ConsistencyProofPart::verify with the array of leaf hashes. See its documentation for more info.

§Panic

verify_consistency_proof panics if perv_size > next_size.