Class CanonicalHashes

java.lang.Object
io.jans.lock.trace.crypto.bc.CanonicalHashes

public final class CanonicalHashes extends Object
SHA-256 digests in the TRACE sha256:<64 lowercase hex> format over raw bytes or over the JCS canonical form of a JSON value.

Delegates to TraceHashes, which uses the JDK provider so it behaves the same in the standard and the FIPS (BouncyCastle FIPS) WAR variants.

Author:
Yuriy Movchan
  • Field Details

  • Method Details

    • sha256Prefixed

      public static String sha256Prefixed(byte[] input)
      Returns:
      "sha256:" + lowercaseHex(SHA-256(input))
    • sha256PrefixedOfJcs

      public static String sha256PrefixedOfJcs(com.fasterxml.jackson.databind.JsonNode node)
      Returns:
      "sha256:" + lowercaseHex(SHA-256(UTF-8(JCS(node))))
      Throws:
      JcsException - if the node cannot be canonicalized