Use keyserver.ubuntu.com as new default
This commit is contained in:
@@ -174,8 +174,8 @@ public final class Constants {
|
||||
}
|
||||
|
||||
public static final class Defaults {
|
||||
public static final String KEY_SERVERS = "hkps://hkps.pool.sks-keyservers.net, hkps://pgp.mit.edu";
|
||||
public static final int PREF_CURRENT_VERSION = 8;
|
||||
public static final String KEY_SERVERS = "hkps://keyserver.ubuntu.com,hkps://hkps.pool.sks-keyservers.net;hkp://jirk5u4osbsr34t5.onion,hkps://pgp.mit.edu";
|
||||
public static final int PREF_CURRENT_VERSION = 9;
|
||||
}
|
||||
|
||||
public static final class key {
|
||||
|
||||
@@ -113,6 +113,7 @@ public class KeychainApplication extends Application {
|
||||
TlsCertificatePinning.addPinnedCertificate("hkps.pool.sks-keyservers.net", getAssets(), "hkps.pool.sks-keyservers.net.CA.cer");
|
||||
TlsCertificatePinning.addPinnedCertificate("pgp.mit.edu", getAssets(), "pgp.mit.edu.cer");
|
||||
TlsCertificatePinning.addPinnedCertificate("api.keybase.io", getAssets(), "api.keybase.io.CA.cer");
|
||||
TlsCertificatePinning.addPinnedCertificate("keyserver.ubuntu.com", getAssets(), "DigiCertGlobalRootCA.cer");
|
||||
|
||||
TemporaryFileProvider.cleanUp(this);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.sufficientlysecure.keychain.Constants.Pref;
|
||||
import org.sufficientlysecure.keychain.KeychainApplication;
|
||||
import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress;
|
||||
import org.sufficientlysecure.keychain.service.KeyserverSyncAdapterService;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
@@ -424,11 +425,12 @@ public class Preferences {
|
||||
}
|
||||
|
||||
public void upgradePreferences(Context context) {
|
||||
Timber.d("Upgrading preferences…");
|
||||
int oldVersion = mSharedPreferences.getInt(Constants.Pref.PREF_VERSION, 0);
|
||||
boolean requiresUpgrade = oldVersion < Constants.Defaults.PREF_CURRENT_VERSION;
|
||||
|
||||
if (requiresUpgrade) {
|
||||
Timber.d("Upgrading preferences from %s to %s…", oldVersion, Constants.Defaults.PREF_CURRENT_VERSION);
|
||||
|
||||
switch (oldVersion) {
|
||||
case 1:
|
||||
// fall through
|
||||
@@ -494,6 +496,9 @@ public class Preferences {
|
||||
}
|
||||
setKeyServers(servers);
|
||||
}
|
||||
case 8: {
|
||||
replaceDefaultKeyserverWithUbuntu();
|
||||
}
|
||||
}
|
||||
|
||||
// write new preference version
|
||||
@@ -503,6 +508,20 @@ public class Preferences {
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceDefaultKeyserverWithUbuntu() {
|
||||
ArrayList<HkpKeyserverAddress> servers = getKeyServers();
|
||||
boolean oldDefaults = "hkps://hkps.pool.sks-keyservers.net".equalsIgnoreCase(servers.get(0).getUrl()) ||
|
||||
"hkps://pgp.mit.edu".equalsIgnoreCase(servers.get(0).getUrl());
|
||||
|
||||
HkpKeyserverAddress ubuntuKeyserver = HkpKeyserverAddress.createFromUri("hkps://keyserver.ubuntu.com");
|
||||
if (oldDefaults) {
|
||||
servers.add(0, ubuntuKeyserver);
|
||||
} else if (!servers.contains(ubuntuKeyserver)){
|
||||
servers.add(ubuntuKeyserver);
|
||||
}
|
||||
setKeyServers(servers);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
mSharedPreferences.edit().clear().commit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user