def sign(self, signer): """ Sign everything in this bundle, recursively with sub-bundles """ # log.debug("SIGNING: %s" % self.path) frameworks_path = join(self.path, 'Frameworks') if exists(frameworks_path): # log.debug("SIGNING FRAMEWORKS: %s" % frameworks_path) # sign all the frameworks for framework_name in os.listdir(frameworks_path): framework_path = join(frameworks_path, framework_name) # log.debug("checking for framework: %s" % framework_path) try: framework = Framework(framework_path) # log.debug("resigning: %s" % framework_path) framework.resign(signer) except NotMatched: # log.debug("not a framework: %s" % framework_path) continue # sign all the dylibs dylib_paths = glob.glob(join(frameworks_path, '*.dylib')) for dylib_path in dylib_paths: dylib = signable.Dylib(dylib_path) dylib.sign(self, signer) # then create the seal # TODO maybe the app should know what its seal path should be... self.seal_path = code_resources.make_seal(self.get_executable_path(), self.path) # then sign the app executable = self.executable_class(self.get_executable_path()) executable.sign(self, signer)
def sign(self, signer): """ Sign everything in this bundle, recursively with sub-bundles """ # log.debug("SIGNING: %s" % self.path) # sign all tweak's dylibs dylib_paths1 = glob.glob(join(self.path, '*.dylib')) for dylib_path1 in dylib_paths1: if exists(dylib_path1): log.info("Dylib file %s" % dylib_path1) dylib = signable.Dylib(self, dylib_path1) dylib.sign(self, signer) frameworks_path = join(self.path, 'Frameworks') if exists(frameworks_path): # log.debug("SIGNING FRAMEWORKS: %s" % frameworks_path) # sign all the frameworks for framework_name in os.listdir(frameworks_path): framework_path = join(frameworks_path, framework_name) # log.debug("checking for framework: %s" % framework_path) try: framework = Framework(framework_path) # log.debug("resigning: %s" % framework_path) framework.resign(signer) except NotMatched: # log.debug("not a framework: %s" % framework_path) continue # sign all the dylibs dylib_paths = glob.glob(join(frameworks_path, '*.dylib')) for dylib_path in dylib_paths: dylib = signable.Dylib(self, dylib_path) dylib.sign(self, signer) plugins_path = join(self.path, 'PlugIns') if exists(plugins_path): # sign the appex executables # remove them for now shutil.rmtree(plugins_path) # appex_paths = glob.glob(join(plugins_path, '*.appex')) # for appex_path in appex_paths: # plist_path = join(appex_path, 'Info.plist') # if not exists(plist_path): # continue # plist = biplist.readPlist(plist_path) # appex_exec_path = join(appex_path, plist['CFBundleExecutable']) # appex = signable.Appex(self, appex_exec_path) # appex.sign(self, signer) # then create the seal # TODO maybe the app should know what its seal path should be... self.seal_path = code_resources.make_seal(self.get_executable_path(), self.path) # then sign the app executable = self.signable_class(self, self.get_executable_path()) executable.sign(self, signer) self.correct_executable_file_permission(self.get_executable_path())
def resign(self, deep, cms_signer, provisioner): """ Sign everything in this bundle, in place. If deep is specified, sign recursively with sub-bundles """ # log.debug("SIGNING: %s" % self.path) if deep: plugins_path = join(self.path, 'PlugIns') if exists(plugins_path): # sign the appex executables appex_paths = glob.glob(join(plugins_path, '*.appex')) for appex_path in appex_paths: log.debug('working on appex {}'.format(appex_path)) # Appexes are essentially the same as app bundles, for signing purposes # They could be a different class, but there aren't any differences yet noted. # They will have the same OS (e.g. iOS, Watch) as their parent appex = self.__class__(appex_path) appex.resign(deep, cms_signer, provisioner) frameworks_path = join(self.path, 'Frameworks') if exists(frameworks_path): # log.debug("SIGNING FRAMEWORKS: %s" % frameworks_path) # sign all the frameworks for framework_name in os.listdir(frameworks_path): framework_path = join(frameworks_path, framework_name) # log.debug("checking for framework: %s" % framework_path) try: framework = Framework(framework_path, self.native_platforms) # log.debug("resigning: %s" % framework_path) framework.resign(deep, cms_signer, provisioner) except NotMatched: # log.debug("not a framework: %s" % framework_path) continue # sign all the dylibs under Frameworks self.sign_dylibs(cms_signer, frameworks_path) # sign any dylibs in the main directory (rare, but it happens) self.sign_dylibs(cms_signer, self.path) # then create the seal # TODO maybe the app should know what its seal path should be... self.seal_path = code_resources.make_seal(self.get_executable_path(), self.path) # then sign the executable executable = self.signable_class(self, self.get_executable_path(), cms_signer) executable.sign(self, cms_signer) log.debug("Resigned bundle at <%s>", self.path)
def sign(self, signer): # first sign all the dylibs frameworks_path = join(self.path, 'Frameworks') if exists(frameworks_path): dylib_paths = glob.glob(join(frameworks_path, '*.dylib')) for dylib_path in dylib_paths: dylib = signable.Dylib(dylib_path) dylib.sign(self, signer) # then create the seal # TODO maybe the app should know what its seal path should be... self.seal_path = code_resources.make_seal(self.get_executable_path(), self.path) # then sign the app executable = signable.Executable(self.get_executable_path()) executable.sign(self, signer)
def sign(self, deep, signer): """ Sign everything in this bundle. If deep is specified, sign recursively with sub-bundles """ # log.debug("SIGNING: %s" % self.path) if deep: frameworks_path = join(self.path, 'Frameworks') if exists(frameworks_path): # log.debug("SIGNING FRAMEWORKS: %s" % frameworks_path) # sign all the frameworks for framework_name in os.listdir(frameworks_path): framework_path = join(frameworks_path, framework_name) # log.debug("checking for framework: %s" % framework_path) try: framework = Framework(framework_path) # log.debug("resigning: %s" % framework_path) framework.resign(deep, signer) except NotMatched: # log.debug("not a framework: %s" % framework_path) continue # sign all the dylibs under Frameworks self.sign_dylibs(signer, frameworks_path) # sign any dylibs in the main directory (rare, but it happens) self.sign_dylibs(signer, self.path) plugins_path = join(self.path, 'PlugIns') if exists(plugins_path): # sign the appex executables appex_paths = glob.glob(join(plugins_path, '*.appex')) for appex_path in appex_paths: plist_path = join(appex_path, 'Info.plist') if not exists(plist_path): continue plist = biplist.readPlist(plist_path) appex_exec_path = join(appex_path, plist['CFBundleExecutable']) appex = signable.Appex(self, appex_exec_path, signer) appex.sign(self, signer) # then create the seal # TODO maybe the app should know what its seal path should be... self.seal_path = code_resources.make_seal(self.get_executable_path(), self.path) # then sign the app executable = self.signable_class(self, self.get_executable_path(), signer) executable.sign(self, signer)