mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-27 06:42:05 +01:00
Respect Policy when negotiating hash algorithm
This commit is contained in:
parent
d7ef05775d
commit
ff1fb7e07f
1 changed files with 2 additions and 1 deletions
|
@ -29,6 +29,7 @@ import org.bouncycastle.openpgp.PGPSecretKey;
|
||||||
import org.bouncycastle.openpgp.PGPSignature;
|
import org.bouncycastle.openpgp.PGPSignature;
|
||||||
import org.bouncycastle.openpgp.PGPSignatureGenerator;
|
import org.bouncycastle.openpgp.PGPSignatureGenerator;
|
||||||
import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder;
|
import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder;
|
||||||
|
import org.pgpainless.PGPainless;
|
||||||
import org.pgpainless.algorithm.HashAlgorithm;
|
import org.pgpainless.algorithm.HashAlgorithm;
|
||||||
import org.pgpainless.algorithm.SignatureType;
|
import org.pgpainless.algorithm.SignatureType;
|
||||||
import org.pgpainless.implementation.ImplementationFactory;
|
import org.pgpainless.implementation.ImplementationFactory;
|
||||||
|
@ -57,7 +58,7 @@ public class SignatureUtils {
|
||||||
|
|
||||||
private static HashAlgorithm negotiateHashAlgorithm(List<HashAlgorithm> preferredHashAlgorithms) {
|
private static HashAlgorithm negotiateHashAlgorithm(List<HashAlgorithm> preferredHashAlgorithms) {
|
||||||
if (preferredHashAlgorithms.isEmpty()) {
|
if (preferredHashAlgorithms.isEmpty()) {
|
||||||
return HashAlgorithm.SHA512;
|
return PGPainless.getPolicy().getDefaultSignatureHashAlgorithm();
|
||||||
}
|
}
|
||||||
return preferredHashAlgorithms.get(0);
|
return preferredHashAlgorithms.get(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue