Package com.bfo.box
Class C2PAClaim
java.lang.Object
com.bfo.box.Box
com.bfo.box.JUMBox
com.bfo.box.CborContainerBox
com.bfo.box.C2PAClaim
The claim box
used to stored the claim in a
manifest box
. Every manifest has exactly one claim.- Since:
- 5
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturn the list of assertions that will be part of this claim.Return the format, as loaded or set bysetFormat(java.lang.String)
Return the "claim_generator" field, as loaded or set bysetGenerator(java.lang.String, com.bfo.json.Json)
Return the hash algorithm used to hash any assertions, as loaded or set bysetHashAlgorithm(java.lang.String)
.Return the instance ID, as loaded or set bysetInstanceID(java.lang.String)
void
Set the format - this must be set before signingvoid
setGenerator
(String generator, Json properties) Set the "claim generator", a user-agent string identifying the tooling that created this C2PA claim.void
setHashAlgorithm
(String alg) Set the hash algorithm used to hash any assertions.void
setInstanceID
(String id) Set the instance ID - this should be a UUID and must be set before signingMethods inherited from class com.bfo.box.CborContainerBox
cbor, getBox
-
Method Details
-
setFormat
Set the format - this must be set before signing- Parameters:
format
- the format, eg "application/pdf"
-
getFormat
Return the format, as loaded or set bysetFormat(java.lang.String)
- Returns:
- the format
-
setInstanceID
Set the instance ID - this should be a UUID and must be set before signing- Parameters:
id
- the id
-
getInstanceID
Return the instance ID, as loaded or set bysetInstanceID(java.lang.String)
- Returns:
- the instanace ID
-
setHashAlgorithm
Set the hash algorithm used to hash any assertions. If this is not set before signing, it will be set to SHA256- Parameters:
alg
- the hash algorithm, which should be a valid Java Hash algorithm name.
-
getHashAlgorithm
Return the hash algorithm used to hash any assertions, as loaded or set bysetHashAlgorithm(java.lang.String)
.- Returns:
- the hash algorithm
-
getAssertions
Return the list of assertions that will be part of this claim. Although this list is live can be edited, if it is blank whan the manifest is signed, it will be set to the same value asC2PAManifest.getAssertions()
. All assertions added must be present in that list; all assertions that are returned should be too, and if not the valuenull
will be returned for that entry and the entry cleared when the manifest is signed.- Returns:
- a live list of all the assertions that will be part of this claim.
-
setGenerator
Set the "claim generator", a user-agent string identifying the tooling that created this C2PA claim. If not set before signing, a default value will be used as this is a mandatory field.- Parameters:
generator
- the claim_generator idproperties
- an optional Json that will be stored as claim_generator_info in the C2PA object. This is supposed to be mandatory, but is missing from several official examples - we accept null.
-
getGenerator
Return the "claim_generator" field, as loaded or set bysetGenerator(java.lang.String, com.bfo.json.Json)
- Returns:
- the claim_generator
-