Reputation: 121
I need to implement an SSL connection similar to a browser implementation, I need to show a dialog if the certificate is not from a trusted source and accept the certificate and proceed with the connection. please guide me.
Upvotes: 1
Views: 334
Reputation: 42710
You can implement a custom X509TrustManager that verifies the server certificate based on the standard trusted root certificates from Android and additionally an own trusted list.
See checkServerTrusted(..)
method.
If an invalid/untrusted certificate appears you can ask the user if it should be added to your own trusted list.
Upvotes: 1
Reputation: 52956
You can only install trusted certificates on Android 4.0 and later. You can catch the certificate error and then ask the user to install the certificate using the KeyChain API. It requires user confirmation, so you cannot do this automatically.
Upvotes: 0