harmony 鸿蒙Obtaining Key Properties (ArkTS)
Obtaining Key Properties (ArkTS)
This topic describes how to obtain properties of a key. Before the operation, ensure that the key exists in HUKS.
>NOTE
> The mini-system devices do not support the operation for obtaining key properties.
How to Develop
Set the key alias (keyAlias), which cannot exceed 128 bytes.
Use getKeyItemProperties to obtain the properties of the key based on keyAlias and options. options is a reserved parameter and is left empty currently.
You can find the key properties in the properties field in the HuksReturnResult object.
import { huks } from '@kit.UniversalKeystoreKit';
/* 1. Set the key alias. */
let keyAlias = 'keyAlias';
/* Leave options empty. */
let emptyOptions: huks.HuksOptions = {
properties: []
};
try {
/* 2. Obtain key properties. */
huks.getKeyItemProperties(keyAlias, emptyOptions, (error, data) => {
if (error) {
console.error(`callback: getKeyItemProperties failed, ` + JSON.stringify(error));
} else {
console.info(`callback: getKeyItemProperties success, data = ${JSON.stringify(data)}`);
}
});
} catch (error) {
console.error(`callback: getKeyItemProperties input arg invalid, ` + JSON.stringify(error));
}
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Universal Keystore Kit (Key Management Service)
harmony 鸿蒙Specifying the User for Key Operations (for System Applications Only)
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
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦