Class HKDFBytesGenerator
java.lang.Object
org.bouncycastle.crypto.generators.HKDFBytesGenerator
- All Implemented Interfaces:
DerivationFunction
HMAC-based Extract-and-Expand Key Derivation Function (HKDF) implemented
according to IETF RFC 5869, May 2010 as specified by H. Krawczyk, IBM
Research & P. Eronen, Nokia. It uses a HMac internally to compute de OKM
(output keying material) and is likely to have better security properties
than KDF's based on just a hash function.
-
Constructor Summary
ConstructorDescriptionHKDFBytesGenerator
(Digest hash) Creates a HKDFBytesGenerator based on the given hash function. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
extractPRK
(byte[] salt, byte[] ikm) Performs the extract part of the key derivation function.int
generateBytes
(byte[] out, int outOff, int len) void
init
(DerivationParameters param)
-
Constructor Details
-
HKDFBytesGenerator
Creates a HKDFBytesGenerator based on the given hash function.- Parameters:
hash
- the digest to be used as the source of generatedBytes bytes
-
-
Method Details
-
init
- Specified by:
init
in interfaceDerivationFunction
-
extractPRK
public byte[] extractPRK(byte[] salt, byte[] ikm) Performs the extract part of the key derivation function.- Parameters:
salt
- the salt to useikm
- the input keying material- Returns:
- the PRK as KeyParameter
-
getDigest
-
generateBytes
public int generateBytes(byte[] out, int outOff, int len) throws DataLengthException, IllegalArgumentException - Specified by:
generateBytes
in interfaceDerivationFunction
- Throws:
DataLengthException
IllegalArgumentException
-