1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-09 10:19:39 +02:00

SOP: Add convenience methods to deal with byte arrays

This commit is contained in:
Paul Schaub 2021-10-10 16:34:17 +02:00
parent 32f3f0246e
commit 15736586dd
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
25 changed files with 451 additions and 128 deletions

View file

@ -4,6 +4,7 @@
package sop.operation;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@ -13,5 +14,27 @@ import sop.exception.SOPGPException;
public interface VerifySignatures {
/**
* Provide the signed data (without signatures).
*
* @param data signed data
* @return list of signature verifications
* @throws IOException in case of an IO error
* @throws SOPGPException.NoSignature when no signature is found
* @throws SOPGPException.BadData when the data is invalid OpenPGP data
*/
List<Verification> data(InputStream data) throws IOException, SOPGPException.NoSignature, SOPGPException.BadData;
/**
* Provide the signed data (without signatures).
*
* @param data signed data
* @return list of signature verifications
* @throws IOException in case of an IO error
* @throws SOPGPException.NoSignature when no signature is found
* @throws SOPGPException.BadData when the data is invalid OpenPGP data
*/
default List<Verification> data(byte[] data) throws IOException, SOPGPException.NoSignature, SOPGPException.BadData {
return data(new ByteArrayInputStream(data));
}
}