本文主要講,使用蘋果開發者證書進行簽名達到目的,本文兩種方法,一種是刀耕火種的一步步操作,一種使用腳本簽名
一.導出蘋果證書進行簽名
1.從鑰匙串(keychain)中導出證書
實用工具->鑰匙串訪問->選擇要導出的證書,導出生成p12文件 InnovCertificates.p12
然后轉換成 InnovCertificates.pem 文件
2. p12換成pem格式方法
p12在線轉換pem https://www.sslshopper.com/ssl-converter.html
(證書)cer.p12文件 轉cer.pem文件
openssl pkcs12 -clcerts -nokeys -out cer.pem -in cer.p12
(私鑰)key.p12文件轉key.pem文件
openssl pkcs12 -nocerts -out key.pem -inkey.p12
3.下載 Apple Root Certificate 和 Apple Intermediate Certificate
(對於本篇文章 .mobileconfig文件的驗證我使用了蘋果的以下兩個證書.
Apple Root Certificate(蘋果根證書)
Apple Application Integration Certificate (蘋果應用集成證書 )
你也可以使用這些證書或者蘋果提供的其他證書 地址: http://www.apple.com/certificateauthority/
下載的文件中包括證書(cer)和私鑰(key)
(在命令行中讀取證書,參考鏈接 info.ssl.com/article.aspx?id=12149)
根據這個文件我們可以解壓出來證書.
2. p12換成pem格式方法
p12在線轉換pem https://www.sslshopper.com/ssl-converter.html
(證書)cer.p12文件 轉cer.pem文件
openssl pkcs12 -clcerts -nokeys -out cer.pem -in cer.p12
(私鑰)key.p12文件轉key.pem文件
openssl pkcs12 -nocerts -out key.pem -inkey.p12
3.下載 Apple Root Certificate 和 Apple Intermediate Certificate
(對於本篇文章 .mobileconfig文件的驗證我使用了蘋果的以下兩個證書.
Apple Root Certificate(蘋果根證書)
Apple Application Integration Certificate (蘋果應用集成證書 )
你也可以使用這些證書或者蘋果提供的其他證書 地址: http://www.apple.com/certificateauthority/
下載的文件中包括證書(cer)和私鑰(key)
(在命令行中讀取證書,參考鏈接 info.ssl.com/article.aspx?id=12149)
根據這個文件我們可以解壓出來證書.
上邊所有文件准備號后,運行命令行工具,運行以下命令
二.腳本簽名
借助於強大的github,找到了一個python腳本進行簽名
地址:https://github.com/nmcspadden/ProfileSigner
1.簽名一個mobileconfig
profile_signer.py與 mobileconfig 放在同一目錄,終端進入目錄執行
"3rd Party Mac Developer Application"為你的證書在鑰匙串中的全名,選擇證書=>顯示簡介=>復制常用名稱加上引號即可,比如
"iPhone Developer: jakey.shao xxxx@xxx.com"
"iPhone Distribution: Skyfox Network Technology Co., Ltd."

如果能正確讀取到證書,會提示如上圖所示,點擊允許即可!
