Package org.pgpainless.policy
Class Policy.SymmetricKeyAlgorithmPolicy
java.lang.Object
org.pgpainless.policy.Policy.SymmetricKeyAlgorithmPolicy
- Enclosing class:
Policy
-
Constructor Summary
ConstructorsConstructorDescriptionSymmetricKeyAlgorithmPolicy
(SymmetricKeyAlgorithm defaultSymmetricKeyAlgorithm, List<SymmetricKeyAlgorithm> acceptableSymmetricKeyAlgorithms) -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.not expressive - will be removed in a future updateDeprecated.not expressive - will be removed in a future releaseReturn 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.selectBest
(List<SymmetricKeyAlgorithm> options) Select the best acceptable algorithm from the options list.Policy for symmetric key encryption algorithms in the context of message consumption (decryption).Policy for symmetric encryption algorithms in the context of message production (encryption).
-
Constructor Details
-
SymmetricKeyAlgorithmPolicy
public SymmetricKeyAlgorithmPolicy(SymmetricKeyAlgorithm defaultSymmetricKeyAlgorithm, List<SymmetricKeyAlgorithm> acceptableSymmetricKeyAlgorithms)
-
-
Method Details
-
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
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
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
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
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
-