简体   繁体   English

使用X509TrustManager:checkServerTrusted的自签名证书验证

[英]Self signed cert validation using X509TrustManager:checkServerTrusted

X509TrustManager:checkServerTrusted , i use this api for validating certs obtained , the first time it throws an exception for a self signed cert. X509TrustManager:checkServerTrusted,我使用此api验证所获得的证书,这是它首次引发自签名证书的异常。 User is displayed with warning dialogue for that website. 向用户显示该网站的警告对话框。 if the user continues and website is displayed. 如果用户继续并显示网站。

Now i refresh that page again , and the same cert is validated using the same api , but here i do not see any exception , is the trust manager updated with this cert value? 现在,我再次刷新该页面,并且使用相同的api验证了相同的证书,但是在这里我没有看到任何异常,信任管理器是否已使用此证书值更新? is this suppose to be the expected behavior 这是否是预期的行为

All this is being done in android environment 所有这些都是在android环境中完成的

Sounds like you are using a WebView. 听起来好像您正在使用WebView。 In such a case the SSL connections are handled in a different way. 在这种情况下,将以不同的方式处理SSL连接。 If you want to implement a custom behavior for accepting self-signed SSl certificates you have to implement the interface android.webkit.SslErrorHandler and set it as SSLErrorHandler in your WebView class. 如果要实现自定义行为以接受自签名SSl证书,则必须实现android.webkit.SslErrorHandler接口,并将其设置为WebView类中的SSLErrorHandler。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM