nwjs mac app签名

clipboard.png
如上图所示,没有经过签名的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的教程开始捣腾起来,需要注意的是证书类型

  • Mac App Store(签名,提交到App Store)

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

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

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

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

怎么办?

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

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

签名脚本(参考上面第二个链接)
export app=/Users/xxx/Downloads/nwjs-v0.12.3-osx-x64/sign/WorkPlus.app
export identity=1FD05730FA3DD1C66BEA507EE76B425FB20CC3B1

codesign --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 $app

echo "### 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.cer

security 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整个证书体系不熟悉。资料上也没有一篇小白的教程,一路艰辛,希望可以帮助到和我一样的小白。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值