Search code examples
androidssldnscertificatetrust

Android trust specific domain certificate


I'm getting a error using httpclient: "No peer certificate"

So, I need configure the httpclient to trust all certificates from a specific domain, but could not found a way to do this.

I don't want to allow all domains, just a specific one.


Solution

  • to trust all certificates from a specific domain,...

    That's not how trust works. if you would trust just based on the domain name, then anybody could issue their own a certificate with your domain name and you would trust it.

    You should instead make sure that you get a certificate which is

    • is issued by a trusted CA
    • is issued for the same hostname you use to access the site.

    If the certificate fits these requirements no special validations are needed.