openharmony 鸿蒙 capi-native-huks-type-h

2026-08-25 浏览 (1)

native_huks_type.h

Overview

Defines the enums, structs, and macros used in the HUKS functions.

File to include: <huks/native_huks_type.h>

Library: libhuks_ndk.z.so

System capability: SystemCapability.Security.Huks.Core

The preceding system capability is available since API version 20. From API versions 9 to 19, the system capability is SystemCapability.Security.Huks.Core.

Since: 9

Related module: HuksTypeApi

Summary

Structs

NameDescription
OH_Huks_ResultDefines the struct of the returned data, including a status code and related description.
OH_Huks_BlobDefines the struct of a binary large object (BLOB).
OH_Huks_ParamDefines the struct of the parameters in a parameter set.
OH_Huks_ParamSetDefines the struct of a parameter set.
OH_Huks_CertChainDefines the struct of a certificate chain.
OH_Huks_KeyInfoDefines the struct of key information.
OH_Huks_PubKeyInfoDefines the struct of the public key information.
OH_Huks_KeyMaterialRsaDefines the struct of a Rivest-Shamir-Adleman (RSA) key.
OH_Huks_KeyMaterialEccDefines the struct of an Elliptic Curve Cryptography (ECC) key.
OH_Huks_KeyMaterialDsaDefines the struct of a DSA key.
OH_Huks_KeyMaterialDhDefines the struct of a Diffie-Hellman (DH) key.
OH_Huks_KeyMaterial25519Defines the struct of a 25519 key.
OH_Huks_KeyAliasSetDefines the struct of a key alias set.

Enums

Nametypedef KeywordDescription
OH_Huks_KeyPurpose-Enumerates the key purposes.
OH_Huks_KeyDigest-Enumerates the digest algorithms.
OH_Huks_KeyPadding-Enumerates the padding algorithm types.
OH_Huks_CipherMode-Cipher mode.
OH_Huks_KeySize-Enumerates the key sizes of different algorithms.
OH_Huks_KeyAlg-Enumerates the algorithms for keys.
OH_Huks_AlgSuite-Enumerates the algorithm suites that can be used for importing of a key in cipher text.
OH_Huks_KeyGenerateType-Enumerates the types of the key generated.
OH_Huks_KeyFlag-Enumerates the key generation types.
OH_Huks_KeyStorageType-Enumerates the key storage types.
OH_Huks_ImportKeyType-Enumerates the types of the key to import. By default, a public key is imported. This field is not required when a symmetric key is imported.
OH_Huks_RsaPssSaltLenType-Enumerates the length types of the salt value in PSS padding mode.
OH_Huks_ErrCode-Enumerates error codes.
OH_Huks_TagType-Enumerates the types of the parameters in a parameter set.
OH_Huks_UserAuthType-Enumerates the user authentication types in key access control.
OH_Huks_AuthAccessType-Enumerates the rules for invalidating a key.
OH_Huks_AuthStorageLevel-Enumerates the security levels for storing the key generated or imported.
OH_Huks_ChallengeType-Enumerates the types of the challenge generated when a key is used.
OH_Huks_UserAuthMode-Enumerates the user authentication modes in key access control.
OH_Huks_ChallengePosition-Enumerates the positions of the 8-byte valid value in a custom challenge generated.
OH_Huks_SecureSignType-Enumerates the signature types of the key generated or imported.
OH_Huks_KeyClassTypeOH_Huks_KeyClassTypeKey type.
OH_Huks_KeyWrapType-Enumerates the wrap type of the key generated or imported.
OH_Huks_Tag-Enumerates the tags contained in a parameter set.

Macros

NameDescription
OH_HUKS_AE_TAG_LEN 16Length of the AEAD authentication tag, in bytes.
Since: 9
OH_HUKS_BITS_PER_BYTE 8Number of bits in each byte.
Since: 9
OH_HUKS_MAX_KEY_SIZE 2048Maximum key size, in bytes.
Since: 9
OH_HUKS_AE_NONCE_LEN 12Length of the AEAD one-time random number, in bytes.
Since: 9
OH_HUKS_MAX_KEY_ALIAS_LEN 64Maximum length of a key alias, in bytes.
Since: 9
OH_HUKS_MAX_PROCESS_NAME_LEN 50Maximum length of a process name, in bytes.
Since: 9
OH_HUKS_MAX_RANDOM_LEN 1024Maximum length of a random number, in bytes.
Since: 9
OH_HUKS_SIGNATURE_MIN_SIZE 64Minimum length of the signature result, in bytes.
Since: 9
OH_HUKS_MAX_OUT_BLOB_SIZE (5 * 1024 * 1024)Maximum size of the exported data, in bytes.
Since: 9
OH_HUKS_WRAPPED_FORMAT_MAX_SIZE (1024 * 1024)Maximum size of the key to be imported, in bytes.
Since: 9
OH_HUKS_IMPORT_WRAPPED_KEY_TOTAL_BLOBS 10Maximum number of data blocks of the key to be imported, in bytes.
Since: 9
TOKEN_CHALLENGE_LEN 32Byte length of the challenge value during access control.
Since: 9
SHA256_SIGN_LEN 32Byte length of the SHA-256 signature.
Since: 9
TOKEN_SIZE 32Byte length of the challenge value during access control.
Since: 9
MAX_AUTH_TIMEOUT_SECOND 60Maximum user authentication timeout.
Since: 9
SECURE_SIGN_VERSION 0x01000001Version of the secure signature data.
Since: 9

Enum Description

OH_Huks_KeyPurpose

enum OH_Huks_KeyPurpose

Description

Enumerates the key purposes.

Since: 9

EnumDescription
OH_HUKS_KEY_PURPOSE_ENCRYPT = 1Used to encrypt the plaintext.
OH_HUKS_KEY_PURPOSE_DECRYPT = 2Used to decrypt the cipher text.
OH_HUKS_KEY_PURPOSE_SIGN = 4Used for signing.
OH_HUKS_KEY_PURPOSE_VERIFY = 8Used to verify the signature.
OH_HUKS_KEY_PURPOSE_DERIVE = 16Used to derive a key.
OH_HUKS_KEY_PURPOSE_WRAP = 32Used for exporting a key in ciphertext.
OH_HUKS_KEY_PURPOSE_UNWRAP = 64Used for importing a key in ciphertext.
OH_HUKS_KEY_PURPOSE_MAC = 128Used to generate a message authentication code (MAC).
OH_HUKS_KEY_PURPOSE_AGREE = 256Used for key agreement.

OH_Huks_KeyDigest

enum OH_Huks_KeyDigest

Description

Enumerates the digest algorithms.

Since: 9

EnumDescription
OH_HUKS_DIGEST_NONE = 0No digest algorithm.
OH_HUKS_DIGEST_MD5 = 1MD5.
OH_HUKS_DIGEST_SM3 = 2SM3.
OH_HUKS_DIGEST_SHA1 = 10SHA-1.
OH_HUKS_DIGEST_SHA224 = 11SHA-224.
OH_HUKS_DIGEST_SHA256 = 12SHA-256.
OH_HUKS_DIGEST_SHA384 = 13SHA-384.
OH_HUKS_DIGEST_SHA512 = 14SHA-512.

OH_Huks_KeyPadding

enum OH_Huks_KeyPadding

Description

Enumerates the padding algorithm types.

Since: 9

EnumDescription
OH_HUKS_PADDING_NONE = 0No padding algorithm.
OH_HUKS_PADDING_OAEP = 1OAEP.
OH_HUKS_PADDING_PSS = 2PSS.
OH_HUKS_PADDING_PKCS1_V1_5 = 3PKCS1_V1_5.
OH_HUKS_PADDING_PKCS5 = 4PKCS #5.
OH_HUKS_PADDING_PKCS7 = 5PKCS #7.
OH_HUKS_PADDING_ISO_IEC_9796_2 = 6ISO IEC 9796-2.
Since: 18
OH_HUKS_PADDING_ISO_IEC_9797_1 = 7ISO IEC 9797-1.
Since: 18

OH_Huks_CipherMode

enum OH_Huks_CipherMode

Description

Cipher mode.

Since: 9

EnumDescription
OH_HUKS_MODE_ECB = 1ECB.
OH_HUKS_MODE_CBC = 2CBC.
OH_HUKS_MODE_CTR = 3CTR.
OH_HUKS_MODE_OFB = 4OFB.
OH_HUKS_MODE_CFB = 5CFB.
Since: 12
OH_HUKS_MODE_CCM = 31CCM.
OH_HUKS_MODE_GCM = 32GCM.

OH_Huks_KeySize

enum OH_Huks_KeySize

Description

Enumerates the key sizes of different algorithms.

Since: 9

EnumDescription
OH_HUKS_RSA_KEY_SIZE_512 = 512RSA key of 512 bits.
OH_HUKS_RSA_KEY_SIZE_768 = 768RSA key of 768 bits.
OH_HUKS_RSA_KEY_SIZE_1024 = 1024RSA key of 1024 bits.
OH_HUKS_RSA_KEY_SIZE_2048 = 2048RSA key of 2048 bits.
OH_HUKS_RSA_KEY_SIZE_3072 = 3072RSA key of 3072 bits.
OH_HUKS_RSA_KEY_SIZE_4096 = 4096RSA key of 4096 bits.
OH_HUKS_ECC_KEY_SIZE_224 = 224ECC key of 224 bits.
OH_HUKS_ECC_KEY_SIZE_256 = 256ECC key of 256 bits.
OH_HUKS_ECC_KEY_SIZE_384 = 384ECC key of 384 bits.
OH_HUKS_ECC_KEY_SIZE_521 = 521ECC key of 521 bits.
OH_HUKS_AES_KEY_SIZE_128 = 128AES key of 128 bits.
OH_HUKS_AES_KEY_SIZE_192 = 192AES key of 192 bits.
OH_HUKS_AES_KEY_SIZE_256 = 256AES key of 256 bits.
OH_HUKS_AES_KEY_SIZE_512 = 512AES key of 512 bits.
OH_HUKS_CURVE25519_KEY_SIZE_256 = 256Curve25519 key of 256 bits.
OH_HUKS_DH_KEY_SIZE_2048 = 2048DH key of 2048 bits.
OH_HUKS_DH_KEY_SIZE_3072 = 3072DH key of 3072 bits.
OH_HUKS_DH_KEY_SIZE_4096 = 4096DH key of 4096 bits.
OH_HUKS_SM2_KEY_SIZE_256 = 256SM2 key of 256 bits.
OH_HUKS_SM4_KEY_SIZE_128 = 128SM4 key of 128 bits.
OH_HUKS_DES_KEY_SIZE_64 = 64DES key of 64 bits.
Since: 18
OH_HUKS_3DES_KEY_SIZE_128 = 1283DES key of 128 bits.
Since: 18
OH_HUKS_3DES_KEY_SIZE_192 = 1923DES key of 192 bits.
Since: 18

OH_Huks_KeyAlg

enum OH_Huks_KeyAlg

Description

Enumerates the algorithms for keys.

Since: 9

EnumDescription
OH_HUKS_ALG_RSA = 1RSA.
OH_HUKS_ALG_ECC = 2ECC.
OH_HUKS_ALG_DSA = 3DSA.
OH_HUKS_ALG_AES = 20Advanced Encryption Standard (AES).
OH_HUKS_ALG_HMAC = 50HMAC algorithm.
OH_HUKS_ALG_HKDF = 51HKDF.
OH_HUKS_ALG_PBKDF2 = 52PBKDF2.
OH_HUKS_ALG_ECDH = 100ECDH.
OH_HUKS_ALG_X25519 = 101X25519.
OH_HUKS_ALG_ED25519 = 102Ed25519.
OH_HUKS_ALG_DH = 103DH.
OH_HUKS_ALG_SM2 = 150ShangMi2 (SM2).
OH_HUKS_ALG_SM3 = 151SM3.
OH_HUKS_ALG_SM4 = 152SM4.
OH_HUKS_ALG_DES = 160DES.
Since: 18
OH_HUKS_ALG_3DES = 1613DES.
Since: 18
OH_HUKS_ALG_CMAC = 162CMAC.
Since: 18

OH_Huks_AlgSuite

enum OH_Huks_AlgSuite

Description

Enumerates the algorithm suites that can be used for importing of a key in ciphertext.

Key material format for OH_HUKS_UNWRAP_SUITE_X25519_AES_256_GCM_NOPADDING:

|x25519_plain_pubkey_length  (4 Byte)|x25519_plain_pubkey| agreekey_aad_length (4 Byte)|agreekey_aad
|  agreekey_nonce_length     (4 Byte)|  agreekey_nonce  |agreekey_aead_tag_len(4 Byte)|agreekey_aead_tag 
|   kek_enc_data_length      (4 Byte)|   kek_enc_data   |   kek_aad_length    (4 Byte)|kek_aad     
|     kek_nonce_length       (4 Byte)|     kek_nonce    |  kek_aead_tag_len   (4 Byte)|kek_aead_tag
|  key_material_size_len     (4 Byte)| key_material_size|  key_mat_enc_length (4 Byte)|key_mat_enc_data

Key material format for OH_HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING:

| ECC_plain_pubkey_length    (4 Byte)| ECC_plain_pubkey | agreekey_aad_length (4 Byte)|agreekey_aad
|  agreekey_nonce_length     (4 Byte)|  agreekey_nonce  |agreekey_aead_tag_len(4 Byte)|agreekey_aead_tag
|   kek_enc_data_length      (4 Byte)|   kek_enc_data   |   kek_aad_length    (4 Byte)|kek_aad 
|     kek_nonce_length       (4 Byte)|     kek_nonce    |  kek_aead_tag_len   (4 Byte)|kek_aead_tag 
|  key_material_size_len     (4 Byte)| key_material_size|  key_mat_enc_length (4 Byte)|key_mat_enc_data

Key material format for OH_HUKS_UNWRAP_SUITE_SM2_SM4_ECB_NOPADDING:

|kek_SM4_enc_length (4 Byte)|EN_SM4_key|importkey_enc_length (4 Byte)|importkey_enc|

Since: 9

EnumDescription
OH_HUKS_UNWRAP_SUITE_X25519_AES_256_GCM_NOPADDING = 1Key material in Length-Value format, using X25519 for key agreement and AES-256-GCM for encryption and decryption. For details about the material format, see the preceding description.
OH_HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING = 2Key material in Length-Value format, using ECDH-p256 for key agreement and AES-256-GCM for encryption and decryption. For details about the material format, see the preceding description.
OH_HUKS_UNWRAP_SUITE_SM2_SM4_ECB_NOPADDING = 5Key material in Length-Value format, using the temporary SM4 key to encrypt the imported key and using the SM2 key that has been imported to HUKS to encrypt the SM4 key. For details about the material format, see the preceding description.
Since: 23

OH_Huks_KeyGenerateType

enum OH_Huks_KeyGenerateType

Description

Enumerates the types of the key generated.

Since: 9

EnumDescription
OH_HUKS_KEY_GENERATE_TYPE_DEFAULT = 0Key generated by default.
OH_HUKS_KEY_GENERATE_TYPE_DERIVE = 1Derived key.
OH_HUKS_KEY_GENERATE_TYPE_AGREE = 2Key generated by key agreement.

OH_Huks_KeyFlag

enum OH_Huks_KeyFlag

Description

Enumerates the key generation types.

Since: 9

EnumDescription
OH_HUKS_KEY_FLAG_IMPORT_KEY = 1Import a public key using a function.
OH_HUKS_KEY_FLAG_GENERATE_KEY = 2Generate a key by using a function.
OH_HUKS_KEY_FLAG_AGREE_KEY = 3Generate a key by using a key agreement function.
OH_HUKS_KEY_FLAG_DERIVE_KEY = 4Derive a key by using a function.

OH_Huks_KeyStorageType

enum OH_Huks_KeyStorageType

Description

Enumerates the key storage types.

Since: 9

EnumDescription
OH_HUKS_STORAGE_TEMP = 0Return the key to the service via the API.
OH_HUKS_STORAGE_PERSISTENT = 1Store the key in HUKS.
OH_HUKS_STORAGE_ONLY_USED_IN_HUKS = 2Store the key generated from key derivation or key agreement in HUKS.
OH_HUKS_STORAGE_KEY_EXPORT_ALLOWED = 3Return the key generated from key derivation or key agreement to the service.

OH_Huks_ImportKeyType

enum OH_Huks_ImportKeyType

Description

Enumerates the types of the key to import. By default, a public key is imported. This field is not required when a symmetric key is imported.

Since: 9

EnumDescription
OH_HUKS_KEY_TYPE_PUBLIC_KEY = 0Public key.
OH_HUKS_KEY_TYPE_PRIVATE_KEY = 1Private key.
OH_HUKS_KEY_TYPE_KEY_PAIR = 2Public and private key pair.

OH_Huks_RsaPssSaltLenType

enum OH_Huks_RsaPssSaltLenType

Description

Enumerates the length types of the salt value in PSS padding mode.

Since: 10

EnumDescription
OH_HUKS_RSA_PSS_SALT_LEN_DIGEST = 0The salt length is set to the digest length.
OH_HUKS_RSA_PSS_SALT_LEN_MAX = 1The salt length is set to the maximum length.

OH_Huks_ErrCode

enum OH_Huks_ErrCode

Description

Enumerates error codes.

Since: 9

EnumDescription
OH_HUKS_SUCCESS = 0Success.
OH_HUKS_ERR_CODE_PERMISSION_FAIL = 201Permission verification failed.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401Invalid parameter (universal).
OH_HUKS_ERR_CODE_NOT_SUPPORTED_API = 801The API is not supported.
OH_HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED = 12000001The feature is not supported.
OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT = 12000002Key algorithm parameters are missing.
OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT = 12000003Invalid key algorithm parameter.
OH_HUKS_ERR_CODE_FILE_OPERATION_FAIL = 12000004File operation failed.
OH_HUKS_ERR_CODE_COMMUNICATION_FAIL = 12000005The process communication failed.
OH_HUKS_ERR_CODE_CRYPTO_FAIL = 12000006Crypto operation failed.
OH_HUKS_ERR_CODE_KEY_AUTH_PERMANENTLY_INVALIDATED = 12000007Failed to access the key because the key has expired.
OH_HUKS_ERR_CODE_KEY_AUTH_VERIFY_FAILED = 12000008Failed to access the key because the authentication has failed.
OH_HUKS_ERR_CODE_KEY_AUTH_TIME_OUT = 12000009Key access timed out.
OH_HUKS_ERR_CODE_SESSION_LIMIT = 12000010The number of key operation sessions has reached the limit.
OH_HUKS_ERR_CODE_ITEM_NOT_EXIST = 12000011The entity does not exist.
OH_HUKS_ERR_CODE_INTERNAL_ERROR = 12000012Internal error.
OH_HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST = 12000013The authentication credential does not exist.
OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014Insufficient memory.
OH_HUKS_ERR_CODE_CALL_SERVICE_FAILED = 12000015Failed to invoke the service.
OH_HUKS_ERR_CODE_DEVICE_PASSWORD_UNSET = 12000016The lock screen password required is not set.
Since: 11
OH_HUKS_ERR_CODE_KEY_ALREADY_EXIST = 12000017A key with the same name already exists.
Since: 20
OH_HUKS_ERR_CODE_INVALID_ARGUMENT = 12000018An input parameter is invalid.
Since: 20
OH_HUKS_ERR_CODE_ITEM_EXISTS = 12000019The entity already exists.
Since: 22
OH_HUKS_ERR_CODE_EXTERNAL_MODULE = 12000020The provider or Ukey internal execution fails.
Since: 22
OH_HUKS_ERR_CODE_PIN_LOCKED = 12000021PIN locked.
Since: 22
OH_HUKS_ERR_CODE_PIN_INCORRECT = 12000022Incorrect PIN.
Since: 22
OH_HUKS_ERR_CODE_PIN_NO_AUTH = 12000023PIN authentication fails.
Since: 22
OH_HUKS_ERR_CODE_BUSY = 12000024The provider or Ukey resources are being used.
Since: 22
OH_HUKS_ERR_CODE_EXCEED_LIMIT = 12000025The resource limit is exceeded.
Since: 22

OH_Huks_TagType

enum OH_Huks_TagType

Description

Enumerates the types of the parameters in a parameter set.

Since: 9

EnumDescription
OH_HUKS_TAG_TYPE_INVALID = 0 << 28Invalid tag type.
OH_HUKS_TAG_TYPE_INT = 1 << 28int32_t.
OH_HUKS_TAG_TYPE_UINT = 2 << 28uin32_t.
OH_HUKS_TAG_TYPE_ULONG = 3 << 28uin64_t.
OH_HUKS_TAG_TYPE_BOOL = 4 << 28Boolean.
OH_HUKS_TAG_TYPE_BYTES = 5 << 28OH_Huks_Blob.

Reference:

OH_Huks_Param

OH_Huks_UserAuthType

enum OH_Huks_UserAuthType

Description

Enumerates the user authentication types in key access control.

Since: 9

EnumDescription
OH_HUKS_USER_AUTH_TYPE_FINGERPRINT = 1 << 0Fingerprint authentication.
OH_HUKS_USER_AUTH_TYPE_FACE = 1 << 1Facial authentication.
OH_HUKS_USER_AUTH_TYPE_PIN = 1 << 2PIN authentication.
OH_HUKS_USER_AUTH_TYPE_TUI_PIN = 1 << 5TUI PIN authentication.
Since: 20

OH_Huks_AuthAccessType

enum OH_Huks_AuthAccessType

Description

Enumerates the rules for invalidating a key.

Since: 9

EnumDescription
OH_HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD = 1 << 0The key becomes invalid after the password is cleared.
OH_HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL = 1 << 1The key becomes invalid after a new biometric feature is enrolled.
OH_HUKS_AUTH_ACCESS_ALWAYS_VALID = 1 << 2The key is always valid.
Since: 11

OH_Huks_AuthStorageLevel

enum OH_Huks_AuthStorageLevel

Description

Enumerates the security levels for storing the key generated or imported.

Since: 11

EnumDescription
OH_HUKS_AUTH_STORAGE_LEVEL_DE = 0The key can be accessed only after the device is started.
OH_HUKS_AUTH_STORAGE_LEVEL_CE = 1The key can be accessed only after the first unlock of the device.
OH_HUKS_AUTH_STORAGE_LEVEL_ECE = 2The key can be accessed only when the device is unlocked.

NOTE

When using a key whose storage level is ECE, you are advised to clear the session resources created using the key by detecting the lock screen event to ensure security.

OH_Huks_ChallengeType

enum OH_Huks_ChallengeType

Description

Enumerates the types of the challenge generated when a key is used.

Since: 9

EnumDescription
OH_HUKS_CHALLENGE_TYPE_NORMAL = 0Normal challenge, which is of 32 bytes by default.
OH_HUKS_CHALLENGE_TYPE_CUSTOM = 1Custom challenge, which supports one-time authentication for multiple keys. The valid value of a custom challenge is of 8 bytes.
OH_HUKS_CHALLENGE_TYPE_NONE = 2Challenge is not required.

Reference:

OH_Huks_ChallengePosition

OH_Huks_UserAuthMode

enum OH_Huks_UserAuthMode

Description

Enumerates the user authentication modes in key access control.

Since: 12

EnumDescription
OH_HUKS_USER_AUTH_MODE_LOCAL = 0Local authentication.
OH_HUKS_USER_AUTH_MODE_COAUTH = 1Cross-device collaborative authentication.

OH_Huks_ChallengePosition

enum OH_Huks_ChallengePosition

Description

Enumerates the positions of the 8-byte valid value in a custom challenge generated.

Since: 9

EnumDescription
OH_HUKS_CHALLENGE_POS_0 = 0Bytes 0 to 7.
OH_HUKS_CHALLENGE_POS_1Bytes 8 to 15.
OH_HUKS_CHALLENGE_POS_2Bytes 16 to 23.
OH_HUKS_CHALLENGE_POS_3Bytes 24 to 31.

OH_Huks_SecureSignType

enum OH_Huks_SecureSignType

Description

Enumerates the signature types of the key generated or imported.

Since: 9

EnumDescription
OH_HUKS_SECURE_SIGN_WITH_AUTHINFO = 1The signature carries authentication information. This field is specified when a key is generated or imported. When the key is used for signing, the data will be added with the authentication information and then be signed. Note: The carried authentication information includes identity information. You need to describe the purpose, retention policy, and destruction method of the identity information in the privacy statement.

OH_Huks_KeyClassType

enum OH_Huks_KeyClassType

Description

Key type.

Since: 22

EnumDescription
OH_HUKS_KEY_CLASS_DEFAULT = 0Default type. The key is stored in HUKS.
OH_HUKS_KEY_CLASS_EXTENSION = 1The key is stored in the external encryption provider.

OH_Huks_KeyWrapType

enum OH_Huks_KeyWrapType

Description

Enumerates the wrap type of the key generated or imported.

Since: 20

EnumDescription
OH_HUKS_KEY_WRAP_TYPE_HUK_BASED = 2Wrap type of the unique hardware key.

OH_Huks_Tag

enum OH_Huks_Tag

Description

Enumerates the tags contained in a parameter set.
1 to 200: key parameter tag values.
301 to 500: tag values related to access control and authentication of key usage.
501 to 600: tag values related to key authentication.
601 to 1000: reserved values for other types of tag values.
1001 to 9999: extended tag values.
11000 to 12000: reserved values.
20001 to N: reserved tag values.

Since: 9

EnumDescription
OH_HUKS_TAG_ALGORITHM = OH_HUKS_TAG_TYPE_UINT |1Algorithm type.
OH_HUKS_TAG_PURPOSE = OH_HUKS_TAG_TYPE_UINT |2Key purpose.
OH_HUKS_TAG_KEY_SIZE = OH_HUKS_TAG_TYPE_UINT |3Key length.
OH_HUKS_TAG_DIGEST = OH_HUKS_TAG_TYPE_UINT |4Digest algorithm.
OH_HUKS_TAG_PADDING = OH_HUKS_TAG_TYPE_UINT |5Padding algorithm.
OH_HUKS_TAG_BLOCK_MODE = OH_HUKS_TAG_TYPE_UINT |6Cipher mode.
OH_HUKS_TAG_KEY_TYPE = OH_HUKS_TAG_TYPE_UINT |7Key type.
OH_HUKS_TAG_ASSOCIATED_DATA = OH_HUKS_TAG_TYPE_BYTES |8Associated authentication data.
OH_HUKS_TAG_NONCE = OH_HUKS_TAG_TYPE_BYTES |9NONCE field for key encryption and decryption.
OH_HUKS_TAG_IV = OH_HUKS_TAG_TYPE_BYTES |10Initialized vector (IV).
OH_HUKS_TAG_INFO = OH_HUKS_TAG_TYPE_BYTES |11Information generated during key derivation.
OH_HUKS_TAG_SALT = OH_HUKS_TAG_TYPE_BYTES |12Salt value used for key derivation.
OH_HUKS_TAG_ITERATION = OH_HUKS_TAG_TYPE_UINT |14Number of iterations for key derivation.
OH_HUKS_TAG_KEY_GENERATE_TYPE = OH_HUKS_TAG_TYPE_UINT |15Type of the generated key. For details, see OH_Huks_KeyGenerateType.
OH_HUKS_TAG_AGREE_ALG = OH_HUKS_TAG_TYPE_UINT |19Algorithm used in key agreement.
OH_HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS = OH_HUKS_TAG_TYPE_BOOL |20Alias of the public key used for key agreement.
OH_HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS = OH_HUKS_TAG_TYPE_BYTES |21Alias of the private key used for key agreement.
OH_HUKS_TAG_AGREE_PUBLIC_KEY = OH_HUKS_TAG_TYPE_BYTES |22Public key used for key agreement.
OH_HUKS_TAG_KEY_ALIAS = OH_HUKS_TAG_TYPE_BYTES |23Key alias.
OH_HUKS_TAG_DERIVE_KEY_SIZE = OH_HUKS_TAG_TYPE_UINT |24Size of the derived key.
OH_HUKS_TAG_IMPORT_KEY_TYPE = OH_HUKS_TAG_TYPE_UINT |25Type of the imported key. For details, see OH_Huks_ImportKeyType.
OH_HUKS_TAG_UNWRAP_ALGORITHM_SUITE = OH_HUKS_TAG_TYPE_UINT |26Algorithm suite used for importing a key in ciphertext.
OH_HUKS_TAG_DERIVED_AGREED_KEY_STORAGE_FLAG = OH_HUKS_TAG_TYPE_UINT |29Storage type of the derived key or key produced after key agreement. For details, see OH_Huks_KeyStorageType.
OH_HUKS_TAG_RSA_PSS_SALT_LEN_TYPE = OH_HUKS_TAG_TYPE_UINT |30Salt length type when the PSS padding mode is used with the RSA algorithm.
OH_HUKS_TAG_ALL_USERS = OH_HUKS_TAG_TYPE_BOOL |301All users in the multi-user scenario.
OH_HUKS_TAG_USER_ID = OH_HUKS_TAG_TYPE_UINT |302Multi-user ID.
OH_HUKS_TAG_NO_AUTH_REQUIRED = OH_HUKS_TAG_TYPE_BOOL |303Whether key access control is required.
OH_HUKS_TAG_USER_AUTH_TYPE = OH_HUKS_TAG_TYPE_UINT |304User authentication type in key access control.
OH_HUKS_TAG_AUTH_TIMEOUT = OH_HUKS_TAG_TYPE_UINT |305Timeout duration for key access.
OH_HUKS_TAG_AUTH_TOKEN = OH_HUKS_TAG_TYPE_BYTES |306Authentication token for the key.
OH_HUKS_TAG_KEY_AUTH_ACCESS_TYPE = OH_HUKS_TAG_TYPE_UINT |307Key access control type, which must be set together with the user authentication type. For details, see OH_Huks_AuthAccessType.
OH_HUKS_TAG_KEY_SECURE_SIGN_TYPE = OH_HUKS_TAG_TYPE_UINT |308Signature type of the key generated or imported.
OH_HUKS_TAG_CHALLENGE_TYPE = OH_HUKS_TAG_TYPE_UINT |309Challenge type. For details, see OH_Huks_ChallengeType.
OH_HUKS_TAG_CHALLENGE_POS = OH_HUKS_TAG_TYPE_UINT |310Position of the 8-byte valid value in a custom challenge. For details, see OH_Huks_ChallengePosition.
OH_HUKS_TAG_KEY_AUTH_PURPOSE = OH_HUKS_TAG_TYPE_UINT |311Type of the key authentication purpose.
OH_HUKS_TAG_AUTH_STORAGE_LEVEL = OH_HUKS_TAG_TYPE_UINT |316Security levels for storing the key. For details, see OH_Huks_AuthStorageLevel.
Since: 11
OH_HUKS_TAG_USER_AUTH_MODE = OH_HUKS_TAG_TYPE_UINT |319User authentication mode in key access control. For details, see OH_Huks_UserAuthMode.
Since: 12
OH_HUKS_TAG_ATTESTATION_CHALLENGE = OH_HUKS_TAG_TYPE_BYTES |501Challenge value used in the attestation.
OH_HUKS_TAG_ATTESTATION_APPLICATION_ID = OH_HUKS_TAG_TYPE_BYTES |502ID of the application, to which the key belongs, in key attestation.
OH_HUKS_TAG_ATTESTATION_ID_ALIAS = OH_HUKS_TAG_TYPE_BYTES |511Alias used in key attestation.
OH_HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO = OH_HUKS_TAG_TYPE_BYTES |514Security level used in key attestation.
OH_HUKS_TAG_ATTESTATION_ID_VERSION_INFO = OH_HUKS_TAG_TYPE_BYTES |515Version information used in key attestation.
OH_HUKS_TAG_KEY_OVERRIDE = OH_HUKS_TAG_TYPE_BOOL |520Whether to overwrite the key with the same name.
Since: 20
OH_HUKS_TAG_AE_TAG_LEN = OH_HUKS_TAG_TYPE_UINT |521AEAD length in CCM mode.
Since: 22
OH_HUKS_TAG_KEY_CLASS = OH_HUKS_TAG_TYPE_UINT |522Key type, which is used to distinguish the key managed by HUKS on the device from the key stored in an external device.
Since: 22
OH_HUKS_TAG_KEY_ACCESS_GROUP = OH_HUKS_TAG_TYPE_BYTES |523Group ID. Keys can be shared among the same group of developers with the same developer ID.
Since: 23
OH_HUKS_TAG_IS_KEY_ALIAS = OH_HUKS_TAG_TYPE_BOOL |1001Whether it is a key alias.
OH_HUKS_TAG_KEY_STORAGE_FLAG = OH_HUKS_TAG_TYPE_UINT |1002Key storage mode. For details, see OH_Huks_KeyStorageType.
OH_HUKS_TAG_IS_ALLOWED_WRAP = OH_HUKS_TAG_TYPE_BOOL |1003Whether to allow the key to be wrapped.
OH_HUKS_TAG_KEY_WRAP_TYPE = OH_HUKS_TAG_TYPE_UINT |1004Key wrap type.
OH_HUKS_TAG_KEY_AUTH_ID = OH_HUKS_TAG_TYPE_BYTES |1005Authentication ID.
OH_HUKS_TAG_KEY_ROLE = OH_HUKS_TAG_TYPE_UINT |1006Role of the key.
OH_HUKS_TAG_KEY_FLAG = OH_HUKS_TAG_TYPE_UINT |1007Key flag. For details, see OH_Huks_KeyFlag.
OH_HUKS_TAG_IS_ASYNCHRONIZED = OH_HUKS_TAG_TYPE_UINT |1008Whether the invocation is asynchronous.
OH_HUKS_TAG_KEY_DOMAIN = OH_HUKS_TAG_TYPE_UINT |1011Key domain.
OH_HUKS_TAG_IS_DEVICE_PASSWORD_SET = OH_HUKS_TAG_TYPE_BOOL |1012Whether the key is accessible only when the user sets a lock screen password.
True indicates that the key can be generated and used only when a password is set.
Since: 11
OH_HUKS_TAG_AE_TAG = OH_HUKS_TAG_TYPE_BYTES |10009AEAD in GCM mode.
OH_HUKS_TAG_SYMMETRIC_KEY_DATA = OH_HUKS_TAG_TYPE_BYTES |20001Symmetric key data.
OH_HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA = OH_HUKS_TAG_TYPE_BYTES |20002Public key data of the asymmetric key pair.
OH_HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA = OH_HUKS_TAG_TYPE_BYTES |20003Private key data of the asymmetric key pair.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 js-apis-huksExternalCrypto-sys

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-keymaterialrsa

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-result

openharmony 鸿蒙 js-apis-CryptoExtensionAbility

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-pubkeyinfo

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-certchain

openharmony 鸿蒙 js-apis-huksExternalCrypto

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-keymaterialdsa

openharmony 鸿蒙 capi-hukstypeapi

openharmony 鸿蒙 errorcode-huks

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