您的位置:首页 > 其它

打包放服务器上 "无法安装应用程序 因为证书无效"的解决方案

2014-11-13 18:07 387 查看
http://blog.csdn.net/zhaoxy_thu/article/details/21133399

今天升级了iOS7.1后发现通过之前的url无法安装企业应用了,一直提示“无法安装应用程序 因为http://xxx.xxx.xxx证书无效”,折腾了一番,终于在StackOverFlow上找到了答案。在这里分享给大家。

StackOverFlow链接:http://stackoverflow.com/questions/20276907/enterprise-app-deployment-doesnt-work-on-ios-7-1/22325916#22325916

原因是由于iOS7.1要安装企业应用,url必须是https的,不能是http,这就要求我们的服务器要支持https。因此,只要将原链接:

[plain]
view plaincopy

itms-services://?action=download-manifest&url=http://example.com/manifest.plist

改为

[plain]
view plaincopy

itms-services://?action=download-manifest&url=https://example.com/manifest.plist

即可。

对于服务器,则需要增加对https的支持,本人用的是apache服务器,所以在这里以apache服务器为例:

1. 安装配有SSL模块的apache版本,本人使用的是httpd-2.0.65-win32-x86-openssl-0.9.8y

2. 打开apache的配置文件conf/httpd.conf,去掉以下内容前的#

[plain]
view plaincopy

LoadModule ssl_module modules/mod_ssl.so

并在文件最后加上:

[plain]
view plaincopy

<VirtualHost *:8080>
ServerAdmin zhaoxinyan12@mails.tsinghua.edu.cn(随意)
DocumentRoot D:/Server(服务器根目录)
ServerName 166.111.81.xxx(服务器域名或ip地址)
ErrorLog logs/test-error_log
CustomLog logs/test-access_log common
SSLEngine on
SSLCertificateFile "D:/Program Files/Apache Group/Apache2/conf/ssl.crt/server.crt"(之后生成证书的完整路径)
SSLCertificateKeyFile "D:/Program Files/Apache Group/Apache2/conf/ssl.key/server.key" (之后生成密钥的完整路径)

</VirtualHost>

3. 修改conf/ssl.conf文件的以下内容:(以下为修改完的,大家可以参考下)

[plain]
view plaincopy

#SSLSessionCache none
#SSLSessionCache shmht:logs/ssl_scache(512000)
SSLSessionCache shmcb:logs/ssl_scache(512000)
#SSLSessionCache dbm:logs/ssl_scache
...
SSLCertificateFile conf/ssl.crt/server.crt
...
SSLCertificateKeyFile conf/ssl.key/server.key

4. 在conf目录下创建ssl.crt和ssl.key目录(不创建也行,只要保证以上两个路径和之后的文件路径对应即可)
5. 在命令行下切换到apache目录下的bin目录,运行以下命令

生成服务器的私钥:

[plain]
view plaincopy

openssl genrsa -out server.key 1024

6. 生成签署申请(注意除Common Name以外可以为空,Common Name必须为服务器的ip或域名):

[plain]
view plaincopy

openssl req -new –out server.csr -key server.key -config ..\conf\openssl.cnf

7. 生成CA私钥:

[plain]
view plaincopy

openssl genrsa -out ca.key 1024

8. 利用CA的私钥产生CA的自签署证书(注意除Common Name以外可以为空,Common Name必须为服务器的ip或域名):

[plain]
view plaincopy

openssl req -new -x509 -days 365 -key ca.key -out ca.crt -config ..\conf\openssl.cnf

9. 在当前目录创建demoCA,里面创建文件index.txt和serial,serial内容为01,index.txt为空,以及文件夹newcerts。

10. CA为网站服务器签署证书:

[plain]
view plaincopy

openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config ..\conf\openssl.cnf

11. 最后将server.crt,server.key复制到上文对应的路径下:

[plain]
view plaincopy

conf/ssl.crt/server.crt
conf/ssl.key/server.key

12. 重启Apache服务器,即增加了https的支持。可以在浏览器访问https://localhost试试。如果不行,可以在logs\test-error_log文件中看看出了什么错误。
13. 最后,我们要将自己创建的CA证书安装到iphone上。将第10步生成的ca.crt文件通过邮件发送到iphone上,用自带的Mail程序(别的程序不行)打开安装即可。

14. 现在,再次访问我们之前的itms-services链接,就可以正常安装了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐