Function c2pa::cose_sign::sign_claim_async
source · pub async fn sign_claim_async(
claim_bytes: &[u8],
signer: &dyn AsyncSigner,
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
- Verifies that the data supplied is a valid C2PA claim. The function will
respond with
Error::ClaimDecoding
if not. - Signs the data using the provided
Signer
instance. Will ensure that the signature is padded to matchbox_size
, which should be the number of bytes reserved for thec2pa.signature
JUMBF box in this claim’s manifest. (Ifbox_size
is too small for the generated signature, this function will respond with an error.) - Verifies that the signature is valid COSE. Will respond with an error
Error::CoseSignature
if unable to validate.