How to add codesigning to dmg file in mac

↘锁芯ラ 提交于 2019-12-18 10:50:09

问题


I have a dmg file in my portal.After downloading it,when i try to open it is showing a message indicating that opening package is insecure. i am able to add codesign through command line using codesign command and also able to check whether it is added or not. but still when i click to open my dmg file insecure message is coming


回答1:


As of macOS 10.11.5 you can now sign disk images, .dmg, files using the codesign tool:

codesign -s <identity> --keychain <full-path-to-keychain> <path-to-disk-image>



回答2:


There's 3 ways to do this. In the terminal on OS X 10.11.5 or newer. Note: you can code sign DMGs on earlier OS versions, however Sierra only likes them from 10.11.5 or newer.

codesign --force --sign "Developer ID Application: <identityIdentifier>" <pathToDMG>

Verification is done via (requires macOS Sierra).

spctl -a -t open --context context:primary-signature -v <pathToDMG>

Araelium have updated DMG Canvas (v2.3), so it will code sign DMGs when it builds.

DropDMG has been updated to code sign DMG image files too (v3.4).

There's also (a tool I developed) called App Wrapper (3.6), which can code sign DMG files.




回答3:


Earlier I struggle to code sign dmg on 10.11.5 even this command codesign -s <identity> <path-to-disk-image> is known to me.

What I am doing earlier is

  1. Create the Read/Write DMG (created using Disk utility)
  2. Copy App and other external resources
  3. Code signed DMG using codesign command
  4. Convert it to Read only DMG using Disk Utility
  5. Verify it using spctl -a -t open --context context:primary-signature <path-to-disk-image>, which results in rejection.

Then few permutation and combination, I found it pretty easy straight forward solution:

  1. Create the Read/Write DMG (created using Disk utility).
  2. Copy App and other external resources
  3. Convert it to Read only DMG using Disk Utility
  4. Code signed DMG using codesign command (This time I did it on Sierra, most probably should work with 10.11.5)
  5. Verify it using spctl -a -t open --context context:primary-signature <path-to-disk-image>, that results in success.

I hope this works for you. :)



来源:https://stackoverflow.com/questions/23824815/how-to-add-codesigning-to-dmg-file-in-mac

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!