sop-java/sop-java/src/main/java/sop/operation/ExtractCert.java

51 lines
1.5 KiB
Java
Raw Normal View History

2022-01-11 13:46:05 +01:00
// SPDX-FileCopyrightText: 2021 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.operation;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import sop.Ready;
import sop.exception.SOPGPException;
public interface ExtractCert {
/**
* Disable ASCII armor encoding.
*
* @return builder instance
*/
ExtractCert noArmor();
/**
* Extract the cert(s) from the provided key(s).
*
* @param keyInputStream input stream containing the encoding of one or more OpenPGP keys
* @return result containing the encoding of the keys certs
2022-04-11 12:35:56 +02:00
*
* @throws IOException in case of an IO error
* @throws sop.exception.SOPGPException.BadData if the {@link InputStream} does not contain an OpenPGP key
2022-01-11 13:46:05 +01:00
*/
2022-06-10 16:16:37 +02:00
Ready key(InputStream keyInputStream)
throws IOException,
SOPGPException.BadData;
2022-01-11 13:46:05 +01:00
/**
* Extract the cert(s) from the provided key(s).
*
* @param key byte array containing the encoding of one or more OpenPGP key
* @return result containing the encoding of the keys certs
2022-04-11 12:35:56 +02:00
*
* @throws IOException in case of an IO error
* @throws sop.exception.SOPGPException.BadData if the byte array does not contain an OpenPGP key
2022-01-11 13:46:05 +01:00
*/
2022-06-10 16:16:37 +02:00
default Ready key(byte[] key)
throws IOException,
SOPGPException.BadData {
2022-01-11 13:46:05 +01:00
return key(new ByteArrayInputStream(key));
}
}