Check in the onReceivedSslError() method of a WebViewClient if a certificate is signed from a specific self-signed CA

后端 未结 3 795
逝去的感伤
逝去的感伤 2020-12-08 16:06

I would like to override the onReceivedSslError() of a WebViewClient. Here I want to check if the error.getCertificate() certificate i

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 16:43

    based on documentation:

    Have you tried using the method getIssuedBy().getDName() of class SslCertificate. This method returns a String representing "The entity that issued this certificate".

    Take a look here: http://developer.android.com/reference/android/net/http/SslCertificate.html#getIssuedBy()

    Then you just need to know wich string is returned when it is self signed.

    EDIT: I think that if it is selfsigned, that should return empty string, and if not, it would return the entity

    Regards

提交回复
热议问题