HKDF for a Java userspace implementation?

crasm at crasm at
Sat Feb 11 01:25:57 CET 2017


I've started tinkering with a Java implementation of wireguard. I'm in
the early stages: the current goal is to be able to build the first
message using hardcoded parameters. I'm new to crypto and doing this
mainly for fun, curiosity, and to have wireguard on my phone.

I'm stuck on calculating the HMAC-BLAKE2s. Specifically,

    Hmac(key, input):
        Hmac-Blake2s(key, input), the ordinary BLAKE2s hash function
        used in an HMAC construction, returning 32 bytes of output.

Is there an existing library that does HKDF with BLAKE2s? Am I supposed
to write the HMAC construction myself using RFC5869 and the cited HKDF
paper [1]?

noise-java [2] can do regular BLAKE2s hashes (and I'm using that part),
but it doesn't include HMAC. Is there anything in libsodium [3] that can
help? Can someone with Java crypto experience point me in the right

Lastly, has someone already done this so I can get started on the
Android app instead? ;)

Christian Demsar


More information about the WireGuard mailing list