I am using Okhttp + Retrofit for networking in my SDK. I have a requirement to implement Certificate pinning but not enforce it. We just need to get the failure reports for pinning failure and would like the request to go through for now during the monitoring period.
TrustKit is another Certificate pinning library which provides this option to set enforce = false. With this, the request itself wouldn't fail but we can get the failure reports.
I do not see a way to achieve similar behavior using the Okhttp CertificatePinner. OkHttp would always fail the request with an exception if the Certificate pinning fails.
Do you have any suggestions on how I can achieve this behavior using the existing functionality?
Would have been easier if we could extend CertificatePinner class and override check() ?
Thanks in advance.