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.InputStream; 009import java.util.Date; 010 011import sop.exception.SOPGPException; 012 013public interface Verify extends VerifySignatures { 014 015 /** 016 * Makes the SOP implementation consider signatures before this date invalid. 017 * 018 * @param timestamp timestamp 019 * @return builder instance 020 */ 021 Verify notBefore(Date timestamp) throws SOPGPException.UnsupportedOption; 022 023 /** 024 * Makes the SOP implementation consider signatures after this date invalid. 025 * 026 * @param timestamp timestamp 027 * @return builder instance 028 */ 029 Verify notAfter(Date timestamp) throws SOPGPException.UnsupportedOption; 030 031 /** 032 * Adds the verification cert. 033 * 034 * @param cert input stream containing the encoded cert 035 * @return builder instance 036 */ 037 Verify cert(InputStream cert) throws SOPGPException.BadData; 038 039 /** 040 * Adds the verification cert. 041 * 042 * @param cert byte array containing the encoded cert 043 * @return builder instance 044 */ 045 default Verify cert(byte[] cert) throws SOPGPException.BadData { 046 return cert(new ByteArrayInputStream(cert)); 047 } 048 049 /** 050 * Provides the signatures. 051 * @param signatures input stream containing encoded, detached signatures. 052 * 053 * @return builder instance 054 */ 055 VerifySignatures signatures(InputStream signatures) throws SOPGPException.BadData; 056 057 /** 058 * Provides the signatures. 059 * @param signatures byte array containing encoded, detached signatures. 060 * 061 * @return builder instance 062 */ 063 default VerifySignatures signatures(byte[] signatures) throws SOPGPException.BadData { 064 return signatures(new ByteArrayInputStream(signatures)); 065 } 066 067}