nwjs mac app签名

如上图所示,没有经过签名的APP打开的时候会有不信任的提示,非常影响用户第一印象和使用

下面是一个小白走过的路,仅供参考。

google搜索nwjs mac sign, 推荐下面这两篇文章
https://github.com/nwjs/nw.js/wiki/Mac-App-Store-(MAS)-Submission-Guideline
https://github.com/nwjs/nw.js/issues/616

按照链接1的教程开始捣腾起来,需要注意的是证书类型

  1. Mac App Store(签名,提交到App Store)

  2. Developer ID (签名,不用提交到App Store)

坑:最开始ios同事给我的apple开发者账号创建证书的时候没有Developer ID这个类型,便使用Mac App Store类型的证书,发现签名成功了,很开心,以为搞定了,但打开还是不受信任

codesign -vvv -d WorkPlus.appspctl -a -v WorkPlus.app

codesign命令查看app是签名成功了,spctl命令显示WorkPlus.app: rejected

怎么办?

这时候想到了友商钉钉,执行codesign -vvv -d 钉钉.app 发现Authority的值是Developer ID的证书,于是换Developer ID证书

  1. 只有花99美刀的开发者账号才有创建Developer ID证书的选项

签名脚本(参考上面第二个链接)

export app=/Users/xxx/Downloads/nwjs-v0.12.3-osx-x64/sign/WorkPlus.appexport identity=1FD05730FA3DD1C66BEA507EE76B425FB20CC3B1codesign --force --verify --verbose --sign $identity $app"/Contents/Frameworks/crash_inspector"codesign --force --verify --verbose --sign $identity $app"/Contents/Frameworks/nwjs Framework.framework/"codesign --force --verify --verbose --sign $identity $app"/Contents/Frameworks/nwjs Helper EH.app/"codesign --force --verify --verbose --sign $identity $app"/Contents/Frameworks/nwjs Helper NP.app/"codesign --force --verify --verbose --sign $identity $app"/Contents/Frameworks/nwjs Helper.app/"echo "### signing app"codesign --force --verify --verbose --sign $identity $appecho "### verifying signature"codesign -vvv -d $app

identity怎么获取?

Save the string in parenthesis (beginning with LK7 on the capture).
When signing the app, we will refer to it as the identity.

这个nwjs教程上描述的,意思是说取证书名最后花括号内的值作为identity,我试过是不行的,不知道是我做错了还是文档有误?

有些教程说identity=证书名,也是不对的

google一下: codesign no identity found

http://stackoverflow.com/questions/16036571/codesign-gives-always-no-identity-found-error-via-terminal
http://stackoverflow.com/questions/14274180/questions-about-code-signing-mac-app-with-developer-id

关键命令

sudo security add-trusted-cert -d -r trustRoot -p codeSign -k /Library/Keychains/System.keychain ~/Desktop/gdb-cert.cersecurity find-identity -p codesigning

通过第二个命令可以查看到证书的identity,正常情况下已经签名成功了。

坑:上面都弄完了还找不到identity,此时已经弄了一天了,还没搞定,要崩溃了。

耐心!

First, go into Keychain Access and verify that your DeveloperID certificate has an accompanying private key associated with it (this will be visible under a disclosure triangle). If it does not, then you should go check around to see if you saved off the key related to that certificate anywhere, because if you can't find and reimport it (from, for example, a Developer Profile exported from Xcode), you will need to revoke and reissue the certificate, since there's no way to sign it.

我发现我钥匙串里的Developer ID证书左侧没有可展开的三角形,这就是问题所在了,其他证书左侧都有可展开的三角形,原因是我创建certSigningRequest文件的时候的账号不是开发者账号,默认拿了我apple store的账号,够悲剧的。

遇到那么多问题,本质上还是对mac整个证书体系不熟悉。资料上也没有一篇小白的教程,一路艰辛,希望可以帮助到和我一样的小白。

关键字:codesign, nwjs

本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击下方“内容举报”进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部