Package org.pgpainless.policy
Class Policy.HashAlgorithmPolicy
- java.lang.Object
-
- org.pgpainless.policy.Policy.HashAlgorithmPolicy
-
- Enclosing class:
- Policy
public static final class Policy.HashAlgorithmPolicy extends Object
-
-
Constructor Summary
Constructors Constructor Description HashAlgorithmPolicy(HashAlgorithm defaultHashAlgorithm, List<HashAlgorithm> acceptableHashAlgorithms)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HashAlgorithm
defaultHashAlgorithm()
Return the default hash algorithm.static Policy.HashAlgorithmPolicy
defaultRevocationSignatureHashAlgorithmPolicy()
The default revocation signature hash algorithm policy of PGPainless.static Policy.HashAlgorithmPolicy
defaultSignatureAlgorithmPolicy()
The default signature hash algorithm policy of PGPainless.boolean
isAcceptable(int algorithmId)
Return true if the given hash algorithm is acceptable by this policy.boolean
isAcceptable(HashAlgorithm hashAlgorithm)
Return true if the given hash algorithm is acceptable by this policy.
-
-
-
Constructor Detail
-
HashAlgorithmPolicy
public HashAlgorithmPolicy(HashAlgorithm defaultHashAlgorithm, List<HashAlgorithm> acceptableHashAlgorithms)
-
-
Method Detail
-
defaultHashAlgorithm
public HashAlgorithm defaultHashAlgorithm()
Return the default hash algorithm. This algorithm is used as a fallback when no consensus about hash algorithms can be reached.- Returns:
- default hash algorithm
-
isAcceptable
public boolean isAcceptable(HashAlgorithm hashAlgorithm)
Return true if the given hash algorithm is acceptable by this policy.- Parameters:
hashAlgorithm
- hash algorithm- Returns:
- true if the hash algorithm is acceptable, false otherwise
-
isAcceptable
public boolean isAcceptable(int algorithmId)
Return true if the given hash algorithm is acceptable by this policy.- Parameters:
algorithmId
- hash algorithm- Returns:
- true if the hash algorithm is acceptable, false otherwise
-
defaultSignatureAlgorithmPolicy
public static Policy.HashAlgorithmPolicy defaultSignatureAlgorithmPolicy()
The default signature hash algorithm policy of PGPainless. Note that this policy is only used for non-revocation signatures. For revocation signaturesdefaultRevocationSignatureHashAlgorithmPolicy()
is used instead.- Returns:
- default signature hash algorithm policy
-
defaultRevocationSignatureHashAlgorithmPolicy
public static Policy.HashAlgorithmPolicy defaultRevocationSignatureHashAlgorithmPolicy()
The default revocation signature hash algorithm policy of PGPainless.- Returns:
- default revocation signature hash algorithm policy
-
-