Interface PGPS2KCalculator

All Known Implementing Classes:
BcPGPS2KCalculator, JcePGPS2KCalculator

public interface PGPS2KCalculator
Derives a key from a passphrase for a memory-hard S2K specifier (currently Argon2, RFC 9580 sec. 3.7.1.4).

This is the operator-level abstraction for the one part of the OpenPGP string-to-key process that is not expressible through a PGPDigestCalculator: a memory-hard KDF. Concrete implementations live in the .bc and .jcajce operator subpackages so that the top-level operator package does not depend on a particular crypto provider.

  • Method Summary

    Modifier and Type
    Method
    Description
    int
    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.
  • Method Details

    • getType

      int getType()
      Return the algorithm type
    • makeKey

      byte[] makeKey(char[] passPhrase, S2K s2k, int keyLen) throws PGPException
      Derive keyLen bytes from the supplied passphrase using the parameters carried by the given Argon2 S2K specifier.
      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.