Question

I am working on an application in which i have to post certain data via HTTPS services. I am using a self signed certificate but i am not sure where to register this certificate in my device and i don't want to use inbuilt browser kit. As i understand if i use browser kit i can add my certificate and install under "user" certificate.

Is there any way to add this certificate at "system" level in android rather than at "user" level ? 

Can someone suggest one who has worked on VPN would be more aware on it....

Était-ce utile?

La solution

I am working on an application in which i have to post certain data via HTTPS services. I am using a self signed certificate

If you are using HttpURLConnection, OkHttp, or HttpClient, you can create an SSLContext that uses a TrustManager that supports your self-signed certificate. I have some support for this with my TrustManagerBuilder in my CWAC-Security library, and there are plenty of examples of how to do this yourself, such as this blog post, by searching for android sslcontext self-signed in your favorite search engine.

If you are using some library for HTTP access, find out where you can configure its SSL functionality, or contact the author of that library if there does not seem to be an option for this.

Is there any way to add this certificate at "system" level in android rather than at "user" level ?

Users can install certificates. I am not aware that apps can install certificates, though I cannot rule it out. However, unless this certificate is needed for other apps, not just yours, please just use the certificate from your own app.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top