Bouncy Castle Cryptography Library 1.85

org.bouncycastle.jcajce.spec
Class Argon2KeySpec

java.lang.Object
  extended byorg.bouncycastle.jcajce.spec.Argon2KeySpec
All Implemented Interfaces:
java.security.spec.KeySpec

public class Argon2KeySpec
extends java.lang.Object
implements java.security.spec.KeySpec

Key spec for use with the Argon2 SecretKeyFactory (RFC 9106).

Memory cost is expressed in KiB and the key length in bits, following the convention of ScryptKeySpec. The variant (ARGON2_d/ARGON2_i/ARGON2_id) and version (ARGON2_VERSION_10/ARGON2_VERSION_13) constants mirror those on Argon2Parameters; an optional secret (key) and additional/associated data may also be supplied per RFC 9106.


Field Summary
static int ARGON2_d
          Argon2d - data-dependent memory access.
static int ARGON2_i
          Argon2i - data-independent memory access.
static int ARGON2_id
          Argon2id - hybrid of ARGON2_i and ARGON2_d.
static int ARGON2_VERSION_10
          Argon2 v1.0 (legacy).
static int ARGON2_VERSION_13
          Argon2 v1.3 - the version standardised by RFC 9106.
 
Constructor Summary
Argon2KeySpec(char[] password, byte[] salt, int iterations, int memory, int parallelism, int keySize)
          Argon2id, version 1.3, with no secret or additional data.
Argon2KeySpec(int type, int version, char[] password, byte[] salt, byte[] secret, byte[] additional, int iterations, int memory, int parallelism, int keySize)
          Argon2 with full control over variant, version, optional secret and additional data.
Argon2KeySpec(int type, int version, char[] password, byte[] salt, int iterations, int memory, int parallelism, int keySize)
          Argon2 with an explicit variant and version, no secret or additional data.
 
Method Summary
 byte[] getAdditional()
           
 int getIterations()
           
 int getKeyLength()
          Key length (in bits).
 int getMemory()
           
 int getParallelism()
           
 char[] getPassword()
           
 byte[] getSalt()
           
 byte[] getSecret()
           
 int getType()
           
 int getVersion()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARGON2_d

public static final int ARGON2_d
Argon2d - data-dependent memory access.

See Also:
Constant Field Values

ARGON2_i

public static final int ARGON2_i
Argon2i - data-independent memory access.

See Also:
Constant Field Values

ARGON2_id

public static final int ARGON2_id
Argon2id - hybrid of ARGON2_i and ARGON2_d.

See Also:
Constant Field Values

ARGON2_VERSION_10

public static final int ARGON2_VERSION_10
Argon2 v1.0 (legacy).

See Also:
Constant Field Values

ARGON2_VERSION_13

public static final int ARGON2_VERSION_13
Argon2 v1.3 - the version standardised by RFC 9106.

See Also:
Constant Field Values
Constructor Detail

Argon2KeySpec

public Argon2KeySpec(char[] password,
                     byte[] salt,
                     int iterations,
                     int memory,
                     int parallelism,
                     int keySize)
Argon2id, version 1.3, with no secret or additional data.

Parameters:
password - the password to derive the key from.
salt - the salt.
iterations - the number of passes (time cost).
memory - the memory cost in KiB.
parallelism - the degree of parallelism (lanes).
keySize - the length of the key to generate, in bits.

Argon2KeySpec

public Argon2KeySpec(int type,
                     int version,
                     char[] password,
                     byte[] salt,
                     int iterations,
                     int memory,
                     int parallelism,
                     int keySize)
Argon2 with an explicit variant and version, no secret or additional data.

Parameters:
type - the Argon2 variant (ARGON2_d, ARGON2_i or ARGON2_id).
version - the Argon2 version (ARGON2_VERSION_10 or ARGON2_VERSION_13).
password - the password to derive the key from.
salt - the salt.
iterations - the number of passes (time cost).
memory - the memory cost in KiB.
parallelism - the degree of parallelism (lanes).
keySize - the length of the key to generate, in bits.

Argon2KeySpec

public Argon2KeySpec(int type,
                     int version,
                     char[] password,
                     byte[] salt,
                     byte[] secret,
                     byte[] additional,
                     int iterations,
                     int memory,
                     int parallelism,
                     int keySize)
Argon2 with full control over variant, version, optional secret and additional data.

Parameters:
type - the Argon2 variant (ARGON2_d, ARGON2_i or ARGON2_id).
version - the Argon2 version (ARGON2_VERSION_10 or ARGON2_VERSION_13).
password - the password to derive the key from.
salt - the salt.
secret - the optional secret (key) value; may be null.
additional - the optional additional/associated data; may be null.
iterations - the number of passes (time cost).
memory - the memory cost in KiB.
parallelism - the degree of parallelism (lanes).
keySize - the length of the key to generate, in bits.
Method Detail

getType

public int getType()

getVersion

public int getVersion()

getPassword

public char[] getPassword()

getSalt

public byte[] getSalt()

getSecret

public byte[] getSecret()

getAdditional

public byte[] getAdditional()

getIterations

public int getIterations()

getMemory

public int getMemory()
Returns:
the memory cost in KiB.

getParallelism

public int getParallelism()

getKeyLength

public int getKeyLength()
Key length (in bits).

Returns:
length of the key to generate in bits.

Bouncy Castle Cryptography Library 1.85