sajjad Yosefi
sajjad Yosefi

Reputation: 190

CertPathValidatorException: Trust anchor for certification path not found. in android after update gradle and gradle plugin

I try to check SSL, by this code (and work successfully):

OkHttpClient.Builder httpBuilder = new OkHttpClient.Builder();
CertificatePinner certificatePinner = new CertificatePinner.Builder()
        .add("example.com", "sha256/S4AbJNGvyS57nzJwv8sPMUML8VHSqH1vbiBftdPcErI=")
        .build();
OkHttpClient client1 = httpBuilder
        .certificatePinner(certificatePinner)
        .build();
Retrofit retrofit1 = new Retrofit.Builder()
        .client(client1)
        .baseUrl("https://example.com/").addConverterFactory(GsonConverterFactory.create()).build();
samaniumRestApi2 userClient = retrofit1.create(samaniumRestApi2.class);
Call<Object> call = userClient.maintenanceMode(requestmaintenanceModeCheck);
call.enqueue(xxxxxxxxxxxxx);

and I get error by change base url to:

https://example.com:448/

or

https://subdomain.example.com/

and error is :

CertPathValidatorException: Trust anchor for certification path not found.

please save me

Upvotes: 0

Views: 395

Answers (1)

Konstantin Pribluda
Konstantin Pribluda

Reputation: 12367

This would mean that certificate is issued for www.example.com , and thus can not be trusted for whatever.example.com - this server need proper signed certificate

Upvotes: 1

Related Questions