Android 7.0 https/tls证书配置问题
来源:互联网 发布:mysql免费吗 编辑:程序博客网 时间:2024/06/05 14:55
最近系统更新到7.0后https/tls网络请求出现异常
SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
原来Android 7.0以后google增加了网络配置,在https/tls只需要在配置文件中添加相应配置即可完成https协议的网络请求,对于由正式ca签名的证书不需要配置,主要针对自签名的证书。
第一步AndroidManifestw文件添加
<?xml version="1.0" encoding="utf-8"?><manifest ... > <application android:networkSecurityConfig="@xml/network_security_config" ... > ... </application></manifest>
第二步添加res/xml/network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?><network-security-config> <domain-config> <domain includeSubdomains="true">example.com</domain> <trust-anchors> <certificates src="@raw/my_cer"/> </trust-anchors> </domain-config></network-security-config>
以 PEM 或 DER 格式将自签署或非公共 CA 证书添加到 res/raw/my_cer。
在我的项目中采用的是ca的证书始终报java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.后来改为直接采用服务器证书终于通过,不知道是ca证书生成的有问题还是什么,但7.0以下通讯都正常。
0 0
- Android 7.0 https/tls证书配置问题
- Android https 自定义 证书 问题
- TOMCAT配置HTTPS生成单向证书问题
- Android手机进行无线EAP-TLS证书认证配置
- TLS/HTTPS 证书生成与验证
- Https、SSL/TLS以及证书入门
- 微信小程序免费SSL证书https、TLS版本问题的解决方案
- 微信小程序免费SSL证书https、TLS版本问题的解决方案
- 微信小程序免费SSL证书https、TLS版本问题的解决方案
- Tomcat SSL / TLS (HTTPS) 配置
- nginx配置https证书
- tomcat https 证书配置
- 配置https证书
- tomcat配置https证书
- https证书的配置
- CA证书 配置 https
- 防止https证书问题
- HTTPS 证书问题
- JAVA代码自动生成.xls和.xlsx类型的excel文件的详细过程和代码
- HTML5头部常用的<head>总结
- springmvc 中各种数据配置
- 8大排序算法Java实现
- Android多级列表二三事
- Android 7.0 https/tls证书配置问题
- 【Android实战】----从Retrofit源码分析到Java网络编程以及HTTP权威指南想到的
- 使用 Apache Solr 实现更加灵巧的搜索,第 1 部分: 基本特性和 Solr 模式
- Handsontable
- [BASIC-29]-高精度加法(java)
- Https的工作流程图
- 解决在tomecat启动时报 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListen
- 一种基于查表的定时开关机判断方法
- MySQL与PostgreSQL相比哪个更好?