Class S2K.Argon2Params

  • Enclosing class:
    S2K

    public static class S2K.Argon2Params
    extends java.lang.Object
    Parameters for Argon2 S2K.
    See Also:
    OpenPGP - Argon2
    • Constructor Summary

      Constructors 
      Constructor Description
      Argon2Params()
      Uniformly safe and recommended parameters not tailored to any hardware.
      Argon2Params​(byte[] salt, int passes, int parallelism, int memSizeExp)
      Create customized Argon2 S2K parameters.
      Argon2Params​(int passes, int parallelism, int memSizeExp, java.security.SecureRandom secureRandom)
      Create customized Argon2 S2K parameters.
      Argon2Params​(java.security.SecureRandom secureRandom)
      Uniformly safe and recommended parameters not tailored to any hardware.
    • Constructor Detail

      • Argon2Params

        public Argon2Params()
        Uniformly safe and recommended parameters not tailored to any hardware. Uses Argon2id, 1 pass, 4 parallelism, 2 GiB RAM.
        See Also:
        RFC 9106: §4. Parameter Choice
      • Argon2Params

        public Argon2Params​(java.security.SecureRandom secureRandom)
        Uniformly safe and recommended parameters not tailored to any hardware. Uses Argon2id, 1 pass, 4 parallelism, 2 GiB RAM.
        See Also:
        RFC 9106: §4. Parameter Choice
      • Argon2Params

        public Argon2Params​(int passes,
                            int parallelism,
                            int memSizeExp,
                            java.security.SecureRandom secureRandom)
        Create customized Argon2 S2K parameters.
        Parameters:
        passes - number of iterations, must be greater than 0
        parallelism - number of lanes, must be greater 0
        memSizeExp - exponent for memory consumption, must be between 3 + ⌈log₂p⌉ and 31
        secureRandom - secure random generator to initialize the salt vector
      • Argon2Params

        public Argon2Params​(byte[] salt,
                            int passes,
                            int parallelism,
                            int memSizeExp)
        Create customized Argon2 S2K parameters.
        Parameters:
        salt - 16 bytes of random salt
        passes - number of iterations, must be greater than 0
        parallelism - number of lanes, must be greater 0
        memSizeExp - exponent for memory consumption, must be between 3 + ⌈log₂p⌉ and 31
    • Method Detail

      • universallyRecommendedParameters

        public static S2K.Argon2Params universallyRecommendedParameters()
        Uniformly safe and recommended parameters not tailored to any hardware. Uses Argon2id, 1 pass, 4 parallelism, 2 GiB RAM.
        See Also:
        RFC 9106: §4. Parameter Choice
      • memoryConstrainedParameters

        public static S2K.Argon2Params memoryConstrainedParameters()
        Recommended parameters for memory constrained environments (64MiB RAM). Uses Argon2id with 3 passes, 4 lanes and 64 MiB RAM.
        Returns:
        safe parameters for memory constrained environments
        See Also:
        RFC9106: §4. Parameter Choice
      • getSalt

        public byte[] getSalt()
        Return a 16-byte byte array containing the salt S.
        Returns:
        salt
      • getPasses

        public int getPasses()
        Return the number of passes t.
        Returns:
        number of passes
      • getParallelism

        public int getParallelism()
        Return the factor of parallelism p.
        Returns:
        parallelism
      • getMemSizeExp

        public int getMemSizeExp()
        Return the exponent indicating the memory size m.
        Returns:
        memory size exponent