// SPDX-FileCopyrightText: 2021 Paul Schaub // // SPDX-License-Identifier: Apache-2.0 package sop.operation; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import sop.ReadyWithResult; import sop.Signatures; /** * Split cleartext signed messages up into data and signatures. */ public interface DetachInbandSignatureAndMessage { /** * Do not wrap the signatures in ASCII armor. * @return builder */ DetachInbandSignatureAndMessage noArmor(); /** * 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 */ ReadyWithResult message(InputStream messageInputStream) throws IOException; /** * 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 message(byte[] message) throws IOException { return message(new ByteArrayInputStream(message)); } }