Package org.pgpainless.algorithm.negotiation

# Interface SymmetricKeyAlgorithmNegotiator

public interface SymmetricKeyAlgorithmNegotiator
Interface for symmetric key algorithm negotiation.

## Method Summary

Modifier and Type
Method
Description
`static SymmetricKeyAlgorithmNegotiator`
`byPopularity()`
Return an instance that negotiates a `SymmetricKeyAlgorithm` by selecting the most popular acceptable algorithm from the list of preferences.
`SymmetricKeyAlgorithm`
`negotiate(Policy.SymmetricKeyAlgorithmPolicy policy, SymmetricKeyAlgorithm override, List<Set<SymmetricKeyAlgorithm>> keyPreferences)`
Negotiate a symmetric encryption algorithm.

## Method Details

### negotiate

SymmetricKeyAlgorithm negotiate(Policy.SymmetricKeyAlgorithmPolicy policy, SymmetricKeyAlgorithm override, List<Set<SymmetricKeyAlgorithm>> keyPreferences)
Negotiate a symmetric encryption algorithm. If the override is non-null, it will be returned instead of performing an actual negotiation. Otherwise, the list of ordered sets containing the preferences of different recipient keys will be used to determine a suitable symmetric encryption algorithm.

Parameters:
  `policy` - algorithm policy
  `override` - algorithm override (if not null, return this)
  `keyPreferences` - list of preferences per key
Returns:
  negotiated algorithm

### byPopularity

static SymmetricKeyAlgorithmNegotiator byPopularity()
Return an instance that negotiates a `SymmetricKeyAlgorithm` by selecting the most popular acceptable algorithm from the list of preferences. This negotiator has the best chances to select an algorithm which is understood by all recipients.

Returns:
  negotiator that selects by popularity