mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-22 20:32:05 +01:00
Add KeyRingProtectionSettings.secureDefaultSettings() factory method
This commit is contained in:
parent
20f32926bb
commit
2af60454f5
3 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue