android webview with client certificate

前端 未结 8 2014
情歌与酒
情歌与酒 2020-11-29 04:16

I tried for days to use a web view with a client certificate embedded in the application, but it seems to me that the android sdk does not provide any way to do it, is there

相关标签:
8条回答
  • 2020-11-29 04:54

    In API 21 (Android Lollipop) and higher you can override the WebViewClient.onReceivedClientCertRequest(WebView view, ClientCertRequest request). In the method, use your key manager for getting the private key and certificate chain and call request.proceed().

    0 讨论(0)
  • 2020-11-29 04:57

    onReceivedClientCertRequest() is added to WebViewClient since API 21. https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)

    The solution from the following Stackoverflow post worked for me: Android WebView handle onReceivedClientCertRequest

    To test:

    • Server URL: https://client.badssl.com/
    • Client certificate: https://badssl.com/download/

    When client certificate is not setup, you will see "400 bad request".

    0 讨论(0)
提交回复
热议问题