iOS mobileconfig配置文件進行簽名的配置方法

配置描述文件(.mobileconfig) 是XML文件,包含設備安全策略、VPN配置信息、Wi-Fi設置、APN設置、Exchange帳戶設置、郵件設置以及允許iPhone和iPod touch與企業系統配合使用的證書。本文描述了蘋果開發者如何使用SSL證書對. mobileconfig進行簽名,從而確保iOS系統上的app安全性。

前提條件

確保已經獲取SSL數字證書。有關獲取數字證書方法,可參閱如何獲取數字證書。

本文使用的SSL證書文件名爲mbaike.crt。

與SSL證書對應的私鑰。本文使用的私鑰文件名爲mbaike.key。

與SSL證書對應的證書鏈(中級證書)。本文使用的證書鏈文件名爲ca.-bundle.pem。

iOS端生成的未簽名的需要簽名的.mobleconfig文件。 本文使用的文件名爲unsigned.mobileconfig。

OpenSSL 1.0及以上版本。

如何簽名

生成已簽名配置文件

在linux操作系統上,通過運行OpenSSL命令行,生成簽名後的signed.mobileconfig文件。

[root@VM_0_4_centos home]#openssl smime -sign -in unsigned.mobileconfig -out signed.mobileconfig -signer mbaike.crt -inkey mbaike.key -certfile ca-bundle.pem -outform der -nodetach

輸入私鑰密碼

將證書私鑰key文件的密碼寫入到生成的key文件中

[root@VM_0_4_centos home]#openssl rsa -in mbaike.key -out mbaikenopass.key

寫入簽名

[root@VM_0_4_centos home]#openssl smime -sign -in unsigned.mobileconfig -out signed.mobileconfig -signer mbaike.crt -inkey mbaikenopass.key -certfile ca-bundle.pem -outform der -nodetach

簽名效果

.mobileconfig配置描述文件簽名前

.mobileconfig配置描述文件簽名後

發佈了6 篇原創文章 · 獲贊 4 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章