mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 18:59:39 +02:00
Make KO-countermeasures configurable (off by default)
This commit is contained in:
parent
cfba77dea5
commit
bfbaa30e4c
3 changed files with 39 additions and 1 deletions
|
@ -212,10 +212,12 @@ public class ModifiedPublicKeysInvestigation {
|
|||
SecretKeyRingProtector protector = SecretKeyRingProtector.unlockAnyKeyWith(Passphrase.fromPassword("12345678"));
|
||||
PGPSecretKeyRing dsa = PGPainless.readKeyRing().secretKeyRing(DSA);
|
||||
|
||||
PGPainless.getPolicy().setEnableKeyParameterValidation(true);
|
||||
assertThrows(KeyIntegrityException.class, () ->
|
||||
UnlockSecretKey.unlockSecretKey(dsa.getSecretKey(KeyIdUtil.fromLongKeyId("b1bd1f049ec87f3d")), protector));
|
||||
assertThrows(KeyIntegrityException.class, () ->
|
||||
UnlockSecretKey.unlockSecretKey(dsa.getSecretKey(KeyIdUtil.fromLongKeyId("f5ffdf6d71dd5789")), protector));
|
||||
PGPainless.getPolicy().setEnableKeyParameterValidation(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -223,8 +225,10 @@ public class ModifiedPublicKeysInvestigation {
|
|||
SecretKeyRingProtector protector = SecretKeyRingProtector.unlockAnyKeyWith(Passphrase.fromPassword("12345678"));
|
||||
PGPSecretKeyRing elgamal = PGPainless.readKeyRing().secretKeyRing(ELGAMAL);
|
||||
|
||||
PGPainless.getPolicy().setEnableKeyParameterValidation(true);
|
||||
assertThrows(KeyIntegrityException.class, () ->
|
||||
UnlockSecretKey.unlockSecretKey(elgamal.getSecretKey(KeyIdUtil.fromLongKeyId("f5ffdf6d71dd5789")), protector));
|
||||
PGPainless.getPolicy().setEnableKeyParameterValidation(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -232,8 +236,10 @@ public class ModifiedPublicKeysInvestigation {
|
|||
PGPSecretKeyRing secretKeys = PGPainless.readKeyRing().secretKeyRing(INJECTED_KEY);
|
||||
SecretKeyRingProtector protector = SecretKeyRingProtector.unlockAnyKeyWith(Passphrase.fromPassword("pass"));
|
||||
|
||||
PGPainless.getPolicy().setEnableKeyParameterValidation(true);
|
||||
assertThrows(KeyIntegrityException.class, () ->
|
||||
UnlockSecretKey.unlockSecretKey(secretKeys.getSecretKey(), protector));
|
||||
PGPainless.getPolicy().setEnableKeyParameterValidation(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue