1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-10 18:59:39 +02:00

WIP: Kotlin conversion: ConsumerOptions

This commit is contained in:
Paul Schaub 2023-08-30 13:50:49 +02:00
parent cc63095ab0
commit 4a19e6ca20
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
5 changed files with 417 additions and 553 deletions

View file

@ -7,7 +7,6 @@ package org.pgpainless.decryption_verification;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
@ -59,29 +58,6 @@ public class MissingPassphraseForDecryptionTest {
message = out.toByteArray();
}
@Test
public void invalidPostponedKeysStrategyTest() {
SecretKeyPassphraseProvider callback = new SecretKeyPassphraseProvider() {
@Override
public Passphrase getPassphraseFor(Long keyId) {
fail("MUST NOT get called in if postponed key strategy is invalid.");
return null;
}
@Override
public boolean hasPassphrase(Long keyId) {
return true;
}
};
ConsumerOptions options = new ConsumerOptions()
.setMissingKeyPassphraseStrategy(null) // illegal
.addDecryptionKey(secretKeys, SecretKeyRingProtector.defaultSecretKeyRingProtector(callback));
assertThrows(IllegalStateException.class, () -> PGPainless.decryptAndOrVerify()
.onInputStream(new ByteArrayInputStream(message))
.withOptions(options));
}
@Test
public void interactiveStrategy() throws PGPException, IOException {
// interactive callback