Package org.pgpainless.policy
Class Policy.SymmetricKeyAlgorithmPolicy
- java.lang.Object
-
- org.pgpainless.policy.Policy.SymmetricKeyAlgorithmPolicy
-
- Enclosing class:
- Policy
public static final class Policy.SymmetricKeyAlgorithmPolicy extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description SymmetricKeyAlgorithmPolicy(SymmetricKeyAlgorithm defaultSymmetricKeyAlgorithm, java.util.List<SymmetricKeyAlgorithm> acceptableSymmetricKeyAlgorithms)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Policy.SymmetricKeyAlgorithmPolicy
defaultSymmetricKeyDecryptionAlgorithmPolicy()
Deprecated.not expressive - will be removed in a future updatestatic Policy.SymmetricKeyAlgorithmPolicy
defaultSymmetricKeyEncryptionAlgorithmPolicy()
Deprecated.not expressive - will be removed in a future releaseSymmetricKeyAlgorithm
getDefaultSymmetricKeyAlgorithm()
Return the default symmetric key algorithm.boolean
isAcceptable(int algorithmId)
Return true if the given symmetric encryption algorithm is acceptable by this policy.boolean
isAcceptable(SymmetricKeyAlgorithm algorithm)
Return true if the given symmetric encryption algorithm is acceptable by this policy.SymmetricKeyAlgorithm
selectBest(java.util.List<SymmetricKeyAlgorithm> options)
Select the best acceptable algorithm from the options list.static Policy.SymmetricKeyAlgorithmPolicy
symmetricKeyDecryptionPolicy2022()
Policy for symmetric key encryption algorithms in the context of message consumption (decryption).static Policy.SymmetricKeyAlgorithmPolicy
symmetricKeyEncryptionPolicy2022()
Policy for symmetric encryption algorithms in the context of message production (encryption).
-
-
-
Constructor Detail
-
SymmetricKeyAlgorithmPolicy
public SymmetricKeyAlgorithmPolicy(SymmetricKeyAlgorithm defaultSymmetricKeyAlgorithm, java.util.List<SymmetricKeyAlgorithm> acceptableSymmetricKeyAlgorithms)
-
-
Method Detail
-
getDefaultSymmetricKeyAlgorithm
public SymmetricKeyAlgorithm getDefaultSymmetricKeyAlgorithm()
Return the default symmetric key algorithm. This algorithm is used as a fallback when no consensus about symmetric algorithms can be reached.- Returns:
- default symmetric encryption algorithm
-
isAcceptable
public boolean isAcceptable(SymmetricKeyAlgorithm algorithm)
Return true if the given symmetric encryption algorithm is acceptable by this policy.- Parameters:
algorithm
- algorithm- Returns:
- true if algorithm is acceptable, false otherwise
-
isAcceptable
public boolean isAcceptable(int algorithmId)
Return true if the given symmetric encryption algorithm is acceptable by this policy.- Parameters:
algorithmId
- algorithm- Returns:
- true if algorithm is acceptable, false otherwise
-
defaultSymmetricKeyEncryptionAlgorithmPolicy
@Deprecated public static Policy.SymmetricKeyAlgorithmPolicy defaultSymmetricKeyEncryptionAlgorithmPolicy()
Deprecated.not expressive - will be removed in a future releaseThe default symmetric encryption algorithm policy of PGPainless.- Returns:
- default symmetric encryption algorithm policy
-
symmetricKeyEncryptionPolicy2022
public static Policy.SymmetricKeyAlgorithmPolicy symmetricKeyEncryptionPolicy2022()
Policy for symmetric encryption algorithms in the context of message production (encryption). This suite contains algorithms that are deemed safe to use in 2022.- Returns:
- 2022 symmetric key encryption algorithm policy
-
defaultSymmetricKeyDecryptionAlgorithmPolicy
@Deprecated public static Policy.SymmetricKeyAlgorithmPolicy defaultSymmetricKeyDecryptionAlgorithmPolicy()
Deprecated.not expressive - will be removed in a future updateThe default symmetric decryption algorithm policy of PGPainless.- Returns:
- default symmetric decryption algorithm policy
-
symmetricKeyDecryptionPolicy2022
public static Policy.SymmetricKeyAlgorithmPolicy symmetricKeyDecryptionPolicy2022()
Policy for symmetric key encryption algorithms in the context of message consumption (decryption). This suite contains algorithms that are deemed safe to use in 2022.- Returns:
- 2022 symmetric key decryption algorithm policy
-
selectBest
public SymmetricKeyAlgorithm selectBest(java.util.List<SymmetricKeyAlgorithm> options)
Select the best acceptable algorithm from the options list. The best algorithm is the first algorithm we encounter in our list of acceptable algorithms that is also contained in the list of options.- Parameters:
options
- list of algorithm options- Returns:
- best
-
-