Class TraceHashes

java.lang.Object
io.jans.lock.trace.crypto.TraceHashes

public final class TraceHashes extends Object
Provider-neutral hash constants and helpers shared by every TraceCryptoProvider implementation and by the service. Uses the JDK MessageDigest, so it behaves the same in the standard and the FIPS WAR variants.
Author:
Yuriy Movchan
  • Field Details

    • SHA256_PREFIX

      public static final String SHA256_PREFIX
      Prefix of every TRACE hash string.
      See Also:
    • ZERO_HASH

      public static final String ZERO_HASH
      The genesis predecessor sentinel: "sha256:" followed by 64 zero digits.
    • RECEIPT_PROFILE

      public static final String RECEIPT_PROFILE
      Receipt-commitment profile tag (GovOps profile §11). It is the receipt_profile member of every receipt-hash input; a different receipt-hash layout needs a new tag.
      See Also:
  • Method Details

    • sha256Prefixed

      public static String sha256Prefixed(byte[] input)
      Returns:
      "sha256:" + lowercaseHex(SHA-256(input))
      Throws:
      IllegalArgumentException - if input is null
    • sha256Hex

      public static String sha256Hex(byte[] input)
      Returns:
      lowercaseHex(SHA-256(input)) without prefix, for storage keys
      Throws:
      IllegalArgumentException - if input is null