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 Object

## Constructor Summary

Constructors
Constructor
Description
`SymmetricKeyAlgorithmPolicy(SymmetricKeyAlgorithm defaultSymmetricKeyAlgorithm, List<SymmetricKeyAlgorithm> acceptableSymmetricKeyAlgorithms)`

## Method Summary

Modifier and Type
Method
Description
`static Policy.SymmetricKeyAlgorithmPolicy`
`defaultSymmetricKeyDecryptionAlgorithmPolicy()`
Deprecated.
not expressive - will be removed in a future update
`static Policy.SymmetricKeyAlgorithmPolicy`
`defaultSymmetricKeyEncryptionAlgorithmPolicy()`
Deprecated.
not expressive - will be removed in a future release
`SymmetricKeyAlgorithm`
`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(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).

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SymmetricKeyAlgorithmPolicy

public SymmetricKeyAlgorithmPolicy(SymmetricKeyAlgorithm defaultSymmetricKeyAlgorithm, List<SymmetricKeyAlgorithm> acceptableSymmetricKeyAlgorithms)

## Method Details

### 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 release
The 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 update
The 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(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