2021-10-07 15:48:52 +02:00
|
|
|
// SPDX-FileCopyrightText: 2021 Paul Schaub <vanitasvitae@fsfe.org>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2021-08-18 18:27:22 +02:00
|
|
|
package sop.operation;
|
|
|
|
|
2021-10-10 16:34:17 +02:00
|
|
|
import java.io.ByteArrayInputStream;
|
2021-08-18 18:27:22 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
import sop.ReadyWithResult;
|
|
|
|
import sop.Signatures;
|
|
|
|
|
|
|
|
public interface DetachInbandSignatureAndMessage {
|
|
|
|
|
2021-10-10 16:34:17 +02:00
|
|
|
/**
|
|
|
|
* Do not wrap the signatures in ASCII armor.
|
|
|
|
* @return builder
|
|
|
|
*/
|
2021-08-18 18:27:22 +02:00
|
|
|
DetachInbandSignatureAndMessage noArmor();
|
|
|
|
|
2021-10-10 16:34:17 +02:00
|
|
|
/**
|
|
|
|
* Detach the provided cleartext signed message from its signatures.
|
|
|
|
*
|
|
|
|
* @param messageInputStream input stream containing the signed message
|
|
|
|
* @return result containing the detached message
|
|
|
|
* @throws IOException in case of an IO error
|
|
|
|
*/
|
2021-08-18 18:27:22 +02:00
|
|
|
ReadyWithResult<Signatures> message(InputStream messageInputStream) throws IOException;
|
|
|
|
|
2021-10-10 16:34:17 +02:00
|
|
|
/**
|
|
|
|
* Detach the provided cleartext signed message from its signatures.
|
|
|
|
*
|
|
|
|
* @param message byte array containing the signed message
|
|
|
|
* @return result containing the detached message
|
|
|
|
* @throws IOException in case of an IO error
|
|
|
|
*/
|
|
|
|
default ReadyWithResult<Signatures> message(byte[] message) throws IOException {
|
|
|
|
return message(new ByteArrayInputStream(message));
|
|
|
|
}
|
2021-08-18 18:27:22 +02:00
|
|
|
}
|