@Test public void testShouldBeAbleToResignAnSignedApp() throws Exception { SelendroidServerBuilder builder = getDefaultBuilder(); File androidApp = File.createTempFile("testapp", ".apk"); FileUtils.copyFile(new File(APK_FILE), androidApp); AndroidApp resignedApp = builder.resignApp(androidApp); assertResignedApp(resignedApp, androidApp); CommandLine cmd = new CommandLine(AndroidSdk.aapt()); cmd.addArgument("list", false); cmd.addArgument(resignedApp.getAbsolutePath(), false); String output = ShellCommand.exec(cmd); assertResultDoesNotContainFile(output, "META-INF/CERT.RSA"); assertResultDoesNotContainFile(output, "META-INF/CERT.SF"); assertResultDoesContainFile(output, "META-INF/ANDROIDD.SF"); assertResultDoesContainFile(output, "META-INF/ANDROIDD.RSA"); assertResultDoesContainFile(output, "AndroidManifest.xml"); }
public AndroidApp resignApp(File appFile) throws ShellCommandException, AndroidSdkException, IOException { AndroidApp app = new DefaultAndroidApp(appFile); deleteFileFromAppSilently(app, "META-INF/MANIFEST.MF"); deleteFileFromAppSilently(app, "META-INF/CERT.RSA"); deleteFileFromAppSilently(app, "META-INF/CERT.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.RSA"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.SF"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.RSA"); File outputFile = File.createTempFile("resigned-", appFile.getName()); if (deleteTmpFiles()) { outputFile.deleteOnExit(); } return signTestServer(appFile, outputFile); }
SelendroidServerBuilder { public AndroidApp resignApp(File appFile) throws ShellCommandException, AndroidSdkException, IOException { AndroidApp app = new DefaultAndroidApp(appFile); deleteFileFromAppSilently(app, "META-INF/MANIFEST.MF"); deleteFileFromAppSilently(app, "META-INF/CERT.RSA"); deleteFileFromAppSilently(app, "META-INF/CERT.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.RSA"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.SF"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.RSA"); File outputFile = File.createTempFile("resigned-", appFile.getName()); if (deleteTmpFiles()) { outputFile.deleteOnExit(); } return signTestServer(appFile, outputFile); } }
SelendroidServerBuilder { public AndroidApp resignApp(File appFile) throws ShellCommandException, AndroidSdkException, IOException { AndroidApp app = new DefaultAndroidApp(appFile); deleteFileFromAppSilently(app, "META-INF/MANIFEST.MF"); deleteFileFromAppSilently(app, "META-INF/CERT.RSA"); deleteFileFromAppSilently(app, "META-INF/CERT.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.RSA"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.SF"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.RSA"); File outputFile = File.createTempFile("resigned-", appFile.getName()); if (deleteTmpFiles()) { outputFile.deleteOnExit(); } return signTestServer(appFile, outputFile); } SelendroidServerBuilder(String selendroidPrebuildServerPath,
                                       String selendroidApplicationXmlTemplate);   SelendroidServerBuilder(String selendroidPrebuildServerPath,
                                       String selendroidApplicationXmlTemplate,
                                       SelendroidConfiguration selendroidConfiguration);  SelendroidServerBuilder(SelendroidConfiguration selendroidConfiguration); }
SelendroidServerBuilder { public AndroidApp resignApp(File appFile) throws ShellCommandException, AndroidSdkException, IOException { AndroidApp app = new DefaultAndroidApp(appFile); deleteFileFromAppSilently(app, "META-INF/MANIFEST.MF"); deleteFileFromAppSilently(app, "META-INF/CERT.RSA"); deleteFileFromAppSilently(app, "META-INF/CERT.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.RSA"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.SF"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.RSA"); File outputFile = File.createTempFile("resigned-", appFile.getName()); if (deleteTmpFiles()) { outputFile.deleteOnExit(); } return signTestServer(appFile, outputFile); } SelendroidServerBuilder(String selendroidPrebuildServerPath,
                                       String selendroidApplicationXmlTemplate);   SelendroidServerBuilder(String selendroidPrebuildServerPath,
                                       String selendroidApplicationXmlTemplate,
                                       SelendroidConfiguration selendroidConfiguration);  SelendroidServerBuilder(SelendroidConfiguration selendroidConfiguration); AndroidApp createSelendroidServer(AndroidApp aut); AndroidApp resignApp(File appFile); static String getJarVersionNumber(); }
SelendroidServerBuilder { public AndroidApp resignApp(File appFile) throws ShellCommandException, AndroidSdkException, IOException { AndroidApp app = new DefaultAndroidApp(appFile); deleteFileFromAppSilently(app, "META-INF/MANIFEST.MF"); deleteFileFromAppSilently(app, "META-INF/CERT.RSA"); deleteFileFromAppSilently(app, "META-INF/CERT.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.SF"); deleteFileFromAppSilently(app, "META-INF/ANDROIDD.RSA"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.SF"); deleteFileFromAppSilently(app, "META-INF/NDKEYSTO.RSA"); File outputFile = File.createTempFile("resigned-", appFile.getName()); if (deleteTmpFiles()) { outputFile.deleteOnExit(); } return signTestServer(appFile, outputFile); } SelendroidServerBuilder(String selendroidPrebuildServerPath,
                                       String selendroidApplicationXmlTemplate);   SelendroidServerBuilder(String selendroidPrebuildServerPath,
                                       String selendroidApplicationXmlTemplate,
                                       SelendroidConfiguration selendroidConfiguration);  SelendroidServerBuilder(SelendroidConfiguration selendroidConfiguration); AndroidApp createSelendroidServer(AndroidApp aut); AndroidApp resignApp(File appFile); static String getJarVersionNumber(); static final String SELENDROID_TEST_APP_PACKAGE; static final String SELENDROID_FINAL_NAME; static final String PREBUILD_SELENDROID_SERVER_PATH_PREFIX; static final String ANDROID_APPLICATION_XML_TEMPLATE; static final String ICON; }