SignatureVerifier -> SignatureVerifierPlugin
This commit is contained in:
parent
7ec0665dbf
commit
ba94d09fb4
3 changed files with 11 additions and 11 deletions
|
@ -52,7 +52,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.receivers.AckAlarmRec
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.receivers.DBAccessReceiver;
|
import info.nightscout.androidaps.plugins.general.nsclient.receivers.DBAccessReceiver;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
|
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
|
||||||
import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifier;
|
import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerPlugin;
|
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerPlugin;
|
||||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
||||||
|
@ -203,7 +203,7 @@ public class MainApp extends Application {
|
||||||
if (!Config.NSCLIENT) pluginsList.add(SafetyPlugin.getPlugin());
|
if (!Config.NSCLIENT) pluginsList.add(SafetyPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT) pluginsList.add(VersionCheckerPlugin.INSTANCE);
|
if (!Config.NSCLIENT) pluginsList.add(VersionCheckerPlugin.INSTANCE);
|
||||||
if (!Config.NSCLIENT) pluginsList.add(StorageConstraintPlugin.getPlugin());
|
if (!Config.NSCLIENT) pluginsList.add(StorageConstraintPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT) pluginsList.add(SignatureVerifier.getPlugin());
|
if (!Config.NSCLIENT) pluginsList.add(SignatureVerifierPlugin.getPlugin());
|
||||||
if (!Config.APS) pluginsList.add(ObjectivesPlugin.INSTANCE);
|
if (!Config.APS) pluginsList.add(ObjectivesPlugin.INSTANCE);
|
||||||
pluginsList.add(SourceXdripPlugin.getPlugin());
|
pluginsList.add(SourceXdripPlugin.getPlugin());
|
||||||
pluginsList.add(SourceNSClientPlugin.getPlugin());
|
pluginsList.add(SourceNSClientPlugin.getPlugin());
|
||||||
|
|
|
@ -42,23 +42,23 @@ import info.nightscout.androidaps.utils.SP;
|
||||||
* In case someone decides to leak a ready-to-use APK nonetheless, we can still disable it.
|
* In case someone decides to leak a ready-to-use APK nonetheless, we can still disable it.
|
||||||
* Self-compiled APKs with privately held certificates cannot and will not be disabled.
|
* Self-compiled APKs with privately held certificates cannot and will not be disabled.
|
||||||
*/
|
*/
|
||||||
public class SignatureVerifier extends PluginBase implements ConstraintsInterface {
|
public class SignatureVerifierPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
|
|
||||||
private static final String REVOKED_CERTS_URL = "https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/src/main/assets/revoked_certs.txt";
|
private static final String REVOKED_CERTS_URL = "https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/src/main/assets/revoked_certs.txt";
|
||||||
private static final long UPDATE_INTERVAL = TimeUnit.DAYS.toMillis(1);
|
private static final long UPDATE_INTERVAL = TimeUnit.DAYS.toMillis(1);
|
||||||
|
|
||||||
private static SignatureVerifier plugin = new SignatureVerifier();
|
private static SignatureVerifierPlugin plugin = new SignatureVerifierPlugin();
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger(L.CORE);
|
private Logger log = LoggerFactory.getLogger(L.CORE);
|
||||||
private final Object $lock = new Object[0];
|
private final Object $lock = new Object[0];
|
||||||
private File revokedCertsFile;
|
private File revokedCertsFile;
|
||||||
private List<byte[]> revokedCerts;
|
private List<byte[]> revokedCerts;
|
||||||
|
|
||||||
public static SignatureVerifier getPlugin() {
|
public static SignatureVerifierPlugin getPlugin() {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SignatureVerifier() {
|
private SignatureVerifierPlugin() {
|
||||||
super(new PluginDescription()
|
super(new PluginDescription()
|
||||||
.mainType(PluginType.CONSTRAINTS)
|
.mainType(PluginType.CONSTRAINTS)
|
||||||
.neverVisible(true)
|
.neverVisible(true)
|
||||||
|
@ -125,7 +125,7 @@ public class SignatureVerifier extends PluginBase implements ConstraintsInterfac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException e) {
|
} catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException e) {
|
||||||
log.error("Error in SignatureVerifier", e);
|
log.error("Error in SignatureVerifierPlugin", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public class SignatureVerifier extends PluginBase implements ConstraintsInterfac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException e) {
|
} catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException e) {
|
||||||
log.error("Error in SignatureVerifier", e);
|
log.error("Error in SignatureVerifierPlugin", e);
|
||||||
}
|
}
|
||||||
return hashes;
|
return hashes;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ public class SignatureVerifier extends PluginBase implements ConstraintsInterfac
|
||||||
this.revokedCerts = parseRevokedCertsFile(revokedCerts);
|
this.revokedCerts = parseRevokedCertsFile(revokedCerts);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Error in SignatureVerifier", e);
|
log.error("Error in SignatureVerifierPlugin", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import info.nightscout.androidaps.BuildConfig;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifier;
|
import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by jamorham on 21/02/2018.
|
* Created by jamorham on 21/02/2018.
|
||||||
|
@ -128,7 +128,7 @@ public class FabricPrivacy {
|
||||||
MainApp.getFirebaseAnalytics().setUserProperty("Version", BuildConfig.VERSION);
|
MainApp.getFirebaseAnalytics().setUserProperty("Version", BuildConfig.VERSION);
|
||||||
MainApp.getFirebaseAnalytics().setUserProperty("HEAD", BuildConfig.HEAD);
|
MainApp.getFirebaseAnalytics().setUserProperty("HEAD", BuildConfig.HEAD);
|
||||||
MainApp.getFirebaseAnalytics().setUserProperty("Remote", remote);
|
MainApp.getFirebaseAnalytics().setUserProperty("Remote", remote);
|
||||||
List<String> hashes = SignatureVerifier.getPlugin().shortHashes();
|
List<String> hashes = SignatureVerifierPlugin.getPlugin().shortHashes();
|
||||||
if (hashes.size() >= 1)
|
if (hashes.size() >= 1)
|
||||||
MainApp.getFirebaseAnalytics().setUserProperty("Hash", hashes.get(0));
|
MainApp.getFirebaseAnalytics().setUserProperty("Hash", hashes.get(0));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue