2022-07-04 19:38:01 +02:00
|
|
|
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
package pgp.certificate_store;
|
|
|
|
|
|
|
|
import pgp.certificate_store.exception.BadDataException;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
public interface KeyReaderBackend {
|
|
|
|
|
|
|
|
/**
|
2022-08-08 13:50:59 +02:00
|
|
|
* Read a {@link KeyMaterial} (either {@link Key} or {@link Certificate}) from the given {@link InputStream}.
|
2022-07-04 19:38:01 +02:00
|
|
|
*
|
|
|
|
* @param data input stream containing the binary representation of the key.
|
2022-08-08 13:50:59 +02:00
|
|
|
* @return key or certificate object
|
2022-07-04 19:38:01 +02:00
|
|
|
*
|
|
|
|
* @throws IOException in case of an IO error
|
2022-08-08 13:50:59 +02:00
|
|
|
* @throws BadDataException in case that the data stream does not contain a valid OpenPGP key/certificate
|
2022-07-04 19:38:01 +02:00
|
|
|
*/
|
2022-08-08 13:50:59 +02:00
|
|
|
KeyMaterial read(InputStream data) throws IOException, BadDataException;
|
2022-07-04 19:38:01 +02:00
|
|
|
}
|