mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 14:22: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;
|
this.s2kCount = s2kCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static KeyRingProtectionSettings secureDefaultSettings() {
|
||||||
|
return new KeyRingProtectionSettings(SymmetricKeyAlgorithm.AES_256);
|
||||||
|
}
|
||||||
|
|
||||||
public @Nonnull SymmetricKeyAlgorithm getEncryptionAlgorithm() {
|
public @Nonnull SymmetricKeyAlgorithm getEncryptionAlgorithm() {
|
||||||
return encryptionAlgorithm;
|
return encryptionAlgorithm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class PasswordBasedSecretKeyRingProtector implements SecretKeyRingProtect
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PasswordBasedSecretKeyRingProtector forKey(PGPKeyRing keyRing, Passphrase passphrase) {
|
public static PasswordBasedSecretKeyRingProtector forKey(PGPKeyRing keyRing, Passphrase passphrase) {
|
||||||
KeyRingProtectionSettings protectionSettings = new KeyRingProtectionSettings(SymmetricKeyAlgorithm.AES_256);
|
KeyRingProtectionSettings protectionSettings = KeyRingProtectionSettings.secureDefaultSettings();
|
||||||
SecretKeyPassphraseProvider passphraseProvider = new SecretKeyPassphraseProvider() {
|
SecretKeyPassphraseProvider passphraseProvider = new SecretKeyPassphraseProvider() {
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class PassphraseProtectedKeyTest {
|
||||||
* Protector that holds only the password of cryptie.
|
* Protector that holds only the password of cryptie.
|
||||||
*/
|
*/
|
||||||
private final PasswordBasedSecretKeyRingProtector protector = new PasswordBasedSecretKeyRingProtector(
|
private final PasswordBasedSecretKeyRingProtector protector = new PasswordBasedSecretKeyRingProtector(
|
||||||
new KeyRingProtectionSettings(SymmetricKeyAlgorithm.AES_256),
|
KeyRingProtectionSettings.secureDefaultSettings(),
|
||||||
new SecretKeyPassphraseProvider() {
|
new SecretKeyPassphraseProvider() {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue