Codesign
可用签名证书查询
security find-identity -v -p codesigning
签名
codesign -s 'Name of the certificate’ /path/Example.app
重新签名
codesign -f -s 'Name of the certificate' /path/Example.app
应用签名信息
codesign -vv -d Example.app
应用签名认证
codesign --verify Example.app
没有任何输出代表签名是完好的
应用可用验证
spctl -a -v Example.app
Notarization
- Apple 新认证方式
- Bundle ID 应用bundle ID
- Username Apple ID
- Password Apple ID 密码 是一个一次性的密码
- FilePath 要认证的包 一般是dmg 或者 zip .app 的不行
- Team ID 开发者账号所在的 Team ID 登录到开发者账号 资料里面查看
校验
xcrun altool --notarize-app --primary-bundle-id “Bundle ID" --username “Username" --password “Password" --file FilePath -itc_provider "Team ID"
上面的执行完成后会生成 RequestUUID
使用下面的方法查看即可
查询 邮件中 ID
xcrun altool --notarization-info RequestUUID -u “Username --password “Password"
查到认证通过后
需要重新签名一下安装包
重新签一下
xcrun stapler staple “FilePath"
stapler validate
will do this -
1 | $ stapler validate myfile.pkg |
- If
The validate action worked!
is printed, the specified pkg file is notarized. - If
does not have a ticket stapled to it.
is printed, the specified pkg file is either not notarized, or the notarization was never followed up with the stapling step.
检查公证结果脚本
NotarizationScript.sh
1 | # 公证的 bundle id |
保存文件 直接调用传入本地包路径即可
sh NotarizationScript.sh filepath
参考
- https://www.logcg.com/archives/3222.html
- https://antscript.com/post/2019-10-08-notarizing-mac-app/
- https://blog.csdn.net/lovechris00/article/details/102309757
- https://developer.apple.com/documentation/xcode/notarizing_your_app_before_distribution?language=objc
- https://help.apple.com/xcode/mac/current/#/dev88332a81e
- https://help.apple.com/xcode/mac/current/#/dev033e997ca
- https://developer.apple.com/developer-id/
- https://blog.csdn.net/shengpeng3344/article/details/103369804
- https://scriptingosx.com/2019/09/notarize-a-command-line-tool/
- https://github.com/CaicaiNo/Apple-Mac-Notarized-script/blob/master/Apple-Mac-Notarized-script.sh
- https://blog.csdn.net/ftpleopard/article/details/102721138