Add default constructor and fix condition

This commit is contained in:
Paul Schaub 2020-01-14 22:09:13 +01:00
parent 795a7783d4
commit 4b61745c46
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
1 changed files with 5 additions and 1 deletions

View File

@ -26,10 +26,14 @@ public class KeyRingProtectionSettings {
private final HashAlgorithm hashAlgorithm;
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) {
this.encryptionAlgorithm = encryptionAlgorithm;
this.hashAlgorithm = hashAlgorithm;
if (s2kCount > 1) {
if (s2kCount < 1) {
throw new IllegalArgumentException("s2kCount cannot be less than 1.");
}
this.s2kCount = s2kCount;