当证书修改器中的参数错误时我不应该连接到https,但是我确实

时间:2019-06-17 15:55:05

标签: android retrofit2 okhttp3

我对CertificatePinner进行了改造,以连接https://api.blablabla.com 这是下面的代码。即使certificatepinner中的引脚和模式完全错误,改造也可以成功连接到api,它不应该连接到服务器吗?我想念什么?

  static OkHttpClient.Builder httpClient = new OkHttpClient.Builder()
        .connectTimeout(20, TimeUnit.SECONDS);

   CertificatePinner certificatePinner = new CertificatePinner.Builder()
            .add(
                    "https://www.goodgle.com.tr",  // this is wrong address
                    "sha256/6OcCAYrebyAu0zfHwYOfruRCL77asdadsfasdfxkP8="   // this is wrong sha256 pin
            ).build();


    retrofit = new Retrofit.Builder()
            .baseUrl(Config.API_BASE_URL)  // api_base_url is correct and it is like https://apis.mapissadfasdf.com
            .addConverterFactory(GsonConverterFactory.create(gson))
            .client(httpClient.certificatePinner(certificatePinner).build())
            .build();

0 个答案:

没有答案