Package eu.europa.esig.dss.spi
Class DSSMessageDigestCalculator
java.lang.Object
eu.europa.esig.dss.spi.DSSMessageDigestCalculator
This class is used to compute
DSSMessageDigest based on the provided input-
Constructor Summary
ConstructorsConstructorDescriptionDSSMessageDigestCalculator(DigestAlgorithm digestAlgorithm) Default constructor with a single digest algorithmDSSMessageDigestCalculator(Collection<DigestAlgorithm> digestAlgorithms) Constructor with multiple digest algorithms -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.since DSS 6.3.getMessageDigest(DigestAlgorithm digestAlgorithm) Returns theDSSMessageDigestaccordingly to the givendigestAlgorithmThis method resets the state of message-digest.Gets OutputStream that can be used to calculate digest on the fly.getOutputStream(OutputStream outputStream) Gets OutputStream that can be used to calculate digest on the fly.voidupdate(byte byteToAdd) Updates the digest using the provided bytevoidupdate(byte[] bytes) Updates the digest using the provided array of bytesvoidupdate(byte[] bytes, int offset, int length) Updates the bytes starting from the offset and a specified lengthvoidupdate(InputStream inputStream) Updates the digest by reading the providedInputStream.
-
Constructor Details
-
DSSMessageDigestCalculator
Default constructor with a single digest algorithm- Parameters:
digestAlgorithm-DigestAlgorithmto be used for message-digest computation
-
DSSMessageDigestCalculator
Constructor with multiple digest algorithms- Parameters:
digestAlgorithms-DigestAlgorithmto be used for message-digest computation
-
-
Method Details
-
update
public void update(byte byteToAdd) Updates the digest using the provided byte- Parameters:
byteToAdd- byte to be added for digest computation
-
update
public void update(byte[] bytes) Updates the digest using the provided array of bytes- Parameters:
bytes- array of bytes
-
update
public void update(byte[] bytes, int offset, int length) Updates the bytes starting from the offset and a specified length- Parameters:
bytes- array of bytesoffset- to start bytes update fromlength- the length of bytes array to be updated
-
update
Updates the digest by reading the providedInputStream. NOTE: the method consumes theInputStream, and closes it after.- Parameters:
inputStream-InputStream- Throws:
IOException- if an error is thrown on InputStream reading
-
getMessageDigest
Deprecated.since DSS 6.3. Please use#getMessageDigest(DigestAlgorithm)method instead.Returns theDSSMessageDigestaccordingly to the current state. This method resets the state of message-digest.- Returns:
DSSMessageDigest
-
getMessageDigest
Returns theDSSMessageDigestaccordingly to the givendigestAlgorithmThis method resets the state of message-digest.- Parameters:
digestAlgorithm-DigestAlgorithmto get a correspondingDSSMessageDigestfor- Returns:
DSSMessageDigest
-
getOutputStream
Gets OutputStream that can be used to calculate digest on the fly. This method will update the digest within the current instance ofDSSMessageDigestCalculator, when the returnedOutputStreamis being updated.- Returns:
OutputStream
-
getOutputStream
Gets OutputStream that can be used to calculate digest on the fly. This method will write the binaries into the providedoutputStreamas well as will update the digest within the current instance ofDSSMessageDigestCalculator- Parameters:
outputStream- to be embedded into- Returns:
OutputStream
-