mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 06:12:06 +01:00
Add default constructor and fix condition
This commit is contained in:
parent
795a7783d4
commit
4b61745c46
1 changed files with 5 additions and 1 deletions
|
@ -26,10 +26,14 @@ public class KeyRingProtectionSettings {
|
||||||
private final HashAlgorithm hashAlgorithm;
|
private final HashAlgorithm hashAlgorithm;
|
||||||
private final int s2kCount;
|
private final int s2kCount;
|
||||||
|
|
||||||
|
public KeyRingProtectionSettings(@Nonnull SymmetricKeyAlgorithm encryptionAlgorithm) {
|
||||||
|
this(encryptionAlgorithm, HashAlgorithm.SHA1, 0x60); // Same s2kCount as used in BC.
|
||||||
|
}
|
||||||
|
|
||||||
public KeyRingProtectionSettings(@Nonnull SymmetricKeyAlgorithm encryptionAlgorithm, @Nonnull HashAlgorithm hashAlgorithm, int s2kCount) {
|
public KeyRingProtectionSettings(@Nonnull SymmetricKeyAlgorithm encryptionAlgorithm, @Nonnull HashAlgorithm hashAlgorithm, int s2kCount) {
|
||||||
this.encryptionAlgorithm = encryptionAlgorithm;
|
this.encryptionAlgorithm = encryptionAlgorithm;
|
||||||
this.hashAlgorithm = hashAlgorithm;
|
this.hashAlgorithm = hashAlgorithm;
|
||||||
if (s2kCount > 1) {
|
if (s2kCount < 1) {
|
||||||
throw new IllegalArgumentException("s2kCount cannot be less than 1.");
|
throw new IllegalArgumentException("s2kCount cannot be less than 1.");
|
||||||
}
|
}
|
||||||
this.s2kCount = s2kCount;
|
this.s2kCount = s2kCount;
|
||||||
|
|
Loading…
Reference in a new issue