Package org.pgpainless.key.protection
Class KeyRingProtectionSettings
java.lang.Object
org.pgpainless.key.protection.KeyRingProtectionSettings
Secret key protection settings for iterated and salted S2K.
-
Constructor Summary
ConstructorsConstructorDescriptionKeyRingProtectionSettings
(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
Modifier and TypeMethodDescriptionReturn the encryption algorithm.Return the hash algorithm.int
Return the (encoded!) s2k iteration count.static KeyRingProtectionSettings
Secure default settings usingSymmetricKeyAlgorithm.AES_256
,HashAlgorithm.SHA256
and an iteration count of 65536.
-
Constructor Details
-
KeyRingProtectionSettings
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:
-
-
Method Details
-
secureDefaultSettings
Secure default settings usingSymmetricKeyAlgorithm.AES_256
,HashAlgorithm.SHA256
and an iteration count of 65536.- Returns:
- secure protection settings
-
getEncryptionAlgorithm
Return the encryption algorithm.- Returns:
- encryption algorithm
-
getHashAlgorithm
Return the hash algorithm.- Returns:
- hash algorithm
-
getS2kCount
public int getS2kCount()Return the (encoded!) s2k iteration count.- Returns:
- encoded s2k count
- See Also:
-