Top Description Inners Fields Constructors Methods
org.bouncycastle.crypto.general

public final Class KDF

extends Object
Class Inheritance
Imports
org.bouncycastle.crypto.KDFCalculator, .PasswordConverter, org.bouncycastle.util.Arrays

Source class for non-FIPS key derivation functions (KDF).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
KDF.SCryptFactory

Factory for scrypt KDFs.

public static class
KDF.ScryptParameters

Parameters for the scrypt key derivation function.

public static class
KDF.ScryptParametersBuilder

Parameters builder for the SCrypt key derivation function.

Field Summary

Modifier and TypeField and Description
public static final KDF.ScryptParametersBuilder
SCRYPT

The SCrypt KDF.

Constructor Summary

AccessConstructor and Description
private
KDF()

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

SCRYPTback to summary
public static final KDF.ScryptParametersBuilder SCRYPT

The SCrypt KDF.

Constructor Detail

KDFback to summary
private KDF()
org.bouncycastle.crypto.general back to summary

public final Class KDF.SCryptFactory

extends GuardedKDFOperatorFactory<KDF.ScryptParameters>
Class Inheritance

Factory for scrypt KDFs.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public KDFCalculator<T extends Parameters>
createKDFCalculator(final KDF.ScryptParameters
the parameter set to initialize the calculator with.
params
)

Implements org.bouncycastle.crypto.KDFOperatorFactory.createKDFCalculator.

Return a calculator for generating bytes for key material.

Constructor Detail

SCryptFactoryback to summary
public SCryptFactory()

Method Detail

createKDFCalculatorback to summary
public KDFCalculator<T extends Parameters> createKDFCalculator(final KDF.ScryptParameters params)

Implements org.bouncycastle.crypto.KDFOperatorFactory.createKDFCalculator.

Doc from org.bouncycastle.crypto.KDFOperatorFactory.createKDFCalculator.

Return a calculator for generating bytes for key material.

Parameters
params:KDF.ScryptParameters

the parameter set to initialize the calculator with.

Returns:KDFCalculator<T extends Parameters>

a KDF calculator.

org.bouncycastle.crypto.general back to summary

public final Class KDF.ScryptParameters

extends GeneralParameters<GeneralAlgorithm>
Class Inheritance

Parameters for the scrypt key derivation function.

Field Summary

Modifier and TypeField and Description
pack-priv final int
n

pack-priv final int
p

pack-priv final int
r

pack-priv final byte[]
pack-priv final byte[]

Constructor Summary

AccessConstructor and Description
private
ScryptParameters(int n, byte[] seed, int r, int p, byte[] salt)

Method Summary

Inherited from org.bouncycastle.crypto.general.GeneralParameters:
getAlgorithm

Field Detail

nback to summary
pack-priv final int n
pback to summary
pack-priv final int p
rback to summary
pack-priv final int r
saltback to summary
pack-priv final byte[] salt
seedback to summary
pack-priv final byte[] seed

Constructor Detail

ScryptParametersback to summary
private ScryptParameters(int n, byte[] seed, int r, int p, byte[] salt)
org.bouncycastle.crypto.general back to summary

public final Class KDF.ScryptParametersBuilder

extends GeneralParameters<GeneralAlgorithm>
Class Inheritance

Parameters builder for the SCrypt key derivation function.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public KDF.ScryptParameters

Returns:

the generated key.
using
(byte[]
the salt to use for this invocation.
salt
,
int
CPU/Memory cost parameter. Must be larger than 1, a power of 2 and less than 2^(128 * r / 8).
n
,
int
the block size, must be >= 1.
r
,
int
Parallelization parameter. Must be a positive integer less than or equal to Integer.MAX_VALUE / (128 * r * 8).
p
,
byte[]
the value feed into the PBKDF2 function.
seed
)

Generate a key using the scrypt key derivation function.

public KDF.ScryptParameters

Returns:

the generated key.
using
(byte[]
the salt to use for this invocation.
salt
,
int
CPU/Memory cost parameter. Must be larger than 1, a power of 2 and less than 2^(128 * r / 8).
n
,
int
the block size, must be >= 1.
r
,
int
Parallelization parameter. Must be a positive integer less than or equal to Integer.MAX_VALUE / (128 * r * 8).
p
,
PasswordConverter
a converter to turn the password characters into the byte array for the seed.
converter
,
char[]
a character string to use as a seed.
password
)

Generate a key using the scrypt key derivation function.

Inherited from org.bouncycastle.crypto.general.GeneralParameters:
getAlgorithm

Constructor Detail

ScryptParametersBuilderback to summary
pack-priv ScryptParametersBuilder(GeneralAlgorithm algorithm)

Method Detail

usingback to summary
public KDF.ScryptParameters using(byte[] salt, int n, int r, int p, byte[] seed)

Generate a key using the scrypt key derivation function.

Parameters
salt:byte[]

the salt to use for this invocation.

n:int

CPU/Memory cost parameter. Must be larger than 1, a power of 2 and less than 2^(128 * r / 8).

r:int

the block size, must be >= 1.

p:int

Parallelization parameter. Must be a positive integer less than or equal to Integer.MAX_VALUE / (128 * r * 8).

seed:byte[]

the value feed into the PBKDF2 function.

Returns:KDF.ScryptParameters

the generated key.

usingback to summary
public KDF.ScryptParameters using(byte[] salt, int n, int r, int p, PasswordConverter converter, char[] password)

Generate a key using the scrypt key derivation function.

Parameters
salt:byte[]

the salt to use for this invocation.

n:int

CPU/Memory cost parameter. Must be larger than 1, a power of 2 and less than 2^(128 * r / 8).

r:int

the block size, must be >= 1.

p:int

Parallelization parameter. Must be a positive integer less than or equal to Integer.MAX_VALUE / (128 * r * 8).

converter:PasswordConverter

a converter to turn the password characters into the byte array for the seed.

password:char[]

a character string to use as a seed.

Returns:KDF.ScryptParameters

the generated key.