001// SPDX-FileCopyrightText: 2021 Paul Schaub <vanitasvitae@fsfe.org> 002// 003// SPDX-License-Identifier: Apache-2.0 004 005package sop.operation; 006 007import java.io.ByteArrayInputStream; 008import java.io.IOException; 009import java.io.InputStream; 010import java.util.List; 011 012import sop.Verification; 013import sop.exception.SOPGPException; 014 015public interface VerifySignatures { 016 017 /** 018 * Provide the signed data (without signatures). 019 * 020 * @param data signed data 021 * @return list of signature verifications 022 * @throws IOException in case of an IO error 023 * @throws SOPGPException.NoSignature when no signature is found 024 * @throws SOPGPException.BadData when the data is invalid OpenPGP data 025 */ 026 List<Verification> data(InputStream data) throws IOException, SOPGPException.NoSignature, SOPGPException.BadData; 027 028 /** 029 * Provide the signed data (without signatures). 030 * 031 * @param data signed data 032 * @return list of signature verifications 033 * @throws IOException in case of an IO error 034 * @throws SOPGPException.NoSignature when no signature is found 035 * @throws SOPGPException.BadData when the data is invalid OpenPGP data 036 */ 037 default List<Verification> data(byte[] data) throws IOException, SOPGPException.NoSignature, SOPGPException.BadData { 038 return data(new ByteArrayInputStream(data)); 039 } 040}