Class (ClientAuthenticationHandler)
Implements a ClientAuthenticationHandler object to handle SSL client certificate request events returned by the Web component. For details about the sample code, see onClientAuthenticationRequest.
NOTE
This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The initial APIs of this class are supported since API version 9.
The sample effect is subject to the actual device.
constructor9+
constructor()
Constructs a ClientAuthenticationHandler.
System capability: SystemCapability.Web.Webview.Core
confirm9+
confirm(priKeyFile : string, certChainFile : string): void
Uses the specified private key and client certificate chain.
System capability: SystemCapability.Web.Webview.Core
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| priKeyFile | string | Yes | Full path for storing the private key file. |
| certChainFile | string | Yes | Full path for storing the certificate chain file. |
confirm10+
confirm(authUri : string): void
Instructs the Web component to use the specified credentials (obtained from the certificate management module).
NOTE
The ohos.permission.ACCESS_CERT_MANAGER permission must be declared.
System capability: SystemCapability.Web.Webview.Core
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| authUri | string | Yes | Key value of the credentials. |
The following table lists the supported certificate signature algorithms and key lengths.
| Signing Algorithm | Key Length |
|---|---|
| SSL_SIGN_RSA_PKCS1_SHA256 | 1024 (supported since API version 18), 2048, 3072, and 4096 |
| SSL_SIGN_RSA_PKCS1_SHA384 | 1024 (supported since API version 18), 2048, 3072, and 4096 |
| SSL_SIGN_RSA_PKCS1_SHA512 | 1024 (supported since API version 18), 2048, 3072, and 4096 |
| SSL_SIGN_RSA_PSS_SHA256 | 1024 (supported since API version 18), 2048, 3072, and 4096 |
| SSL_SIGN_RSA_PSS_SHA384 | 1024 (supported since API version 18), 2048, 3072, and 4096 |
| SSL_SIGN_RSA_PSS_SHA512 | 1024 (supported since API version 18), 2048, 3072, and 4096 |
| SSL_SIGN_ECDSA_SECP256R1_SHA256 | 256 |
| SSL_SIGN_ECDSA_SECP384R1_SHA384 | 384 |
| SSL_SIGN_ECDSA_SECP521R1_SHA512 | 521 |
confirm22+
confirm(identity: string, credentialTypeOrCertChainFile: CredentialType | string): void
Instructs the Web component to use the specified credential and credential type obtained from the certificate management module.
System capability: SystemCapability.Web.Webview.Core
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| identity | string | Yes | Unique ID of a credential. |
| credentialTypeOrCertChainFile | CredentialType | string | Yes | CredentialType indicates the credential type. string indicates the certificate chain file path. |
Error codes
For details about the error codes, see Universal Error Codes.
| ID | Error Message |
|---|---|
| 801 | Capability not supported. |
cancel9+
cancel(): void
Cancels the client certificate request sent by the same host and port server. No additional event will be reported for requests from the same host and port server.
System capability: SystemCapability.Web.Webview.Core
ignore9+
ignore(): void
Ignores this request.
System capability: SystemCapability.Web.Webview.Core