public class JcePGPS2KCalculator extends java.lang.Object implements PGPS2KCalculator
PGPS2KCalculator for the JCA/JCE OpenPGP operators. The Argon2 key (RFC 9580 sec. 3.7.1.4)
is derived through the provider's SecretKeyFactory.ARGON2 (RFC 9106) rather than the
lightweight engine directly, so the provider is overridable via setProvider(java.security.Provider). The cost
parameters are bounded by the caller (PGPUtil.makeKeyFromPassPhrase) before this is invoked.| Constructor and Description |
|---|
JcePGPS2KCalculator() |
| Modifier and Type | Method and Description |
|---|---|
int |
getType()
Return the algorithm type
|
byte[] |
makeKey(char[] passPhrase,
S2K s2k,
int keyLen)
Derive
keyLen bytes from the supplied passphrase using the parameters carried by the given
Argon2 S2K specifier. |
JcePGPS2KCalculator |
setProvider(java.security.Provider provider) |
JcePGPS2KCalculator |
setProvider(java.lang.String providerName) |
public JcePGPS2KCalculator setProvider(java.security.Provider provider)
public JcePGPS2KCalculator setProvider(java.lang.String providerName)
public int getType()
PGPS2KCalculatorgetType in interface PGPS2KCalculatorpublic byte[] makeKey(char[] passPhrase,
S2K s2k,
int keyLen)
throws PGPException
PGPS2KCalculatorkeyLen bytes from the supplied passphrase using the parameters carried by the given
Argon2 S2K specifier.makeKey in interface PGPS2KCalculatorpassPhrase - the passphrase.s2k - an S2K.ARGON_2 S2K carrying the salt, passes, parallelism and memory size.keyLen - the number of key bytes to produce.PGPException - on error.