Package org.pgpainless.key.protection
Class KeyRingProtectionSettings
- java.lang.Object
-
- org.pgpainless.key.protection.KeyRingProtectionSettings
-
public class KeyRingProtectionSettings extends java.lang.Object
Secret key protection settings for iterated and salted S2K.
-
-
Constructor Summary
Constructors Constructor Description KeyRingProtectionSettings(SymmetricKeyAlgorithm encryptionAlgorithm)
Create aKeyRingProtectionSettings
object using the given encryption algorithm, SHA1 and 65536 iterations.KeyRingProtectionSettings(SymmetricKeyAlgorithm encryptionAlgorithm, HashAlgorithm hashAlgorithm, int s2kCount)
Constructor for custom salted and iterated S2K protection settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SymmetricKeyAlgorithm
getEncryptionAlgorithm()
Return the encryption algorithm.HashAlgorithm
getHashAlgorithm()
Return the hash algorithm.int
getS2kCount()
Return the (encoded!)static KeyRingProtectionSettings
secureDefaultSettings()
Secure default settings usingSymmetricKeyAlgorithm.AES_256
,HashAlgorithm.SHA256
and an iteration count of 65536.
-
-
-
Constructor Detail
-
KeyRingProtectionSettings
public KeyRingProtectionSettings(@Nonnull SymmetricKeyAlgorithm encryptionAlgorithm)
Create aKeyRingProtectionSettings
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 algorithmhashAlgorithm
- hash algorithms2kCount
- encoded s2k iteration count- See Also:
- Encoding Formula
-
-
Method Detail
-
secureDefaultSettings
public static KeyRingProtectionSettings secureDefaultSettings()
Secure default settings usingSymmetricKeyAlgorithm.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:
- Encoding Formula
-
-