public final class KDFs extends Object
| Modifier and Type | Method and Description |
|---|---|
static KDF |
hkdf(Algorithm<MAC> mac,
byte[] info,
int dkLen)
Creates and returns a new immutable
KDF instance implementing
the HKDF algorithm (RFC 5869). |
static KDF |
pbkdf1(Algorithm<Digest> digest,
int iterationCount,
int dkLen)
Creates and returns a new immutable
KDF instance implementing
the PBKDF1 algorithm (RFC 2898). |
static KDF |
pbkdf2(Algorithm<MAC> mac,
int iterationCount,
int dkLen)
Creates and returns a new immutable
KDF instance implementing
the PBKDF2 algorithm (RFC 2898). |
static KDF |
scrypt(int r,
int n,
int p,
int dkLen)
Creates and returns a new immutable
KDF instance implementing
the SCrypt algorithm as specified by the Internet Engineering Task
Force. |
public static KDF pbkdf1(Algorithm<Digest> digest, int iterationCount, int dkLen)
KDF instance implementing
the PBKDF1 algorithm (RFC 2898).digest - the digest algorithm to use.iterationCount - the desired number of iterations.dkLen - the desired length for derived keys, in bytes.KDF instance.NullPointerException - if digest is null.IllegalArgumentException - if iterationCount or
dkLen is negative, or if dkLen is greater than
the digest algorithm's output length, or if the digest algorithm
is unknown.public static KDF pbkdf2(Algorithm<MAC> mac, int iterationCount, int dkLen)
KDF instance implementing
the PBKDF2 algorithm (RFC 2898).mac - the MAC algorithm to use.iterationCount - the desired number of iterations.dkLen - the desired length for derived keys, in bytes.KDF instance.NullPointerException - if mac is null.IllegalArgumentException - if iterationCount or
dkLen is negative, or if the MAC algorithm is unknown.public static KDF hkdf(Algorithm<MAC> mac, byte[] info, int dkLen)
KDF instance implementing
the HKDF algorithm (RFC 5869).mac - the MAC algorithm to use.info - optional context and application specific information,
may be null or empty.dkLen - the desired length for derived keys, in bytes.KDF instance.NullPointerException - if mac is null.IllegalArgumentException - if dkLen is negative, or if
the MAC algorithm is unknown, or if dkLen is greater
than 255 * MAC algorithm's output length.public static KDF scrypt(int r, int n, int p, int dkLen)
KDF instance implementing
the SCrypt algorithm as specified by the Internet Engineering Task
Force. See http://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01
for more information.r - the block size parameter.n - the CPU/Memory cost parameter.p - the parallelization parameter.dkLen - the desired length for derived keys, in bytes.KDF instance.IllegalArgumentException - if r, dkLen or p is
negative, or if n is not greater than 1 or if it is not
a power of 2 or if it is not less than 2 ^ (128 * r / 8), or if
p is greater than ((2 ^ 32 - 1) * 32) / (128 * r).Copyright © 2012–2015. All rights reserved.