kabiroberai / theos-jailed

A Theos module to develop jailed tweaks for iOS 8 and up
Other
362 stars 65 forks source link

Trouble with codesigning #44

Closed steelzeh closed 6 years ago

steelzeh commented 6 years ago

I'm having some difficulties when i need to sign the iPA. When i run it with profile in makefile i get "Could not find profile"

I tried creating a new XCode Project like it said in make info, ran the app, deleted it and ran "make package install" and it throws "Could not find profile"

So i went to developer.apple to create a profile manually, created both Development and Distribution provisioning profiles with my certificates, and that doesn't work.

If i remove profile= from makefile and just run "make package install" then it installs fine on my phone since i am enrolled, but when i try to run it via Impactor i get invalid entitlements, not codesigned.

Any ideas? Thanks.

steelzeh commented 6 years ago

I also just tried creating a new apple id, and redid what make info said. Still doesn't work. tried using DEV_CERT_NAME but all i get is "Failed to get codesign name"

Please tell me what i'm doing wrong? Thanks.

kabiroberai commented 6 years ago

What does your Makefile look like? (With the PROFILE= line)

steelzeh commented 6 years ago

MODULES = jailed include ~/Documents/theos/makefiles/common.mk

PROFILE = ID-6E212F1F.de.j-gessner.protube2

TWEAK_NAME = ProTube DISPLAY_NAME = ProTube BUNDLE_ID = de.j-gessner.protube2

ProTube_FRAMEWORKS = UIKit ProTube_FILES = Tweak.xm ProTube_IPA = /Users/Thomas/Dropbox/Udvikling/Tweaks/ProTube/ProTube.ipa

include $(THEOS_MAKE_PATH)/tweak.mk

steelzeh commented 6 years ago

i also tried make package install PROFILE=ID-6E212F1F.de.j-gessner.protube2 But same thing happens, adding it to the makefile was just easier.

kabiroberai commented 6 years ago

What's the output when you run security find-certificate -c "iPhone Developer" login.keychain | grep alis | cut -f4 -d\" | cut -f1 -d\"?

steelzeh commented 6 years ago

iPhone Developer: My name (W82C6*****)

kabiroberai commented 6 years ago

Is that the same account that you used when creating the Xcode project?

steelzeh commented 6 years ago

Yes i only have the one which is enrolled in their program, that's the one i use for all my other iOS legit apps.

kabiroberai commented 6 years ago

It’s quite strange that it doesn’t work. Add the following lines of code below https://github.com/kabiroberai/theos-jailed/blob/master/module/bin/ipa.sh#L90 in the location where you cloned Theos Jailed, run ./install again, and tell me the output of make do DEV_CERT_NAME="iPhone Developer" (be sure to remove any personal details)

log 1 "Dev Cert Name: $DEV_CERT_NAME"
log 1 "Codesign Name: $codesign_name"
steelzeh commented 6 years ago

I put the two lines in after line 93, when the codesign_name is assigned, but it doesn't get there because the if statement that looks for profile breaks it. So i put them at the top also, so you could see something be printer out.

https://i.imgur.com/26e81kX.png

kabiroberai commented 6 years ago

What’s the result of running grep -F "<string>iOS Team Provisioning Profile:" ~/Library/MobileDevice/Provisioning\ Profiles/*?

steelzeh commented 6 years ago

Binary file /Users/Thomas/Library/MobileDevice/Provisioning Profiles/80b71dbe-ad81-4925-aba0-f79f0f370229.mobileprovision matches Binary file /Users/Thomas/Library/MobileDevice/Provisioning Profiles/aeb3bebc-d556-4aab-8124-10564deb0fc0.mobileprovision matches

kabiroberai commented 6 years ago

Try grep -Fa "<string>iOS Team Provisioning Profile:" ~/Library/MobileDevice/Provisioning\ Profiles/*

steelzeh commented 6 years ago

/Users/Thomas/Library/MobileDevice/Provisioning Profiles/80b71dbe-ad81-4925-aba0-f79f0f370229.mobileprovision: iOS Team Provisioning Profile: dk.mylegit.apphiddenhere /Users/Thomas/Library/MobileDevice/Provisioning Profiles/aeb3bebc-d556-4aab-8124-10564deb0fc0.mobileprovision: iOS Team Provisioning Profile: *

Hmm don't see the one xcode should have generated, but weirdly if i download the provisioning profile from developer.apple and install it, it doesn't show up also.

kabiroberai commented 6 years ago

Oh, it’s because Xcode doesn’t think it needs to generate a profile since you already have a wildcard one. You can force it to generate a profile by turning on a capability that requires an entitlement (like app groups), and then turning it off again

steelzeh commented 6 years ago

Oh okay, that's why. So now it can find the profile, but it still says that it was signed with invalid entitlements.

http://i.imgur.com/4ogN8ay.jpg

kabiroberai commented 6 years ago

Could you try installing the ipa through Xcode? It might give you a more descriptive error message

steelzeh commented 6 years ago

Dont know if this will help you 👍 https://imgur.com/a/kPSd1

kabiroberai commented 6 years ago

Try codesign -d --entitlements - .theos/Payload/*.app

steelzeh commented 6 years ago

Do you want me to extract the iPA that i'm using to attach the tweak to or the iPA that theos generates, and then run codesign command on the payload?

kabiroberai commented 6 years ago

Run that exact command after cding into your project’s directory. .theos is a hidden folder created in each project.

kabiroberai commented 6 years ago

It’ll output the entitlements that the app requires, so just paste them here.

steelzeh commented 6 years ago

Hmm no such file or directory. Did ls -lah and looks like the folder is there.

https://imgur.com/a/2Gjy5

steelzeh commented 6 years ago

nvm found it under _/

kabiroberai commented 6 years ago

Whoops, forgot that it was in _ 😛

steelzeh commented 6 years ago

https://imgur.com/a/GSg5R

kabiroberai commented 6 years ago

That link gives me an “Oops! We couldn't find that page” error

steelzeh commented 6 years ago

Yeah sorry, updated link :)

kabiroberai commented 6 years ago

What’s the result of the same codesign command when you run it with the original ipa file?

steelzeh commented 6 years ago

Looks like this: https://imgur.com/a/7P1ZS

steelzeh commented 6 years ago

Got it to work, thank you for your patience and help!

steelzeh commented 6 years ago

Hmm no, only worked with my (Enrolled) account that signed the ipa, when i try to impact it with impactor and using a different account, one that is not enrolled. I still get invalid entitlements, do you know why this happens? :(

https://imgur.com/a/ue1aP

steelzeh commented 6 years ago

Any news on this?

kabiroberai commented 6 years ago

Hey, I have exams until tomorrow, so I’ll get back to this once they’re over.

kabiroberai commented 6 years ago

What happens when you install an un-tweaked ProTube.ipa via Impactor?

steelzeh commented 6 years ago

Thank you for answering, hope your exams went well.

The ipa i'm using works fine when i impact it without tweaking.

steelzeh commented 6 years ago

Any news on this? :)

kabiroberai commented 6 years ago

Sorry, I didn't see your previous comment. Could you try packaging with CODESIGN_IPA=0? You won't be able to install directly from Theos Jailed with that, but it may get Impactor to work.

kabiroberai commented 6 years ago

Closing due to inactivity

hadoiz commented 6 years ago

iam facing the same problem iam getting error after make package

installation.cpp:42 Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.sFbr8h/extracted/Payload/cutecut.app/Frameworks/CydiaSubstrate.framework : 0xe8008016 (The executable was signed with invalid entitlements.)

when i download it from my mobile it work but from another phone i got this massage !!?!?

kabiroberai commented 6 years ago

What do you mean by “download it from my mobile”?

hadoiz commented 6 years ago

i mean cydia impactor when i download it to another phones i got this massage please help

hadoiz commented 6 years ago

i guess the problem in entitlement i don't know how to fix this

kabiroberai commented 6 years ago

Are you using the latest version of Theos Jailed? Try packaging your Cydia Impactor builds with CODESIGN_IPA=0

hadoiz commented 6 years ago

you mean to add CODESIGN_IPA=0 on make file?

kabiroberai commented 6 years ago

You can do it that way or you can use make package CODESIGN_IPA=0

hadoiz commented 6 years ago

i love you man !!

hadoiz commented 6 years ago

and if i want to put it inside plist in website to direct download without cydia impactor will it work or i need to sign it ?

kabiroberai commented 6 years ago

You have to sign it for that. Ensure that your provisioning profile contains the target device’s UDID.

hadoiz commented 6 years ago

but tutuapp when you download the app they don't ask for udid?