1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-23 04:42:06 +01:00

Respect Policy when negotiating hash algorithm

This commit is contained in:
Paul Schaub 2021-01-29 15:15:27 +01:00
parent d7ef05775d
commit ff1fb7e07f
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -29,6 +29,7 @@ import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.openpgp.PGPSignatureGenerator;
import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder;
import org.pgpainless.PGPainless;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.SignatureType;
import org.pgpainless.implementation.ImplementationFactory;
@ -57,7 +58,7 @@ public class SignatureUtils {
private static HashAlgorithm negotiateHashAlgorithm(List<HashAlgorithm> preferredHashAlgorithms) {
if (preferredHashAlgorithms.isEmpty()) {
return HashAlgorithm.SHA512;
return PGPainless.getPolicy().getDefaultSignatureHashAlgorithm();
}
return preferredHashAlgorithms.get(0);
}