openharmony 鸿蒙 huks-as-user-sys

2025-06-12 浏览 (1)

Specifying the User for Key Operations (for System Applications Only)

To implement isolation and access control for key data, HUKS provides APIs with the user ID specified for concurrent key operations initiated by multiple users.

NOTE
The mini-system devices do not support the operation described in this topic.

Constraints

  • The range of the caller's user ID is 0 to 99, including 0 and 99.
  • The APIs are available only for system applications.

Available APIs

APIs with the userId parameter are provided as enhancement to existing APIs.

When using these APIs, observe the following:

  1. You can pass in HUKS_TAG_AUTH_STORAGE_LEVEL in options to specify the security level for the key stored.
  2. If HUKS_TAG_AUTH_STORAGE_LEVEL is not specified in options, the key can be accessed only after the first unlock of the device by default, which is equivalent to passing in HUKS_AUTH_STORAGE_LEVEL_CE.

The algorithm specifications and the usage of the APIs are the same as those of the APIs without userId.

API with userIdDescriptionAPI Without userId
generateKeyItemAsUserGenerates a key.generateKeyItem
deleteKeyItemAsUserDeletes a key.deleteKeyItem
importKeyItemAsUserImports a key in plaintext.importKeyItem
importWrappedKeyItemAsUserImports an encrypted key.importWrappedKeyItem
exportKeyItemAsUserExports a key.exportKeyItem
getKeyItemPropertiesAsUserObtains key properties.getKeyItemProperties
hasKeyItemAsUserChecks whether a key exists.hasKeyItem
initSessionAsUserInitializes a key session.initSession in encryption and decryption, signing and signature verification, key agreement, and key derivation
attestKeyItemAsUserPerforms non-anonymous key attestation.attestKeyItem
anonAttestKeyItemAsUserPerforms anonymous key attestation.anonAttestKeyItem

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Universal Keystore Kit (Key Management Service)

harmony 鸿蒙Checking a Key (ArkTS)

harmony 鸿蒙Checking a Key (C/C++)

harmony 鸿蒙Basic Concepts of HUKS

harmony 鸿蒙Deleting a Key (ArkTS)

harmony 鸿蒙Deleting a Key (C/C++)

harmony 鸿蒙Encryption and Decryption (ArkTS)

harmony 鸿蒙Encryption and Decryption (C/C++)

harmony 鸿蒙Encryption and Decryption Overview and Algorithm Specifications

harmony 鸿蒙Exporting a Key (ArkTS)

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/0clV0J