配置描述文件(.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配置描述文件签名前
    006tKfTcgy1fqfhp4xqraj30zg0ny75a.jpg

  • .mobileconfig配置描述文件签名后
    006tKfTcgy1fqfhppdrrzj310g0oidgw.jpg