diff --git a/.gitmodules b/.gitmodules
index b4c3f256c..4ab812ef0 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -2,10 +2,6 @@
path = extern/openpgp-api-lib
url = https://github.com/open-keychain/openpgp-api.git
ignore = dirty
-[submodule "extern/minidns"]
- path = extern/minidns
- url = https://github.com/open-keychain/minidns.git
- ignore = dirty
[submodule "OpenKeychain/src/test/resources/openpgp-interop"]
path = OpenKeychain/src/test/resources/openpgp-interop
url = https://github.com/google/openpgp-interop
diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle
index e18503ead..1c9cdcca5 100644
--- a/OpenKeychain/build.gradle
+++ b/OpenKeychain/build.gradle
@@ -58,7 +58,6 @@ dependencies {
implementation project(':extern:bouncycastle:core')
implementation project(':extern:bouncycastle:pg')
implementation project(':extern:bouncycastle:prov')
- implementation project(':extern:minidns')
implementation project(':extern:MaterialChipsInput')
implementation "android.arch.work:work-runtime:1.0.0-alpha02"
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java
deleted file mode 100644
index cd9a4caea..000000000
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2017 Schürmann & Breitmoser GbR
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package org.sufficientlysecure.keychain.util;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-
-import android.content.Context;
-
-import de.measite.minidns.Client;
-import de.measite.minidns.Question;
-import de.measite.minidns.Record;
-import de.measite.minidns.record.SRV;
-import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress;
-import org.sufficientlysecure.keychain.keyimport.HkpKeyserverClient;
-import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
-import org.sufficientlysecure.keychain.keyimport.KeyserverClient;
-import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
-import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
-import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
-import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
-
-public class EmailKeyHelper {
- // TODO: Make this not require a proxy in it's constructor, redesign when it is to be used
- // to import keys, simply use CryptoOperationHelper with this callback
- public abstract class ImportContactKeysCallback
- implements CryptoOperationHelper.Callback {
-
- private ArrayList mKeyList;
- private HkpKeyserverAddress mKeyserver;
-
- public ImportContactKeysCallback(Context context, HkpKeyserverAddress keyserver,
- ParcelableProxy proxy) {
- this(context, new ContactHelper(context).getContactMails(), keyserver, proxy);
- }
-
- public ImportContactKeysCallback(Context context, List mails,
- HkpKeyserverAddress keyserver, ParcelableProxy proxy) {
- Set entries = new HashSet<>();
- for (String mail : mails) {
- entries.addAll(getEmailKeys(context, mail, proxy));
- }
-
- // Put them in a list and import
- ArrayList keys = new ArrayList<>(entries.size());
- for (ImportKeysListEntry entry : entries) {
- keys.add(ParcelableKeyRing.createFromReference(entry.getFingerprint(), entry.getKeyIdHex(),
- null));
- }
- mKeyList = keys;
- mKeyserver = keyserver;
- }
-
- @Override
- public ImportKeyringParcel createOperationInput() {
- return ImportKeyringParcel.createImportKeyringParcel(mKeyList, mKeyserver);
- }
- }
-
- public static Set getEmailKeys(Context context, String mail,
- ParcelableProxy proxy) {
- Set keys = new HashSet<>();
-
- // Try _hkp._tcp SRV record first
- String[] mailparts = mail.split("@");
- if (mailparts.length == 2) {
- HkpKeyserverAddress hkp = findKeyserverFromDns(mailparts[1]);
- if (hkp != null) {
- keys.addAll(getEmailKeys(mail, hkp, proxy));
- }
- }
-
- if (keys.isEmpty()) {
- // Most users don't have the SRV record, so ask a default server as well
- HkpKeyserverAddress server = Preferences.getPreferences(context).getPreferredKeyserver();
- if (server != null) {
- keys.addAll(getEmailKeys(mail, server, proxy));
- }
- }
- return keys;
- }
-
- public static List getEmailKeys(String mail, HkpKeyserverAddress keyServer,
- ParcelableProxy proxy) {
- Set keys = new HashSet<>();
- try {
- for (ImportKeysListEntry key : HkpKeyserverClient
- .fromHkpKeyserverAddress(keyServer).search(mail, proxy)) {
- if (key.isRevokedOrExpiredOrInsecure()) continue;
- for (String userId : key.getUserIds()) {
- if (userId.toLowerCase().contains(mail.toLowerCase(Locale.ENGLISH))) {
- keys.add(key);
- }
- }
- }
- } catch (KeyserverClient.CloudSearchFailureException ignored) {
- }
- return new ArrayList<>(keys);
- }
-
- public static HkpKeyserverAddress findKeyserverFromDns(String domain) {
- try {
- Record[] records = new Client().query(new Question("_hkp._tcp." + domain, Record.TYPE.SRV)).getAnswers();
- if (records.length > 0) {
- Arrays.sort(records, new Comparator() {
- @Override
- public int compare(Record lhs, Record rhs) {
- if (lhs.getPayload().getType() != Record.TYPE.SRV) return 1;
- if (rhs.getPayload().getType() != Record.TYPE.SRV) return -1;
- return ((SRV) lhs.getPayload()).getPriority() - ((SRV) rhs.getPayload()).getPriority();
- }
- });
- Record record = records[0]; // This is our best choice
- if (record.getPayload().getType() == Record.TYPE.SRV) {
- SRV payload = (SRV) record.getPayload();
- return HkpKeyserverAddress.createFromUri(payload.getName() + ":" + payload.getPort());
- }
- }
- } catch (Exception ignored) {
- }
- return null;
- }
-}
diff --git a/extern/minidns b/extern/minidns
deleted file mode 160000
index 969ffd295..000000000
--- a/extern/minidns
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 969ffd2951fcaa07f46b441936a0c0fd4502dafd