mirror of
https://codeberg.org/PGPainless/wkd-java.git
synced 2025-09-09 03:09:39 +02:00
Add support for fetching policy objects
This commit is contained in:
parent
cb996733fb
commit
d7cddf26bb
9 changed files with 318 additions and 22 deletions
|
@ -10,6 +10,7 @@ import pgp.wkd.discovery.CertificateFetcher;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
@ -26,6 +27,15 @@ public class DirectoryBasedCertificateFetcher implements CertificateFetcher {
|
|||
|
||||
@Override
|
||||
public InputStream fetchCertificate(WKDAddress address, DiscoveryMethod method) throws IOException {
|
||||
return inputStreamFromFile(address, method);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream fetchPolicy(WKDAddress address, DiscoveryMethod method) throws IOException {
|
||||
return inputStreamFromFile(address, method);
|
||||
}
|
||||
|
||||
private InputStream inputStreamFromFile(WKDAddress address, DiscoveryMethod method) throws FileNotFoundException {
|
||||
URI uri = address.getUri(method);
|
||||
String path = uri.getPath().substring(1); // get rid of leading slash at start of path
|
||||
File file = rootPath.resolve(path).toFile();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue