Mac應(yīng)用簽名+公證

1.創(chuàng)建mac應(yīng)用發(fā)布證書(賬號持有人)

證書添加到鑰匙串以后,xcode-preferences-account中查看appid賬密中是否包含mac應(yīng)用證書


image.png

2.根據(jù)證書生成密鑰到本地

image.png
image.png

3. 設(shè)置全局變量

sudo vim ~/.bash_profile
export CSC_LINK=/Users/.../cat.p12  // 那會密鑰保存的位置
export CSC_KEY_PASSWORD=xxxx  // 那會設(shè)置的密鑰密碼
source ~/.bash_profile
env
 // 輸入本地所有環(huán)境變量,看到有CSC_LINK和CSC_KEY_PASSWORD就設(shè)置成功

4.腳本簽名

//本簽名
codesign  -fs "Developer ID Application: xxx xxx (767xxxxxxx)" --options=runtime --timestamp  -v --deep 路徑絕對相對均可.dmg
//查看簽名
 spctl --verbose=4 --assess --type execute /Users/xxx.dmg
//公證(30分鐘+):
xcrun altool --notarize-app --primary-bundle-id xxx --username xxx@sinochem.com --password xxxx --asc-provider 767xxx -t osx --file 路徑絕對相對均可.dmg
/**--primary-bundle-id  APPID
--username  開發(fā)者賬號
--password  應(yīng)用專用密碼(登錄appleid.apple.com,創(chuàng)建一個應(yīng)用專用密碼)
asc-provider 證書提供者(1.鑰匙串中證書-顯示簡介-全名中括號內(nèi)的767xxxxxxx,一般組織單位名 如 Developer ID Application: xxx xxx (767xxxxxxx)   2.取ProviderShortname命令:xcrun altool --list-providers -u "apple id" -p "app password")
-t 系統(tǒng) osx
--file 待公證的文件路徑 **/
//查看公證記錄
xcrun altool --notarization-history 0 --username "apple id" --password "app password"
// 查看公證結(jié)果根據(jù)公證返回的RequestUUID
xcrun altool --notarization-info "RequestUUID" --username "apple id" --password "app password"
image.png
image.png
image.png

設(shè)置后,代碼打出包就是正??捎玫模ú粫棾觥安恍湃巍?、“風(fēng)險”,“無法打開”,“移到廢紙簍”的提示)。驗證的話可根據(jù)下面腳本
參考:https://blog.csdn.net/luoshabugui/article/details/109295413
http://www.itdecent.cn/p/0d89a18308b2

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容