Package net.i2p.crypto
Class HKDF
- java.lang.Object
-
- net.i2p.crypto.HKDF
-
public final class HKDF extends Object
Various flavors of HKDF using HMAC-SHA256. See RFC 5869. One or two outputs, with or without "info". All keys and outputs are exactly 32 bytes.- Since:
- 0.9.38
-
-
Constructor Summary
Constructors Constructor Description HKDF(I2PAppContext context)
Thread safe, no state, can be reused
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
calculate(byte[] key, byte[] data, byte[] out)
One output, no info.void
calculate(byte[] key, byte[] data, byte[] out, byte[] out2, int off2)
Two outputs, no info.void
calculate(byte[] key, byte[] data, String info, byte[] out)
One output with info.void
calculate(byte[] key, byte[] data, String info, byte[] out, byte[] out2, int off2)
Two outputs with info.
-
-
-
Constructor Detail
-
HKDF
public HKDF(I2PAppContext context)
Thread safe, no state, can be reused
-
-
Method Detail
-
calculate
public void calculate(byte[] key, byte[] data, byte[] out)
One output, no info.- Parameters:
key
- first 32 bytes used as the keyout
- must be exactly 32 bytes
-
calculate
public void calculate(byte[] key, byte[] data, String info, byte[] out)
One output with info.- Parameters:
key
- first 32 bytes used as the keyinfo
- non-null ASCII, "" if noneout
- must be exactly 32 bytes
-
calculate
public void calculate(byte[] key, byte[] data, byte[] out, byte[] out2, int off2)
Two outputs, no info.- Parameters:
key
- first 32 bytes used as the keyout
- 32 bytes will be copied to hereout2
- 32 bytes will be copied to here, may be the same as outoff2
- offset for copy to out2
-
calculate
public void calculate(byte[] key, byte[] data, String info, byte[] out, byte[] out2, int off2)
Two outputs with info.- Parameters:
key
- first 32 bytes used as the keyinfo
- non-null ASCII, "" if noneout
- 32 bytes will be copied to hereout2
- 32 bytes will be copied to here, may be the same as outoff2
- offset for copy to out2
-
-