if an error occurred.
"""
- # verify the jar signature is correct
- if not common.verify_apk_signature(apkpath):
- return None
-
with zipfile.ZipFile(apkpath, 'r') as apk:
certs = [n for n in apk.namelist() if common.CERT_PATH_REGEX.match(n)]
apk['icons_src'] = {}
apk['icons'] = {}
apk['antiFeatures'] = set()
- if has_old_openssl(apkfile):
- apk['antiFeatures'].add('KnownVuln')
try:
if SdkToolsPopen(['aapt', 'version'], output=False):
apk['srcname'] = srcfilename
apk['size'] = os.path.getsize(apkfile)
+ # verify the jar signature is correct
+ if not common.verify_apk_signature(apkfile):
+ return True, None, False
+
+ if has_old_openssl(apkfile):
+ apk['antiFeatures'].add('KnownVuln')
+
apkzip = zipfile.ZipFile(apkfile, 'r')
# if an APK has files newer than the system time, suggest updating
self.assertTrue(False, 'TypeError!')
def testBadGetsig(self):
+ """getsig() should still be able to fetch the fingerprint of bad signatures"""
# config needed to use jarsigner and keytool
config = dict()
fdroidserver.common.fill_config_defaults(config)
fdroidserver.update.config = config
+
apkfile = os.path.join(os.path.dirname(__file__), 'urzip-badsig.apk')
- sig = self.javagetsig(apkfile)
- self.assertIsNone(sig, "sig should be None: " + str(sig))
- pysig = fdroidserver.update.getsig(apkfile)
- self.assertIsNone(pysig, "python sig should be None: " + str(sig))
+ sig = fdroidserver.update.getsig(apkfile)
+ self.assertEqual(sig, 'e0ecb5fc2d63088e4a07ae410a127722',
+ "python sig should be: " + str(sig))
apkfile = os.path.join(os.path.dirname(__file__), 'urzip-badcert.apk')
- sig = self.javagetsig(apkfile)
- self.assertIsNone(sig, "sig should be None: " + str(sig))
- pysig = fdroidserver.update.getsig(apkfile)
- self.assertIsNone(pysig, "python sig should be None: " + str(sig))
+ sig = fdroidserver.update.getsig(apkfile)
+ self.assertEqual(sig, 'e0ecb5fc2d63088e4a07ae410a127722',
+ "python sig should be: " + str(sig))
def testScanApksAndObbs(self):
os.chdir(os.path.join(localmodule, 'tests'))