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

public final Class Scrypt

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

Source class for scrypt utility KDF, an augmentation of the PBKDF2 PBE algorithm which incorporates a memory-hard component.

Scrypt was created by Colin Percival and is specified in RFC 7914 - The scrypt Password-Based Key Derivation Function

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Scrypt.KDFFactory

Factory for scrypt KDFs.

public static class
Scrypt.Parameters

Parameters for the scrypt key derivation function.

public static class
Scrypt.ParametersBuilder

Parameters builder for the scrypt key derivation function.

Field Summary

Modifier and TypeField and Description
public static final Scrypt.ParametersBuilder

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALGORITHMback to summary
public static final Scrypt.ParametersBuilder ALGORITHM

Constructor Detail

Scryptback to summary
private Scrypt()
org.bouncycastle.crypto.fips back to summary

public final Class Scrypt.KDFFactory

extends Object
implements KDFOperatorFactory<Scrypt.Parameters>
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.KDFOperatorFactory

Factory for scrypt KDFs.

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

Implements org.bouncycastle.crypto.KDFOperatorFactory.createKDFCalculator.

Return a calculator for generating bytes for key material.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

KDFFactoryback to summary
public KDFFactory()

Method Detail

createKDFCalculatorback to summary
public KDFCalculator<Scrypt.Parameters> createKDFCalculator(final Scrypt.Parameters 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:Scrypt.Parameters

the parameter set to initialize the calculator with.

Returns:KDFCalculator<Scrypt.Parameters>

a KDF calculator.

org.bouncycastle.crypto.fips back to summary

public final Class Scrypt.Parameters

extends FipsParameters
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
Parameters(int n, byte[] seed, int r, int p, byte[] salt)

Method Summary

Inherited from org.bouncycastle.crypto.fips.FipsParameters:
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

Parametersback to summary
private Parameters(int n, byte[] seed, int r, int p, byte[] salt)
org.bouncycastle.crypto.fips back to summary

public final Class Scrypt.ParametersBuilder

extends FipsParameters
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 Scrypt.Parameters

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 Scrypt.Parameters

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.fips.FipsParameters:
getAlgorithm

Constructor Detail

ParametersBuilderback to summary
pack-priv ParametersBuilder(FipsAlgorithm algorithm)

Method Detail

usingback to summary
public Scrypt.Parameters 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:Scrypt.Parameters

the generated key.

usingback to summary
public Scrypt.Parameters 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:Scrypt.Parameters

the generated key.