Package com.bfo.box
Class C2PA_AssertionHashData
java.lang.Object
com.bfo.box.Box
com.bfo.box.JUMBox
com.bfo.box.CborContainerBox
com.bfo.box.C2PA_AssertionHashData
- All Implemented Interfaces:
C2PA_Assertion
A C2PA Assertion for the "c2pa.hash.data" type
- Since:
- 5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetExclusions(long[] exclusions) Set the exclusion range, a sequence of [start, length] pairs determining which bytes from the InputStream read byverify()to read and which to skip.voidsetHashAlgorithm(String alg) Set the hash algorithm.sign()Calculate the digest during signing.verify()Verify this assertion, returning a list of status codes describing why this assertion failed or an empty list if it succeeded.Methods inherited from class com.bfo.box.CborContainerBox
cbor, getBoxMethods inherited from class com.bfo.box.Box
add, dump, duplicate, first, fullType, getEncoded, insertBefore, isSparse, length, next, parent, remove, toString, typeMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.bfo.box.C2PA_Assertion
asBox, getManifest
-
Constructor Details
-
C2PA_AssertionHashData
public C2PA_AssertionHashData()Create a new assertion
-
-
Method Details
-
setExclusions
public void setExclusions(long[] exclusions) Set the exclusion range, a sequence of [start, length] pairs determining which bytes from the InputStream read byverify()to read and which to skip. The list must be in order and must not overlap.- Parameters:
exclusions- an even-numbered list of longs, which may be zero length or null
-
setHashAlgorithm
Set the hash algorithm. If not set, defaults to theC2PAClaim.getHashAlgorithm()- Parameters:
alg- the algorithm
-
sign
Calculate the digest during signing. This assertion retrieves theInputStreamfromC2PAManifest.getInputStream()and calculates the digest based on that, ignoring any ranges specified in the exclusions. This method is called byC2PASignature.sign()and there should be no need to call it manually.- Returns:
- a list of failure codes, or an empty list on success
- Throws:
IOException- if an exception was thrown while calculating the digest
-
verify
Description copied from interface:C2PA_AssertionVerify this assertion, returning a list of status codes describing why this assertion failed or an empty list if it succeeded. The default implementation succeeds, and returns an empty list.- Specified by:
verifyin interfaceC2PA_Assertion- Returns:
- a list of status codes, which may be empty on success
- Throws:
IOException- if the assertion verification involved I/O and the IO layer threw an exception
-