2021-10-07 15:48:52 +02:00
|
|
|
// SPDX-FileCopyrightText: 2021 Paul Schaub <vanitasvitae@fsfe.org>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2021-09-13 18:09:53 +02:00
|
|
|
package org.pgpainless.decryption_verification.cleartext_signatures;
|
2021-05-15 18:44:03 +02:00
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
2021-08-28 11:39:50 +02:00
|
|
|
import org.pgpainless.decryption_verification.ConsumerOptions;
|
2021-05-15 18:44:03 +02:00
|
|
|
|
2021-08-14 11:39:13 +02:00
|
|
|
/**
|
|
|
|
* Interface defining the API for verification of cleartext signed documents.
|
|
|
|
*/
|
2021-05-15 18:44:03 +02:00
|
|
|
public interface VerifyCleartextSignatures {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provide the {@link InputStream} which contains the cleartext-signed message.
|
|
|
|
* @param inputStream inputstream
|
|
|
|
* @return api handle
|
|
|
|
*/
|
|
|
|
WithStrategy onInputStream(InputStream inputStream);
|
|
|
|
|
|
|
|
interface WithStrategy {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provide a {@link MultiPassStrategy} which is used to store the message content.
|
|
|
|
* Since cleartext-signed messages cannot be processed in one pass, the message has to be passed twice.
|
|
|
|
* Therefore the user needs to decide upon a strategy where to cache/store the message between the passes.
|
|
|
|
* This could be {@link MultiPassStrategy#writeMessageToFile(File)} or {@link MultiPassStrategy#keepMessageInMemory()},
|
|
|
|
* depending on message size and use-case.
|
|
|
|
*
|
|
|
|
* @param multiPassStrategy strategy
|
|
|
|
* @return api handle
|
|
|
|
*/
|
|
|
|
VerifyWith withStrategy(MultiPassStrategy multiPassStrategy);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
interface VerifyWith {
|
|
|
|
|
2021-08-28 11:39:50 +02:00
|
|
|
/**
|
|
|
|
* Pass in consumer options like verification certificates, acceptable date ranges etc.
|
|
|
|
*
|
|
|
|
* @param options options
|
|
|
|
* @return processor
|
|
|
|
* @throws IOException in case of an IO error
|
|
|
|
*/
|
|
|
|
CleartextSignatureProcessor withOptions(ConsumerOptions options) throws IOException;
|
|
|
|
|
2021-05-15 18:44:03 +02:00
|
|
|
}
|
|
|
|
}
|