Package org.pgpainless.algorithm.negotiation

# Interface HashAlgorithmNegotiator

public interface HashAlgorithmNegotiator
Interface for a class that negotiates `HashAlgorithms`. You can provide your own implementation using custom logic by implementing the `negotiateHashAlgorithm(Set)` method.

## Method Summary

Modifier and Type
Method
Description
`static HashAlgorithmNegotiator`
`negotiateByPolicy(Policy.HashAlgorithmPolicy hashAlgorithmPolicy)`
Return an instance that negotiates `HashAlgorithms` based on the given `Policy.HashAlgorithmPolicy`.
`HashAlgorithm`
`negotiateHashAlgorithm(Set<HashAlgorithm> orderedHashAlgorithmPreferencesSet)`
Pick one `HashAlgorithm` from the ordered set of acceptable algorithms.
`static HashAlgorithmNegotiator`
`negotiateRevocationSignatureAlgorithm(Policy policy)`
Return an instance that negotiates `HashAlgorithms` used for revocation signatures based on the given `Policy`.
`static HashAlgorithmNegotiator`
`negotiateSignatureHashAlgorithm(Policy policy)`
Return an instance that negotiates `HashAlgorithms` used for non-revocation signatures based on the given `Policy`.

## Method Details

### negotiateHashAlgorithm

HashAlgorithm negotiateHashAlgorithm(Set<HashAlgorithm> orderedHashAlgorithmPreferencesSet)
Pick one `HashAlgorithm` from the ordered set of acceptable algorithms.

Parameters:
  `orderedHashAlgorithmPreferencesSet` - hash algorithm preferences
Returns:
  picked algorithms

### negotiateSignatureHashAlgorithm

static HashAlgorithmNegotiator negotiateSignatureHashAlgorithm(Policy policy)
Return an instance that negotiates `HashAlgorithms` used for non-revocation signatures based on the given `Policy`.

Parameters:
  `policy` - algorithm policy
Returns:
  negotiator

### negotiateRevocationSignatureAlgorithm

static HashAlgorithmNegotiator negotiateRevocationSignatureAlgorithm(Policy policy)
Return an instance that negotiates `HashAlgorithms` used for revocation signatures based on the given `Policy`.

Parameters:
  `policy` - algorithm policy
Returns:
  negotiator

### negotiateByPolicy

static HashAlgorithmNegotiator negotiateByPolicy(Policy.HashAlgorithmPolicy hashAlgorithmPolicy)
Return an instance that negotiates `HashAlgorithms` based on the given `Policy.HashAlgorithmPolicy`.

Parameters:
  `hashAlgorithmPolicy` - algorithm policy for hash algorithms
Returns:
  negotiator