Android 上的 SSL(通过 BouncyCastle)
http://blog.antoine.li/index.html php/2010/10/android-trusting-ssl-certificates/
我按照本教程进行操作,一切似乎都很好(我在路上没有遇到任何错误),但我再次明白
06-24 18:42:31.746: WARN/System.err(14807): javax.net.ssl.SSLException: Not trusted server certificate
06-24 18:42:31.756: WARN/System.err(14807): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
06-24 18:42:31.766: WARN/System.err(14807): Caused by: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
了http://subdomain.domain.com 上的 SSL - RapidSSL。我下载了(单个)证书并将其插入密钥库。添加了 myHttpClient 但同样,我无法让 https 工作。
有什么建议吗?
编辑:在桌面上一切都很好 - 我根本没有收到任何错误/警告。
http://blog.antoine.li/index.php/2010/10/android-trusting-ssl-certificates/
I followed this tutorial and everything seemed to be fine (I didn't get any error(s) on the road) but again I get
06-24 18:42:31.746: WARN/System.err(14807): javax.net.ssl.SSLException: Not trusted server certificate
06-24 18:42:31.756: WARN/System.err(14807): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
06-24 18:42:31.766: WARN/System.err(14807): Caused by: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
I have SSL on http://subdomain.domain.com - RapidSSL. I downloaded the (single) certificate and inserted it into keystore. Added myHttpClient but again, I can't get https to work.
Any suggestions?
EDIT: On desktop everything is just fine - I don't get any errors/warnings at all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
例如,尝试 http://www.digicert.com/help/ - 粘贴您的 URL站点,您将看到证书是否已正确安装。通常,要正确安装证书,您不仅需要安装证书,还需要安装来自证书颁发机构的中间证书。他们通常不会使用主证书来签署您的证书,而是使用一些中间证书,这些中间证书可以在出现任何问题时失效,并且不像主证书那么“珍贵” - 这意味着您的证书在链中处于第三位:
主要权威机构证书->中级权威证书->你自己的证书
所以你不仅要告诉你的客户你的证书,还要告诉你的中间证书。
安装说明通常可在您的认证机构帐户中找到。
Try http://www.digicert.com/help/ for example - paste in the URL of your site and you will see if the certificate is correctly installed. Usually to get the certificate correctly installed you do not only have to install the certificate but also an intermediate certficate from your certificate authority. They usually sign your certs not with their main certificate but using some intermediate ones that they can invalidate in case of any problems and which is not as "precious" as the main one - which means that your certificate is third in the chain:
main authority certificate -> intermediate authority certificate -> your own certificate
So you have to tell your client not only your certificate, but also the intermediate one.
Installation instructions are usually available at your certifcation authority account.
我遵循的详细分步说明来实现此目标
http://repo2.maven.org/maven2/org/bouncycastle/bcprov-ext-jdk15on/1.46/bcprov-ext-jdk15on-1.46.jar
或者从“doc”文件夹中获取它。
为 TOMCAT 配置 BouncyCastle
打开 D:\tools\apache-tomcat-6.0.35\conf\server.xml 并添加以下条目
端口=“8443”
keystorePass=“我的项目”
别名=“我的项目”
密钥库 =“c:/myproject.keystore”
密钥库类型=“BKS”
SSL 启用=“真”
客户端验证=“假”
协议=“HTTP/1.1”
方案=“https”
安全=“真”
ssl协议=“TLS”
sslImplementationName="org.bouncycastle.jce.provider.BouncyCastleProvider"/>
完成这些更改后重新启动服务器。
MyHttpClient.java
如何在 Activity 类中调用上述代码:
Detailed Step by Step instructions I followed to achieve this
http://repo2.maven.org/maven2/org/bouncycastle/bcprov-ext-jdk15on/1.46/bcprov-ext-jdk15on-1.46.jar
or take it from the "doc" folder.
Configure BouncyCastle for TOMCAT
Open D:\tools\apache-tomcat-6.0.35\conf\server.xml and add the following entry
port="8443"
keystorePass="myproject"
alias="myproject"
keystore="c:/myproject.keystore"
keystoreType="BKS"
SSLEnabled="true"
clientAuth="false"
protocol="HTTP/1.1"
scheme="https"
secure="true"
sslProtocol="TLS"
sslImplementationName="org.bouncycastle.jce.provider.BouncyCastleProvider"/>
Restart the server after these changes.
MyHttpClient.java
How to invoke the above code in your Activity class:
查找并下载Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files
http://www.oracle.com/technetwork/java/javase/downloads /index.html
覆盖 JDK 中的 local_policy.jar 和 US_export_policy.jar
并在您的 JRE 中
文件夹。
Find and download Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files in
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Overwrite the local_policy.jar and US_export_policy.jar in both your JDK's
and in your JRE's
folder.