Class HmacKeyDerivationFunction
- java.lang.Object
-
- com.amazonaws.encryptionsdk.internal.HmacKeyDerivationFunction
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]deriveKey(byte[] info, int length)Returns a pseudorandom key oflengthbytes.static HmacKeyDerivationFunctiongetInstance(String algorithm)Returns anHmacKeyDerivationFunctionobject using the specified algorithm.voidinit(byte[] ikm)Initializes this Hkdf with input keying material.voidinit(byte[] ikm, byte[] salt)Initializes this Hkdf with input keying material and a salt.
-
-
-
Method Detail
-
getInstance
public static HmacKeyDerivationFunction getInstance(String algorithm) throws NoSuchAlgorithmException
Returns anHmacKeyDerivationFunctionobject using the specified algorithm.- Parameters:
algorithm- the standard name of the requested MAC algorithm. See the Mac section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names.- Returns:
- the new
Hkdfobject - Throws:
NoSuchAlgorithmException- if no Provider supports a MacSpi implementation for the specified algorithm.
-
init
public void init(byte[] ikm)
Initializes this Hkdf with input keying material. A default salt of HashLen zeros will be used (where HashLen is the length of the return value of the supplied algorithm).- Parameters:
ikm- the Input Keying Material
-
init
public void init(byte[] ikm, byte[] salt)Initializes this Hkdf with input keying material and a salt. Ifsaltisnullor of length 0, then a default salt of HashLen zeros will be used (where HashLen is the length of the return value of the supplied algorithm).- Parameters:
salt- the salt used for key extraction (optional)ikm- the Input Keying Material
-
deriveKey
public byte[] deriveKey(byte[] info, int length) throws IllegalStateExceptionReturns a pseudorandom key oflengthbytes.- Parameters:
info- optional context and application specific information (can be a zero-length array).length- the length of the output key in bytes- Returns:
- a pseudorandom key of
lengthbytes. - Throws:
IllegalStateException- if this object has not been initialized
-
-