1# Key Attestation Overview and Algorithm Specifications
2
3
4HUKS provides attestation for the public keys of asymmetric key pairs.
5
6
7HUKS issues a certificate for the public key of an asymmetric key pair stored in HUKS using the public key infrastructure (PKI) certificate chain technology. The certificate can prove the validity of the public key. The service can use the root CA certificate provided by the system to verify the key certificates issued by HUKS level by level to ensure that the public key and private key in the certificates are from a trusted hardware device and stored in HUKS. In addition, the output key certificate contains the key owner information in the following format:
8| Key Owner| Format| Description|
9| -------- | -------- | -------- |
10| Application| {appId:"xxx", bundleName:"xxx"} | **bundleName** indicates the bundle name of the application.|
11| System service| {processName:"xxx", APL:"system_basic \| system_core"} | APL is [Ability Privilege Level](../../security/AccessToken/app-permission-mgmt-overview.md#basic-concepts-in-the-permission-mechanism).|
12
13> **NOTE**
14> - Key attestation is not supported if the caller is a system service with APL of **normal**. In this case, **processName** and **APL** are left empty.
15> - Key attestation is not supported in Emulator scenarios.
16> - The mini-system devices do not support key attestation.
17> - Key attestation is available to both the keys generated and imported. The service side needs to check whether the key source meets the expectation based on the key source field in the service certificate on the server. The object identifier (OID) of the key source field is **1.3.6.1.4.1.2011.2.376.2.1.5**.
18
19The following table lists the key source and the corresponding value in the OID field.
20| Key Source| OID Value|
21| -------- | -------- |
22| Import| 1 |
23| Generation| <!--RP1-->2<!--RP1End--> |
24
25The key attestation process is as follows:
26
27
281. The service transfers the key alias and properties to HUKS.
29
302. HUKS issues an X.509 certificate chain, which consists of the root CA certificate, device CA certificate, device certificate, and key certificate in sequence, for the application.
31
323. The certificate chain is sent to a trusted server. The server parses the certificate chain and verifies the certificate chain validity and whether a single certificate is revoked.
33
34<!--RP2-->
35Currently, the system provides two key attestation modes.
36- Anonymous key attestation: This type of attestation will not disclose the device information, and the caller does not require any permission. Anonymous key attestation is available to all applications. To protect user device information, third-party applications can use anonymous attestation only.
37- Non-anonymous key attestation: The device information of the caller can be viewed, and the caller must have the [ohos.permission.ATTEST_KEY](../AccessToken/permissions-for-system-apps.md#ohospermissionattest_key) permission.
38<!--RP2End-->
39
40## Supported Algorithms
41
42The following table lists the supported key attestation specifications.
43<!--Del-->
44The key management service specifications include mandatory specifications and optional specifications. Mandatory specifications are algorithm specifications that must be supported. Optional specifications can be used based on actual situation. Before using the optional specifications, refer to the documents provided by the vendor to ensure that the specifications are supported.
45
46**You are advised to use mandatory specifications in your development for compatibility purposes.**
47<!--DelEnd-->
48
49<!--Del-->
50**Anonymous key attestation**
51<!--DelEnd-->
52
53| Algorithm| Description| API Version| <!--DelCol4-->Mandatory|
54| -------- | -------- | -------- | -------- |
55| RSA | The padding mode can be PSS or PKCS1_V1_5.| 11+ | Yes|
56| ECC | - | 11+ | Yes|
57| SM2 | - | 11+ | Yes|
58
59<!--Del-->
60**Non-anonymous key attestation**
61
62| Algorithm| Description| API Version| Mandatory|
63| -------- | -------- | -------- | -------- |
64| RSA | The padding mode can be PSS or PKCS1_V1_5.| 8+ | Yes|
65| ECC | - | 8+ | Yes|
66| X25519 | - | 8+ | Yes|
67| SM2 | - | 8+ | Yes|
68<!--DelEnd-->
69