diff --git a/wkd-java-cli/src/main/java/pgp/wkd/cli/command/Fetch.java b/wkd-java-cli/src/main/java/pgp/wkd/cli/command/Fetch.java index 1c919a2..34a46cd 100644 --- a/wkd-java-cli/src/main/java/pgp/wkd/cli/command/Fetch.java +++ b/wkd-java-cli/src/main/java/pgp/wkd/cli/command/Fetch.java @@ -56,6 +56,9 @@ public class Fetch implements Runnable { WKDAddress address = WKDAddress.fromEmail(email); try (InputStream inputStream = fetcher.fetch(address)) { PGPPublicKeyRing cert = PGPainless.readKeyRing().publicKeyRing(inputStream); + if (cert == null) { + throw new CertNotFetchableException("Fetched data does not contain an OpenPGP certificate."); + } KeyRingInfo info = PGPainless.inspectKeyRing(cert); List userIds = info.getValidAndExpiredUserIds();