Function c2pa::cose_sign::sign_claim

source ·
pub fn sign_claim(
    claim_bytes: &[u8],
    signer: &dyn Signer,
    box_size: usize
) -> Result<Vec<u8>>
Expand description

Generate a COSE signature for a block of bytes which must be a valid C2PA claim structure.

Should only be used when the underlying signature mechanism is detached from the generation of the C2PA manifest (and thus the claim embedded in it).

§Actions taken

  1. Verifies that the data supplied is a valid C2PA claim. The function will respond with Error::ClaimDecoding if not.
  2. Signs the data using the provided Signer instance. Will ensure that the signature is padded to match box_size, which should be the number of bytes reserved for the c2pa.signature JUMBF box in this claim’s manifest. (If box_size is too small for the generated signature, this function will respond with an error.)
  3. Verifies that the signature is valid COSE. Will respond with an error Error::CoseSignature if unable to validate.