wkd-java/wkd-java/src/main/java/pgp/wkd/discovery/CertificateFetcher.java

40 lines
1.2 KiB
Java
Raw Normal View History

2022-03-10 16:56:46 +01:00
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
2022-03-17 15:27:28 +01:00
package pgp.wkd.discovery;
import pgp.wkd.WKDAddress;
2022-03-10 16:56:46 +01:00
import java.io.IOException;
import java.io.InputStream;
/**
* Abstract class for fetching OpenPGP certificates from the WKD.
* This class can be extended to fetch files from remote servers using different HTTP clients.
*/
2022-03-17 15:27:28 +01:00
public interface CertificateFetcher {
2022-03-10 16:56:46 +01:00
/**
* Attempt to fetch an OpenPGP certificate from the Web Key Directory.
*
* @param address WKDAddress object
2022-04-02 18:13:06 +02:00
* @param method discovery method
2022-03-10 16:56:46 +01:00
* @return input stream containing the certificate in its binary representation
*
* @throws IOException in case of an error
*/
2022-03-17 15:27:28 +01:00
InputStream fetchCertificate(WKDAddress address, DiscoveryMethod method) throws IOException;
/**
* Fetch the policy file belonging to the address and discovery method.
*
* @param address WKDAddress object
* @param method discovery method
* @return input stream containing the WKD policy file
*
* @throws IOException in case of an error
*/
InputStream fetchPolicy(WKDAddress address, DiscoveryMethod method) throws IOException;
2022-03-10 16:56:46 +01:00
}