mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 02:39:39 +02:00
Rework Policy to be immutable. Changes are now done by calling policy.copy().withXYZ().build()
This commit is contained in:
parent
33ee03ee35
commit
e284fca0f8
9 changed files with 192 additions and 94 deletions
|
@ -134,8 +134,12 @@ public class VerifyLegacySignatureTest {
|
|||
assertFalse(result.getResult().isEmpty());
|
||||
|
||||
// Adjust data signature hash policy to accept new SHA-1 sigs
|
||||
PGPainless.getPolicy().setDataSignatureHashAlgorithmPolicy(
|
||||
Policy.HashAlgorithmPolicy.static2022RevocationSignatureHashAlgorithmPolicy());
|
||||
Policy policy = PGPainless.getPolicy();
|
||||
Policy adjusted = policy.copy()
|
||||
.withDataSignatureHashAlgorithmPolicy(
|
||||
Policy.HashAlgorithmPolicy.static2022RevocationSignatureHashAlgorithmPolicy()
|
||||
).build();
|
||||
PGPainless.getInstance().setAlgorithmPolicy(adjusted);
|
||||
|
||||
// Sig generated in 2024 using SHA1
|
||||
String newSig = "-----BEGIN PGP MESSAGE-----\n" +
|
||||
|
@ -160,5 +164,8 @@ public class VerifyLegacySignatureTest {
|
|||
.toByteArrayAndResult();
|
||||
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
|
||||
// Reset old policy
|
||||
PGPainless.getInstance().setAlgorithmPolicy(policy);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue