美文网首页iOS开发记录iOS学习开发
iOS开发 - 超级签名实现之描述文件

iOS开发 - 超级签名实现之描述文件

作者: iOS开发面试题总结 | 来源:发表于2019-12-12 15:36 被阅读0次

简介

因为最近企业签掉得太严重了,上头要求实现超级签进行游戏下载。故有了此文章,记录一下过程。

签名原理其实很简单,超级签名的技术就是使用个人开发者账号,将用户的设备当作开发设备进行应用分发。这也导致成本非常高,一个开发者账号最多只能注册一百台设备,然而一个账号的价格为99美元。不过目前超级签分发的应用稳定性很高,不用再像企业签那样经常掉签。

推荐一个iOS技术交流群,iOS技术职业交流覆盖 2800+技术牛人,
直接搜索或点击群号:638302184,快速进群,
进群与2800+iOS开发者一起学习成长,期待您的加入!

群内提供数据结构与算法、音视频、底层进阶、flutter、swift、逆向等免费资料
以及收集的各大厂面试题(附答案) ! 群文件直接获取

新建 .mobileconfig 描述文件

该描述文件用于获取用户设备的UDID,用户通过某个点击操作下载此文件,安装后服务器会收到该用户设备的 UDID 回调事件。

<pre class="prettyprint hljs xml" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; word-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<dict>
<key>URL</key>
<string>https://[你的服务器地址].com/resource/uploadUUID.do</string>
<key>DeviceAttributes</key>
<array>
<string>UDID</string>
<string>IMEI</string>
<string>ICCID</string>
<string>VERSION</string>
<string>PRODUCT</string>
</array>
</dict>
<key>PayloadOrganization</key>
<string>xxx.xxx.com</string>
<key>PayloadDisplayName</key>
<string>查询设备UDID</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>PayloadUUID</key>
<string>c156f2f8-fc42-4260-8fc5-8644861d8293</string>
<key>PayloadIdentifier</key>
<string>xxx.xxx.profile-service</string>
<key>PayloadDescription</key>
<string>本文件仅用来获取设备ID</string>
<key>PayloadType</key>
<string>Profile Service</string>
</dict>
</plist></pre>

注册开发者设备及签名包体

由于时间太赶,这里注册开发者设备及签名包体采用的都是三方提供的服务,因此没有细节提供,但是怎样去做还是可以说一下的。

我们可以借助 Spaceship 工具完成注册新的开发者设备和更新 Provisioning Profile ,签名包体可以用 Sigh 框架,具体实现请自行搜索。

最后用户下载的方式与企业签的一样,使用 itms-services 协议进行下载。

ssl 签名 .mobileconfig 配置文件

我看了很多文章,都是用开发者证书去签名的,可是我弄了好久,死活从“未签名”变成了“”尚未验证“,当时一度绝望了好长时间。从 iPhone 配置实用工具 2.2 到 iPhone 配置实用工具 3.5,皆不成功。

配置文件是可以使用的,虽然说安装时会提示红色字“尚未验证”,看起来不太安全之外,一切安好。可是要有追求啊,别人能做到的东西,那就是肯定能做的。

<ins data-ad-format="auto" class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-7054762349007490" data-adsbygoogle-status="done" style="display: block; margin: auto; background-color: transparent;"><ins id="aswift_3_expand" style="display: inline-table; border: none; height: 0px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 683px; background-color: transparent;"><ins id="aswift_3_anchor" style="display: block; border: none; height: 0px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 683px; background-color: transparent; overflow: hidden; opacity: 0;"><iframe width="683" height="171" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){setTimeout(h,0)}else if(h.match){try{h=s.upd(h,i)}catch(e){}w.location.replace(h)}}" id="aswift_3" name="aswift_3" style="width: 683px; height: 171px; margin: 0px auto 10px; display: block; left: 0px; position: absolute; top: 0px; border: 0px;"></iframe></ins></ins></ins>

ssl 证书签名配置文件是知道的,可是向后端人员要证书文件的时候一度受到了困扰,所以前期搁置了好久,直到其它的方法都被我试过了,都不行之后,只好继续调研 ssl 证书签名配置文件。

踩完无数的坑之后,这里介绍一种亲测可用的方法,使用 ssl 证书进行配置文件的签名。我是看这篇文章实现的 为iOS的mobileconfig配置文件进行签名

很简单,需要三个文件,三行命令,完成。

<pre class="prettyprint hljs objectivec" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; word-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">openssl smime -sign -in unsigned.mobileconfig -out signed.mobileconfig -signer mbaike.crt -inkey mbaike.key -certfile ca-bundle.pem -outform der -nodetach openssl rsa -in mbaike.key -out mbaikenopass.key
$ openssl smime -sign -in unsigned.mobileconfig -out signed.mobileconfig -signer mbaike.crt -inkey mbaikenopass.key -certfile ca-bundle.pem -outform der -nodetach</pre>

这里耗时主要是在等运维人员提供相关证书文件,千万别给错了,否则很难 Debug。

下载描述文件后不能自动跳转到安装界面

在 iOS 12.2 上苹果做了改动,下载完后需要用户手动进行安装。点击 设置 —— 已下载描述文件,会自动弹出描述文件安装界面,点击右上角安装即可。

官方说明点这儿 在 iPhone 或 iPad 上安装配置描述文件

利用 .mobileprovision 跳转到已下载描述文件

这是为了方便用户不需手动找描述文件并安装,可以直接跳过去,省去用户操作。

  1. 苹果开发者网站 中下载对应的发布描述文件;

  2. 把发布描述文件部署在服务器;

  3. web 访问服务器的发布描述文件,如: http://***.com/embedded.mobileprovision

  4. Done。

当执行第三步后,会自动跳转至描述文件。

参考文献

Create GUIDs online

SSL Converter - Convert SSL Certificates to different formats

mobileconfig文件的签名和认证(signed、verified)

iOS超级签名

通过Safari浏览器获取iOS设备UDID(设备唯一标识符)

声明

博文作者:GarveyCalvin

博文出处: http://www.cnblogs.com/GarveyCalvin/

本文版权归作者和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作!

相关文章

网友评论

    本文标题:iOS开发 - 超级签名实现之描述文件

    本文链接:https://www.haomeiwen.com/subject/btjtnctx.html