Dylib Injection And Codesign Failed

I try to inject a .dylib to a ipa(a demo ipa) executable file by insert_dylib tool!

The step insert dylib info to LC_LOAD_DYLIB is OK.

But when exec the command :

/usr/bin/codesign -f -s “iPhone Developer: xxx (xxxxxxx)” Payload/Demo.app/

notice that error:

codesign_allocate: file not in an order that can be processed (link edit information does not fill the __LINKEDIT segment):
~/Path/to/Payload/Demo.app/Demo (for architecture armv7)
Payload/Demo.app/: the codesign_allocate helper tool cannot be found or used
failed

I try google search, but can’t solve.
A possible related search result here Recipe OSX Code Signing

Thanks very much!

IIRC, codesign works on executables rather than documents. Try

/usr/bin/codesign -f -s "iPhone Developer: xxx (xxxxxxx)" Payload/Demo.app/Demo

to see if it works :smile:

Thanks, But the command does’t works here! Notice the same errror info.

If I don’t modify the binary file, only re-codesign by

/usr/bin/codesign -f -s "iPhone Developer: xxx (xxxxxxx)" Payload/Demo.app/

that can works good!

I guess, insert_dylib tool only insert the LC_LOAD_DYLIB, and other info need update together if modify the LC_COMMAND

Try ldid instead by referring to this post

The author updated the tools, and solve the problem!

重签名也出现 the codesign_allocate helper tool cannot be found or used 错误 XCode7.3 系统OSX Capitan 10.11.4 。。

重签名也出现 the codesign_allocate helper tool cannot be found or used 错误 XCode7.3 系统OSX Capitan 10.11.4 。。

解决了吗这个问题