In iterated mode, S2K takes a single byte iteration count specifier, which is converted to an actual iteration count using a formula that grows the iteration count exponentially as the byte value increases.
e.g. 0x01 == 1088 iterations, and 0xFF == 65,011,712 iterations.
| Modifier and Type | Class and Description |
|---|---|
| public static class | S2K.
Parameters for Argon2 S2K. |
| public static class | S2K.
Parameters for the |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| public static final int | ARGON_2
Memory-hard, salted key generation using Argon2 hash algorithm. |
| private static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| pack-priv int | |
| pack-priv byte[] | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| public static final int | SALTED
Salted key generation. |
| public static final int | SALTED_AND_ITERATED
Salted and iterated key generation. |
| public static final int | SIMPLE
Simple key generation. |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| public | |
| public | S2K(int
the algorithm, byte[] digest algorithm to use.the salt to apply to input to the key generation. iv)Constructs a specifier for a |
| public | S2K(int
the algorithm, byte[] digest algorithm to iterate.the salt to apply to input to the key generation. iv, int the single byte iteration count specifier. itCount)Constructs a specifier for a |
| public | S2K(S2K.
argon2 parameters argon2ParamsConstructs a specifier for an |
| public | S2K(S2K.
GNU_DUMMY_S2K parameters gnuDummyParamsConstruct a specifier for an S2K using the |
| Modifier and Type | Method and Description |
|---|---|
| public static S2K | Returns: S2Kargon2 parameters parametersReturn a new S2K instance using the parameters |
| public void | |
| public int | |
| public long | |
| public byte[] | |
| public int | |
| public int | |
| public int | |
| public int | |
| public int | |
| public static S2K | Returns: S2KGNU Dummy S2K parameters parametersReturn a new S2K instance using the parameters |
| public static S2K | Returns: S2Khash algorithm tag algorithm, byte[] salt salt, int number of iterations iterationCount)Return a new S2K instance using the algorithm |
| public static S2K | |
| public static S2K | |
| private void | writeOneOctetOrThrow(BCPGOutputStream
output stream out, int value val, String name of the value for the error message valName)Throw an |
| algorithm | back to summary |
|---|---|
| pack-priv int algorithm | |
| ARGON_2 | back to summary |
|---|---|
| public static final int ARGON_2 Memory-hard, salted key generation using Argon2 hash algorithm. | |
| EXPBIAS | back to summary |
|---|---|
| private static final int EXPBIAS | |
| GNU_DUMMY_S2K | back to summary |
|---|---|
| public static final int GNU_DUMMY_S2K | |
| GNU_PROTECTION_MODE_DIVERT_TO_CARD | back to summary |
|---|---|
| public static final int GNU_PROTECTION_MODE_DIVERT_TO_CARD | |
| GNU_PROTECTION_MODE_NO_PRIVATE_KEY | back to summary |
|---|---|
| public static final int GNU_PROTECTION_MODE_NO_PRIVATE_KEY | |
| itCount | back to summary |
|---|---|
| pack-priv int itCount | |
| iv | back to summary |
|---|---|
| pack-priv byte[] iv | |
| memorySizeExponent | back to summary |
|---|---|
| pack-priv int memorySizeExponent | |
| parallelism | back to summary |
|---|---|
| pack-priv int parallelism | |
| passes | back to summary |
|---|---|
| pack-priv int passes | |
| protectionMode | back to summary |
|---|---|
| pack-priv int protectionMode | |
| SALTED | back to summary |
|---|---|
| public static final int SALTED Salted key generation. A single iteration of a hash function with a (unique) salt | |
| SALTED_AND_ITERATED | back to summary |
|---|---|
| public static final int SALTED_AND_ITERATED Salted and iterated key generation. Multiple iterations of a hash function, with a salt | |
| SIMPLE | back to summary |
|---|---|
| public static final int SIMPLE Simple key generation. A single non-salted iteration of a hash function | |
| type | back to summary |
|---|---|
| pack-priv int type | |
| S2K | back to summary |
|---|---|
| pack-priv S2K(InputStream in) throws IOException | |
| S2K | back to summary |
|---|---|
| public S2K(int algorithm) Constructs a specifier for a
| |
| S2K | back to summary |
|---|---|
| public S2K(int algorithm, byte[] iv) Constructs a specifier for a
| |
| S2K | back to summary |
|---|---|
| public S2K(int algorithm, byte[] iv, int itCount) Constructs a specifier for a
| |
| S2K | back to summary |
|---|---|
| public S2K(S2K. Constructs a specifier for an
| |
| S2K | back to summary |
|---|---|
| public S2K(S2K. Construct a specifier for an S2K using the
| |
| argon2S2K | back to summary |
|---|---|
| public static S2K argon2S2K(S2K. Return a new S2K instance using the parameters.
| |
| encode | back to summary |
|---|---|
| public void encode(BCPGOutputStream out) throws IOException Implements abstract org. | |
| getHashAlgorithm | back to summary |
|---|---|
| public int getHashAlgorithm() Gets the | |
| getIterationCount | back to summary |
|---|---|
| public long getIterationCount() Gets the actual (expanded) iteration count. | |
| getIV | back to summary |
|---|---|
| public byte[] getIV() Gets the iv/salt to use for the key generation. | |
| getMemorySizeExponent | back to summary |
|---|---|
| public int getMemorySizeExponent() Gets the memory size exponent - only if ARGON_2
| |
| getParallelism | back to summary |
|---|---|
| public int getParallelism() Gets the degree of parallelism - only if ARGON_2
| |
| getPasses | back to summary |
|---|---|
| public int getPasses() Return the number of passes - only Argon2
| |
| getProtectionMode | back to summary |
|---|---|
| public int getProtectionMode() Gets the protection mode - only if GNU_DUMMY_S2K | |
| getType | back to summary |
|---|---|
| public int getType() Gets the | |
| gnuDummyS2K | back to summary |
|---|---|
| public static S2K gnuDummyS2K(S2K. Return a new S2K instance using the parameters.
| |
| saltedAndIteratedS2K | back to summary |
|---|---|
| public static S2K saltedAndIteratedS2K(int algorithm, byte[] salt, int iterationCount) Return a new S2K instance using the algorithm, saltand iterationCount.
| |
| saltedS2K | back to summary |
|---|---|
| public static S2K saltedS2K(int algorithm, byte[] salt) Return a new S2K instance using the algorithmand salt.
| |
| simpleS2K | back to summary |
|---|---|
| public static S2K simpleS2K(int algorithm) Return a new S2K instance using the algorithm.
| |
| writeOneOctetOrThrow | back to summary |
|---|---|
| private void writeOneOctetOrThrow(BCPGOutputStream out, int val, String valName) throws IOException Throw an
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final int | |
| private final int | |
| private final byte[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Argon2Params(SecureRandom secureRandom)
Uniformly safe and recommended parameters not tailored to any hardware. |
| public | Argon2Params(int
number of iterations, must be greater than 0 passes, int number of lanes, must be greater 0 parallelism, int exponent for memory consumption, must be between 3+ceil(log_2(p)) and 31 memSizeExp, SecureRandom secure random generator to initialize the salt vector secureRandom)Create customized Argon2 S2K parameters. |
| public | Argon2Params(byte[]
16 bytes of random salt salt, int number of iterations, must be greater than 0 passes, int number of lanes, must be greater 0 parallelism, int exponent for memory consumption, must be between 3+ceil(log_2(p)) and 31 memSizeExp)Create customized Argon2 S2K parameters. |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | |
| public int | |
| public byte[] | |
| public static S2K. | Returns: safe parameters for memory constrained environmentsRecommended parameters for memory constrained environments (64MiB RAM). |
| private static byte[] | Returns: saltrandom number generator instance secureRandom)Generate 16 bytes of random salt. |
| public static S2K. | universallyRecommendedParameters()
Uniformly safe and recommended parameters not tailored to any hardware. |
| memSizeExp | back to summary |
|---|---|
| private final int memSizeExp | |
| parallelism | back to summary |
|---|---|
| private final int parallelism | |
| passes | back to summary |
|---|---|
| private final int passes | |
| salt | back to summary |
|---|---|
| private final byte[] salt | |
| Argon2Params | back to summary |
|---|---|
| public Argon2Params() Uniformly safe and recommended parameters not tailored to any hardware. Uses Argon2id, 1 pass, 4 parallelism, 2 GiB RAM.
| |
| Argon2Params | back to summary |
|---|---|
| public Argon2Params(SecureRandom secureRandom) Uniformly safe and recommended parameters not tailored to any hardware. Uses Argon2id, 1 pass, 4 parallelism, 2 GiB RAM.
| |
| Argon2Params | back to summary |
|---|---|
| public Argon2Params(int passes, int parallelism, int memSizeExp, SecureRandom secureRandom) Create customized Argon2 S2K parameters.
| |
| Argon2Params | back to summary |
|---|---|
| public Argon2Params(byte[] salt, int passes, int parallelism, int memSizeExp) Create customized Argon2 S2K parameters.
| |
| getMemSizeExp | back to summary |
|---|---|
| public int getMemSizeExp() Return the exponent indicating the memory size m.
| |
| getParallelism | back to summary |
|---|---|
| public int getParallelism() Return the factor of parallelism p.
| |
| getPasses | back to summary |
|---|---|
| public int getPasses() Return the number of passes t.
| |
| getSalt | back to summary |
|---|---|
| public byte[] getSalt() Return a 16-byte byte array containing the salt S.
| |
| memoryConstrainedParameters | back to summary |
|---|---|
| public static S2K. Recommended parameters for memory constrained environments (64MiB RAM). Uses Argon2id with 3 passes, 4 lanes and 64 MiB RAM.
| |
| mineSalt | back to summary |
|---|---|
| private static byte[] mineSalt(SecureRandom secureRandom) Generate 16 bytes of random salt.
| |
| universallyRecommendedParameters | back to summary |
|---|---|
| public static S2K. Uniformly safe and recommended parameters not tailored to any hardware. Uses Argon2id, 1 pass, 4 parallelism, 2 GiB RAM.
| |
GNU_DUMMY_S2K method.
| Modifier and Type | Field and Description |
|---|---|
| private final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static S2K. | Returns: paramsFactory method for a GNU Dummy S2K indicating a private key located on a smart card. |
| public int | |
| public static S2K. |
| protectionMode | back to summary |
|---|---|
| private final int protectionMode | |
| GNUDummyParams | back to summary |
|---|---|
| private GNUDummyParams(int protectionMode) | |
| divertToCard | back to summary |
|---|---|
| public static S2K. Factory method for a GNU Dummy S2K indicating a private key located on a smart card.
| |
| getProtectionMode | back to summary |
|---|---|
| public int getProtectionMode() Return the GNU Dummy S2K protection method.
| |
| noPrivateKey | back to summary |
|---|---|
| public static S2K. Factory method for a GNU Dummy S2K indicating a missing private key.
| |