mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-10 06:11:08 +01:00
Prevent adding NULL to symmetric algorithm preference when generating key
Fixes #301
This commit is contained in:
parent
32e1f1234b
commit
ba191a1d0f
2 changed files with 19 additions and 0 deletions
|
|
@ -64,6 +64,11 @@ public class KeySpecBuilder implements KeySpecBuilderInterface {
|
|||
@Override
|
||||
public KeySpecBuilder overridePreferredSymmetricKeyAlgorithms(
|
||||
@Nonnull SymmetricKeyAlgorithm... preferredSymmetricKeyAlgorithms) {
|
||||
for (SymmetricKeyAlgorithm algo : preferredSymmetricKeyAlgorithms) {
|
||||
if (algo == SymmetricKeyAlgorithm.NULL) {
|
||||
throw new IllegalArgumentException("NULL (unencrypted) is an invalid symmetric key algorithm preference.");
|
||||
}
|
||||
}
|
||||
this.preferredSymmetricAlgorithms = new LinkedHashSet<>(Arrays.asList(preferredSymmetricKeyAlgorithms));
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue