Stay organized with collections
Save and categorize content based on your preferences.
ClientCertRequest
abstract class ClientCertRequest
ClientCertRequest: The user receives an instance of this class as a parameter of WebViewClient.onReceivedClientCertRequest
. The request includes the parameters to choose the client certificate, such as the host name and the port number requesting the cert, the acceptable key types and the principals. The user should call one of the class methods to indicate how to deal with the client certificate request. All methods should be called on UI thread. WebView caches the proceed
and cancel
responses in memory and uses them to handle future client certificate requests for the same host/port pair. The user can clear the cached data using WebView.clearClientCertPreferences
.
Summary
Public methods |
abstract Unit |
Cancel this request.
|
abstract String! |
Returns the host name of the server requesting the certificate.
|
abstract Array<String!>? |
Returns the acceptable types of asymmetric keys.
|
abstract Int |
Returns the port number of the server requesting the certificate.
|
abstract Array<Principal!>? |
Returns the acceptable certificate issuers for the certificate matching the private key.
|
abstract Unit |
Ignore the request for now.
|
abstract Unit |
Proceed with the specified private key and client certificate chain.
|
Public constructors
ClientCertRequest
ClientCertRequest()
Public methods
cancel
abstract fun cancel(): Unit
Cancel this request. Remember the user's choice and use it for future requests.
getHost
abstract fun getHost(): String!
Returns the host name of the server requesting the certificate.
getKeyTypes
abstract fun getKeyTypes(): Array<String!>?
Returns the acceptable types of asymmetric keys.
getPort
abstract fun getPort(): Int
Returns the port number of the server requesting the certificate.
getPrincipals
abstract fun getPrincipals(): Array<Principal!>?
Returns the acceptable certificate issuers for the certificate matching the private key.
ignore
abstract fun ignore(): Unit
Ignore the request for now. Do not remember user's choice.
proceed
abstract fun proceed(
privateKey: PrivateKey!,
chain: Array<X509Certificate!>!
): Unit
Proceed with the specified private key and client certificate chain. Remember the user's positive choice and use it for future requests.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ClientCertRequest\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nClientCertRequest\n=================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/webkit/ClientCertRequest \"View this page in Java\") \n\n```\nabstract class ClientCertRequest\n```\n\n|---|---------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.webkit.ClientCertRequest](#) |\n\nClientCertRequest: The user receives an instance of this class as a parameter of [WebViewClient.onReceivedClientCertRequest](/reference/kotlin/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)). The request includes the parameters to choose the client certificate, such as the host name and the port number requesting the cert, the acceptable key types and the principals. The user should call one of the class methods to indicate how to deal with the client certificate request. All methods should be called on UI thread. WebView caches the [proceed](#proceed(java.security.PrivateKey,%20kotlin.Array)) and [cancel](#cancel()) responses in memory and uses them to handle future client certificate requests for the same host/port pair. The user can clear the cached data using [WebView.clearClientCertPreferences](/reference/kotlin/android/webkit/WebView#clearClientCertPreferences(java.lang.Runnable)).\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------------------|---|\n| [ClientCertRequest](#ClientCertRequest())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [cancel](#cancel())`()` Cancel this request. |\n| abstract [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getHost](#getHost())`()` Returns the host name of the server requesting the certificate. |\n| abstract [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\\\u003e? | [getKeyTypes](#getKeyTypes())`()` Returns the acceptable types of asymmetric keys. |\n| abstract [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getPort](#getPort())`()` Returns the port number of the server requesting the certificate. |\n| abstract [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\\\u003c[Principal](../../java/security/Principal.html#)!\\\u003e? | [getPrincipals](#getPrincipals())`()` Returns the acceptable certificate issuers for the certificate matching the private key. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [ignore](#ignore())`()` Ignore the request for now. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [proceed](#proceed(java.security.PrivateKey,%20kotlin.Array))`(`privateKey:` `[PrivateKey](../../java/security/PrivateKey.html#)!`, `chain:` `[Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\u003c[X509Certificate](../../java/security/cert/X509Certificate.html#)!\u003e!`)` Proceed with the specified private key and client certificate chain. |\n\nPublic constructors\n-------------------\n\n### ClientCertRequest\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nClientCertRequest()\n```\n\nPublic methods\n--------------\n\n### cancel\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun cancel(): Unit\n```\n\nCancel this request. Remember the user's choice and use it for future requests. \n\n### getHost\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getHost(): String!\n```\n\nReturns the host name of the server requesting the certificate. \n\n### getKeyTypes\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getKeyTypes(): Array\u003cString!\u003e?\n```\n\nReturns the acceptable types of asymmetric keys.\n\n| Return ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------|\n| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\u003e? | This value may be `null`. |\n\n### getPort\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getPort(): Int\n```\n\nReturns the port number of the server requesting the certificate. \n\n### getPrincipals\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getPrincipals(): Array\u003cPrincipal!\u003e?\n```\n\nReturns the acceptable certificate issuers for the certificate matching the private key.\n\n| Return ||\n|------------------------------------------------------------------------------------------------------------------------------------|---------------------------|\n| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\u003c[Principal](../../java/security/Principal.html#)!\u003e? | This value may be `null`. |\n\n### ignore\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun ignore(): Unit\n```\n\nIgnore the request for now. Do not remember user's choice. \n\n### proceed\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun proceed(\n privateKey: PrivateKey!, \n chain: Array\u003cX509Certificate!\u003e!\n): Unit\n```\n\nProceed with the specified private key and client certificate chain. Remember the user's positive choice and use it for future requests."]]