重签名

  1. 查看可用证书security find-identity -v -p codesigning
localhost:~ zhangheng$ security find-identity -v -p codesigning
  1) 15BD477C29A3E624XXXXXXXXXXXXXXXXXXX "iPhone Developer: 恒 张 (Q262893UMK)"
     1 valid identities found
  1. 从embedded.mobileprovision文件里提取entitlements权限文件
#在embedded.mobileprovision文件目录
localhost:Desktop zhangheng$ security cms -D -i embedded.mobileprovision > temp.plist
localhost:Desktop zhangheng$ /usr/libexec/Plistbuddy -x -c'Print:Entitlements' temp.plist > entitlements.plist
localhost:Desktop zhangheng$ 

3.对app进行签名

codesign -fs 15BD477C29A3E624XXXXXXXXXXXXXXXXXXX --entitlements entitlements.plist jiuwen-lawyer

  1. 对动态库进行签名codesign -fs 15BD477C29A3E624XXXXXXXXXXXXXXXXXXX xxx.dylib
localhost:jiuwen-lawyer.app zhangheng$ security find-identity -v -p codesigning
  1) 15BD477C29A3E624XXXXXXXXXXXXXXXXXXX "Apple Development: 恒 张 (Q262893UMK)"
  2) 15BD477C29A3E624XXXXXXXXXXXXXXXXXXX "iPhone Developer: 恒 张 (Q262893UMK)"
     2 valid identities found
localhost:jiuwen-lawyer.app zhangheng$ codesign -fs 15BD477C29A3E624XXXXXXXXXXXXXXXXXXX CydiaSubstrate 
CydiaSubstrate: replacing existing signature
localhost:jiuwen-lawyer.app zhangheng$ codesign -fs 15BD477C29A3E624XXXXXXXXXXXXXXXXXXX tweakjiuwen.dylib 
tweakjiuwen.dylib: replacing existing signature
localhost:jiuwen-lawyer.app zhangheng$ 
  1. insert_dylib
  1. 下载链接https://github.com/Tyilo/insert_dylib
  2. 生成执行文件copy到/usr/local/bin目录下
  3. 更改动态库的加载路径install_name_tool -change 旧地址 新地址 Mach-O文件
  4. 常用的环境变量
    3.1 @executable_path代表执行文件所在的目录
    3.2 @loader_path代表动态库所在的目录
localhost:就问 zhangheng$ cd jiuwen-lawyer.app/
localhost:jiuwen-lawyer.app zhangheng$ insert_dylib @executable_path/tweakjiuwen.dylib jiuwen-lawyer --all-yes --weak jiuwen-lawyer 
jiuwen-lawyer already exists. Overwrite it? [y/n] y
LC_CODE_SIGNATURE load command found. Remove it? [y/n] y
Added LC_LOAD_WEAK_DYLIB to jiuwen-lawyer
localhost:jiuwen-lawyer.app zhangheng$ install_name_tool -change /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate @loader_path/CydiaSubstrate tweakjiuwen.dylib 
localhost:jiuwen-lawyer.app zhangheng$ 

你可能感兴趣的:(重签名)