Class BouncyCastleDigesterFactory

java.lang.Object
org.apache.tika.parser.digestutils.BouncyCastleDigesterFactory
All Implemented Interfaces:
DigesterFactory

public class BouncyCastleDigesterFactory extends Object implements DigesterFactory
Factory for BouncyCastleDigester with configurable algorithms and encodings.

Default: MD5 with HEX encoding.

BouncyCastle supports additional algorithms beyond the standard Java ones, such as SHA3-256, SHA3-384, SHA3-512.

Example JSON configuration (in parse-context section):

{
  "parse-context": {
    "digester-factory": {
      "bouncy-castle-digester-factory": {
        "digests": [
          { "algorithm": "MD5" },
          { "algorithm": "SHA3_256", "encoding": "BASE32" }
        ],
        "skipContainerDocumentDigest": false
      }
    }
  }
}
  • Constructor Details

    • BouncyCastleDigesterFactory

      public BouncyCastleDigesterFactory()
  • Method Details

    • build

      public Digester build()
      Description copied from interface: DigesterFactory
      Build a new Digester instance using the factory's configured properties.
      Specified by:
      build in interface DigesterFactory
      Returns:
      a new Digester instance
    • isSkipContainerDocumentDigest

      public boolean isSkipContainerDocumentDigest()
      Description copied from interface: DigesterFactory
      Returns whether to skip digesting for container (top-level) documents. When true, only embedded documents (depth > 0) will be digested.

      Default implementation returns false (digest everything).

      Specified by:
      isSkipContainerDocumentDigest in interface DigesterFactory
      Returns:
      true if container documents should be skipped, false otherwise
    • setSkipContainerDocumentDigest

      public void setSkipContainerDocumentDigest(boolean skipContainerDocumentDigest)
    • getDigests

      public List<DigestDef> getDigests()
    • setDigests

      public void setDigests(List<DigestDef> digests)