Class JdkHmac

java.lang.Object
io.github.mahmoudimus.verifiedcrypto.JdkHmac

public final class JdkHmac extends Object
Reviewed JCE boundary named by the verified HKDF kernel's sole external contract (VerifiedHkdf.Mac). This class performs no cryptographic construction of its own: it selects the standard HmacSHA256/384/512 provider operation, copies values at the Dafny boundary, and checks the provider's output length.

Trust: JCE provider selection, provider correctness, key/input handling inside Mac, its doFinal reset semantics, and JVM timing are outside the Dafny proof. Each call creates a fresh Mac, so no provider state is shared. Secret-bearing Dafny sequences and temporary arrays are not guaranteed to be erased.

  • Method Details

    • compute

      public static dafny.DafnySequence<? extends Byte> compute(BigInteger hashLen, dafny.DafnySequence<? extends Byte> key, dafny.DafnySequence<? extends Byte> input)
    • bytes

      public static byte[] bytes(dafny.DafnySequence<? extends Byte> sequence)
      Copies a production byte sequence through DafnyRuntime's primitive bulk-copy path.

      Pinned DafnyRuntime 4.9.1 DafnySequence.toRawArray() calls toArray().unwrap(). For an ArrayDafnySequence backed by a primitive byte[], toArray() clones the primitive array; for a forced ConcatDafnySequence, the copier uses the ArrayDafnySequence fast path with System.arraycopy and then toArray() clones again. The returned array is a fresh primitive copy and no select/Byte.valueOf occurs. Other representations fail closed rather than silently unboxing.