Bouncy Castle Cryptography Library 1.85

org.bouncycastle.openpgp.operator.jcajce
Class JcePGPS2KCalculator

java.lang.Object
  extended byorg.bouncycastle.openpgp.operator.jcajce.JcePGPS2KCalculator
All Implemented Interfaces:
PGPS2KCalculator

public class JcePGPS2KCalculator
extends java.lang.Object
implements PGPS2KCalculator

A PGPS2KCalculator for the JCA/JCE OpenPGP operators. The Argon2 key (RFC 9580 sec. 3.7.1.4) is derived through the provider's (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 () before this is invoked.


Constructor Summary
JcePGPS2KCalculator()
           
 
Method Summary
 int getType()
          Return the algorithm type
 byte[] makeKey(char[] passPhrase, S2K s2k, int keyLen)
          Derive 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JcePGPS2KCalculator

public JcePGPS2KCalculator()
Method Detail

setProvider

public JcePGPS2KCalculator setProvider(java.security.Provider provider)

setProvider

public JcePGPS2KCalculator setProvider(java.lang.String providerName)

getType

public int getType()
Description copied from interface: PGPS2KCalculator
Return the algorithm type

Specified by:
getType in interface PGPS2KCalculator

makeKey

public byte[] makeKey(char[] passPhrase,
                      S2K s2k,
                      int keyLen)
               throws PGPException
Description copied from interface: PGPS2KCalculator
Derive bytes from the supplied passphrase using the parameters carried by the given Argon2 S2K specifier.

Specified by:
makeKey in interface PGPS2KCalculator
Parameters:
passPhrase - the passphrase.
s2k - an S2K.ARGON_2 S2K carrying the salt, passes, parallelism and memory size.
keyLen - the number of key bytes to produce.
Returns:
the derived key.
Throws:
PGPException - on error.

Bouncy Castle Cryptography Library 1.85