Class KeyRingProtectionSettings

java.lang.Object
org.pgpainless.key.protection.KeyRingProtectionSettings

public class KeyRingProtectionSettings extends Object
Secret key protection settings for iterated and salted S2K.
  • Constructor Details

    • KeyRingProtectionSettings

      public KeyRingProtectionSettings(@Nonnull SymmetricKeyAlgorithm encryptionAlgorithm)
      Create a KeyRingProtectionSettings object using the given encryption algorithm, SHA1 and 65536 iterations.
      Parameters:
      encryptionAlgorithm - encryption algorithm
    • KeyRingProtectionSettings

      public KeyRingProtectionSettings(@Nonnull SymmetricKeyAlgorithm encryptionAlgorithm, @Nonnull HashAlgorithm hashAlgorithm, int s2kCount)
      Constructor for custom salted and iterated S2K protection settings. The salt gets randomly chosen by the library each time. Note, that the s2kCount is the already encoded single-octet number.
      Parameters:
      encryptionAlgorithm - encryption algorithm
      hashAlgorithm - hash algorithm
      s2kCount - encoded s2k iteration count
      See Also:
  • Method Details

    • secureDefaultSettings

      public static KeyRingProtectionSettings secureDefaultSettings()
      Secure default settings using SymmetricKeyAlgorithm.AES_256, HashAlgorithm.SHA256 and an iteration count of 65536.
      Returns:
      secure protection settings
    • getEncryptionAlgorithm

      @Nonnull public SymmetricKeyAlgorithm getEncryptionAlgorithm()
      Return the encryption algorithm.
      Returns:
      encryption algorithm
    • getHashAlgorithm

      @Nonnull public HashAlgorithm getHashAlgorithm()
      Return the hash algorithm.
      Returns:
      hash algorithm
    • getS2kCount

      public int getS2kCount()
      Return the (encoded!) s2k iteration count.
      Returns:
      encoded s2k count
      See Also: