Package org.bouncycastle.cert.dane
Class TruncatingDigestCalculator
- java.lang.Object
-
- org.bouncycastle.cert.dane.TruncatingDigestCalculator
-
- All Implemented Interfaces:
DigestCalculator
public class TruncatingDigestCalculator extends java.lang.Object implements DigestCalculator
A calculator which produces a truncated digest from a regular one, with the truncation achieved by dropping off the right most octets.
-
-
Constructor Summary
Constructors Constructor Description TruncatingDigestCalculator(DigestCalculator baseCalculator)
Default constructor - truncate to 28.TruncatingDigestCalculator(DigestCalculator baseCalculator, int length)
Constructor specifying a length.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bouncycastle.asn1.x509.AlgorithmIdentifier
getAlgorithmIdentifier()
Return the algorithm identifier representing the digest implemented by this calculator.byte[]
getDigest()
Return the digest calculated on what has been written to the calculator's output stream.java.io.OutputStream
getOutputStream()
Returns a stream that will accept data for the purpose of calculating a digest.
-
-
-
Constructor Detail
-
TruncatingDigestCalculator
public TruncatingDigestCalculator(DigestCalculator baseCalculator)
Default constructor - truncate to 28.- Parameters:
baseCalculator
- actual calculator for working out the digest.
-
TruncatingDigestCalculator
public TruncatingDigestCalculator(DigestCalculator baseCalculator, int length)
Constructor specifying a length.- Parameters:
baseCalculator
- actual calculator for working out the digest.length
- length in bytes of the final result.
-
-
Method Detail
-
getAlgorithmIdentifier
public org.bouncycastle.asn1.x509.AlgorithmIdentifier getAlgorithmIdentifier()
Description copied from interface:DigestCalculator
Return the algorithm identifier representing the digest implemented by this calculator.- Specified by:
getAlgorithmIdentifier
in interfaceDigestCalculator
- Returns:
- algorithm id and parameters.
-
getOutputStream
public java.io.OutputStream getOutputStream()
Description copied from interface:DigestCalculator
Returns a stream that will accept data for the purpose of calculating a digest. Use org.bouncycastle.util.io.TeeOutputStream if you want to accumulate the data on the fly as well.- Specified by:
getOutputStream
in interfaceDigestCalculator
- Returns:
- an OutputStream
-
getDigest
public byte[] getDigest()
Description copied from interface:DigestCalculator
Return the digest calculated on what has been written to the calculator's output stream.- Specified by:
getDigest
in interfaceDigestCalculator
- Returns:
- a digest.
-
-