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:
parent
cc63095ab0
commit
4a19e6ca20
5 changed files with 417 additions and 553 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue