1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-22 12:22:06 +01:00

Add KeyRingProtectionSettings.secureDefaultSettings() factory method

This commit is contained in:
Paul Schaub 2020-08-31 12:37:34 +02:00
parent 20f32926bb
commit 2af60454f5
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 6 additions and 2 deletions

View file

@ -39,6 +39,10 @@ public class KeyRingProtectionSettings {
this.s2kCount = s2kCount;
}
public static KeyRingProtectionSettings secureDefaultSettings() {
return new KeyRingProtectionSettings(SymmetricKeyAlgorithm.AES_256);
}
public @Nonnull SymmetricKeyAlgorithm getEncryptionAlgorithm() {
return encryptionAlgorithm;
}

View file

@ -54,7 +54,7 @@ public class PasswordBasedSecretKeyRingProtector implements SecretKeyRingProtect
}
public static PasswordBasedSecretKeyRingProtector forKey(PGPKeyRing keyRing, Passphrase passphrase) {
KeyRingProtectionSettings protectionSettings = new KeyRingProtectionSettings(SymmetricKeyAlgorithm.AES_256);
KeyRingProtectionSettings protectionSettings = KeyRingProtectionSettings.secureDefaultSettings();
SecretKeyPassphraseProvider passphraseProvider = new SecretKeyPassphraseProvider() {
@Override
@Nullable

View file

@ -32,7 +32,7 @@ public class PassphraseProtectedKeyTest {
* Protector that holds only the password of cryptie.
*/
private final PasswordBasedSecretKeyRingProtector protector = new PasswordBasedSecretKeyRingProtector(
new KeyRingProtectionSettings(SymmetricKeyAlgorithm.AES_256),
KeyRingProtectionSettings.secureDefaultSettings(),
new SecretKeyPassphraseProvider() {
@Nullable
@Override