美文网首页
签名公证

签名公证

作者: nickNameDC | 来源:发表于2021-09-03 15:33 被阅读0次

app重签名

1.查看包信息

codesign -d -vvv demo.app
查询结果如下

Executable=/Users/xxxxxxx/Desktopxxxxxxxxxxxxxxxx/airhost
Identifier=us.zoom.airhost
Format=app bundle with Mach-O universal (x86_64 arm64)
CodeDirectory v=20500 size=65627 flags=0x10000(runtime) hashes=2042+5 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha1=f4aaeaacbdb374cd6bad1d295fac898865a4373c
CandidateCDHashFull sha1=f4aaeaacbdb374cd6bad1d295fac898865a4373c
CandidateCDHash sha256=657a8011195e64a3d619bf3f39dc013da6006c5d
CandidateCDHashFull sha256=657a8011195e64a3d619bf3f39dc013da6006c5deb4df20043de8355a4a628c1
Hash choices=sha1,sha256
CMSDigest=5c8ae9046f896efae0bb766bd5a051a754d7b73d8e5060aff1b95ec74eb317dc
CMSDigestType=2
CDHash=657a8011195e64a3d619bf3f39dc013da6006c5d
Signature size=9081
Authority=Developer ID Application: xxxx Communications, Inc. (xxxxxxxx)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=Mar 31, 2021 at 10:17:08 AM
Info.plist entries=24
TeamIdentifier=BJ4HAAB9B3
Runtime Version=10.14.0
Sealed Resources version=2 rules=13 files=19
Internal requirements count=1 size=176

重点看其中几点

Authority=Developer ID Application: xxx Communications, Inc. (xxxxxxx)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=Mar 31, 2021 at 10:17:08 AM
Info.plist entries=24
TeamIdentifier=xxxxx

2.查看包中的 entitlement

codesign -d —-entitlements - demo.app

3.签名

codesign --force --entitlements caphost.entitlements --options runtime --sign "Developer ID Application: xxxxx Co., Ltd. (xxxxxx)" ZoomSDK/caphost.app

--force 本身已经签名,这里强制重签名;
--options runtime 因为要公证,所以也需要把app设置成强制运行时,这里注意,设置强制运行时会使之前的获取权限设置清空,所以需要用entitlements来设置;
--entitlements 因为app可能会用到某些权限,这里需要根据第二步获取到的entitlement创建文件;
--sign 签名,后面写签名证书的名字;

如果app内部包含framework,需要对framework的dylib文件也进行签名;

app公证-使用Xcode公证

1、使用 Developer ID 签名你的应用

关于证书,可参考:https://blog.csdn.net/lovechris00/article/details/84848734

2、Enable hardened runtime

The hardened runtime :强化版运行时
设置需要以下条件:macOS 10.13.6 及以上, Xcode 10 及以上;
测试则必须在 10.14 及以上版本。


工程 – target – Capabilities – Hardened Runtime
勾选需要的Access 后,access 将会声称在 entitlements 中。


20191007153755243.png

3、entitlement 添加 com.apple.security.get-task-allow

entitlement.plist 中添加 com.apple.security.get-task-allow 这个键,设置为 YES

注意:这里选择了强化版运行时,获取权限会发生变化,需要在下面把权限勾上,不然获取权限的时候会崩溃;

4、Archive

Distribute App —> Developper ID —> Upload —> Review —> Loading;

20191007153955524.png
20191007154017309.png
20191007154044314.png
2019100715405427.png
20191007163822258.png

公证成功

上面的页面不要关闭,公证成功后会给xcode发通知。一般几分钟就可以;

点击export可以导出公证成功的app文件;

打包pkg和签名

1.打包pkg

2.获取 installer 证书名字

终端输入
security find-identity -v

可以得到如下类型的数据:

  1) 1236AFAC91EB45EC745037C6720F851C67E "Mac Developer: ss (612SD557MK)"
  2) BCDBBCDB4BB8A048092FFFB813C45571273EC2AA "iPhone Developer: ss (3213CE4L5)"
  3) 12345BDC1845B3E8E9E8EFEE61221BEBDAA75E "Mac Developer: ss (3U6SDA6DL5)"
 4) FBFSDF8FE507B8D9FDA6FDSDADA786A3 "Developer ID Installer: ss (DSA34QV93)"

找到带 installer 的那条数据,并将双引号及内容一起复制

3.签名

脚本

#先cd到 pkg文件的同一目录下;

#pkg签名
productsign --sign "Developer ID Installer: xxx Co., Ltd. (xxx)" xxx.pkg xxxsigned.pkg
#xxxsigned.pkg为签名后的pkg文件,要拿这个文件去公证,而不是你原来的pkg

#公证
xcrun altool --notarize-app --primary-bundle-id "com.xxxx.xxxx" --username "xxx@xxxxx" --password "xxxx-xxxx-xxxx-xxxx" --file  xxxsigned.pkg
#password 要从apple官网中获取,文章底部有链接

#查看公证
xcrun altool --notarization-info 54b88d61-4858-48e4-a9be-7b272577abf3 --username "xxx@xxxx" --password "xxxx-xxxx-xxxx-xxxx" 
#54b88d61-4858-48e4-a9be-7b272577abf3 这个是请求id,上一条指令成功后,会在控制台打印出来,然后替换;

#给包订上公证票据
xcrun stapler staple -v xxxsigned.pkg

#验证pkg
spctl -a -v --type install ./xxxsigned.pkg

#结果
#公证后的
/xxx/abc.pkg: accepted
source=Notarized Developer ID
 
#没公证的
/xxx/abc.pkg: rejected
source=Unnotarized Developer ID

密码获取:管理您的 Apple ID
参考 macOS 开发 - Notarization 公证你的 Developer ID 应用_伊织的笔记本-CSDN博客

相关文章

  • 签名公证

    app重签名 1.查看包信息 codesign -d -vvv demo.app查询结果如下 重点看其中几点 2....

  • MacOS端签名公证

    MacOS端的签名不能使用个人开发者账号。苹果端给的邮件回复Re: Develop ID Certificate ...

  • Mac应用签名+公证

    1.创建mac应用发布证书(账号持有人) 证书添加到钥匙串以后,xcode-preferences-account...

  • 遗嘱写作

    写遗嘱有如下要求: 1、公证遗嘱由遗嘱人经公证机关办理。自书遗嘱由遗嘱人亲笔书写,签名,注明年、月、日。 2、代书...

  • Mac 上electron-notarize 进行签名与公证

    有一篇文章写的很详细,参考:《electron-notarize 进行签名与公证的详细步骤》https://mp....

  • 真正的离开是没有告别的

    第一次觉得自己的名字很有价值的时候,是爸爸去世之后在遗产公证声明上的那一个又一个亲笔签名,走出公证处时,看着...

  • 在办理留学马来西亚手续时,有哪些个人文件需要公证?

    需要办理公证的个人文件有: 学历公证 成绩公证 出身公证 无犯罪记录公证 以上公证文件可以在学生所在地的公证机关办...

  • 【公证】“这样婶儿”的公证请给我来一打

    今日关键词:【公证】 今天,宝宝第一次去公证处玩耍,才知道原来公证处不仅可以做合同公证、遗嘱公证、房产公证,还能一...

  • 留学需要哪些资料翻译

    留学需要哪些资料 出生公证、无犯罪记录证明公证(18岁以下是监护人公证)、成绩单和在读证明公证、最高学历公证。这些...

  • 公证当事人有什么权利和义务?

    公证当事人是指以自己的名义向公证处提出公证申请,并与所申办的公证事项有直接利害关系,在公证活动中享受权利、承担...

网友评论

      本文标题:签名公证

      本文链接:https://www.haomeiwen.com/subject/cbjkwltx.html