diff --git a/Security/UniversalKeystoreKit/CMAC/.gitignore b/Security/UniversalKeystoreKit/CMAC/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/AppScope/app.json5 b/Security/UniversalKeystoreKit/CMAC/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..0e31bca1bb36bb56809338335ae8f466b68c84a1
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.CMAC",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/Security/UniversalKeystoreKit/CMAC/AppScope/resources/base/element/string.json b/Security/UniversalKeystoreKit/CMAC/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..7712bfee31fc9f657a614da9d6a19b36c85baa9d
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "CMAC"
+ }
+ ]
+}
diff --git a/Security/UniversalKeystoreKit/CMAC/AppScope/resources/base/media/app_icon.png b/Security/UniversalKeystoreKit/CMAC/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/Security/UniversalKeystoreKit/CMAC/AppScope/resources/base/media/app_icon.png differ
diff --git a/Security/UniversalKeystoreKit/CMAC/README.md b/Security/UniversalKeystoreKit/CMAC/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..1e7608fcfe231d5e72424e5b5957a311232173be
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/README.md
@@ -0,0 +1,87 @@
+## 生成密钥(ArkTS)
+
+### 介绍
+
+1. 本工程实现了对以下 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/UniversalKeystoreKit/huks-key-generation-arkts.md 示例代码片段的工程化,主要目标是实现指南中示例代码需要与sample工程文件同源。
+
+#### Call ArkTS
+
+##### 介绍
+
+1. 本示例主要介绍生成密钥,以生成DH密钥为例生成随机密钥,指定待生成的密钥别名keyAlias。
+
+##### 效果预览
+
+| 主页 | |
+| ---------------------------------------------------- | ---------------------------------------------------- |
+|
|
|
+
+使用说明
+
+1. 点击Call ArkTS按钮调用huks.generateKeyItem,传入密钥别名和密钥属性集,生成密钥。
+
+## 生成密钥(C/C++)
+
+### 介绍
+
+1. 本工程实现了对以下示例代码片段的工程化,目标是实现指南中示例代码与sample工程文件同源。示例代码来源:https://gitee.com/openharmony/docs/blob/OpenHarmony-5.0.1-Release/zh-cn/application-dev/security/UniversalKeystoreKit/huks-key-generation-ndk.md
+
+#### Call C/C++
+
+##### 介绍
+
+1. 本示例主要介绍生成密钥,以生成ECC密钥为例,生成随机密钥。
+
+##### 效果预览
+
+| 主页 | |
+| -------------------------------------------------- | -------------------------------------------------- |
+|
|
|
+
+使用说明
+
+1. 点击Call C/C++按钮调用OH_Huks_GenerateKeyItem,传入密钥别名和密钥属性集,生成密钥。
+
+## 工程目录
+
+```
+entry/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---Index.ets // 首页
+|---cpp
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---GenerateKey.test.ets // 自动化测试用例
+```
+
+
+## 相关权限
+
+无。
+
+## 依赖
+
+不涉及。
+
+## 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:RK3568。
+2. 本示例支持API14版本SDK,SDK版本号(API Version 14 Release)。
+3. 本示例需要使用DevEco Studio 版本号(5.0.1Release)才可编译运行。
+
+## 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo code/DocsSample/Security/UniversalKeystoreKit/KeyGenerationImport/KeyGeneration/DevelopmentGuidelines/GenerateKey > .git/info/sparse-checkout
+git remote add origin https://gitee.com/openharmony/applications_app_samples.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/build-profile.json5 b/Security/UniversalKeystoreKit/CMAC/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..a515b0108ca94fd9d2bf77a9617ad8cbcfb66d07
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/build-profile.json5
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compileSdkVersion": 20,
+ "compatibleSdkVersion": 20,
+ "targetSdkVersion": 20,
+ "runtimeOS": "OpenHarmony",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/code-linter.json5 b/Security/UniversalKeystoreKit/CMAC/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/code-linter.json5
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ }
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/.gitignore b/Security/UniversalKeystoreKit/CMAC/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/build-profile.json5 b/Security/UniversalKeystoreKit/CMAC/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..31862257476bc8403e59fa42b4c924974d7dbe03
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/build-profile.json5
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "externalNativeOptions": {
+ "path": "./src/main/cpp/CMakeLists.txt",
+ "arguments": "",
+ "cppFlags": "",
+ "abiFilters": [
+ "arm64-v8a",
+ "x86_64",
+ "armeabi-v7a"
+ ]
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ },
+ "nativeLib": {
+ "debugSymbol": {
+ "strip": true,
+ "exclude": []
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/hvigorfile.ts b/Security/UniversalKeystoreKit/CMAC/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/oh-package-lock.json5 b/Security/UniversalKeystoreKit/CMAC/entry/oh-package-lock.json5
new file mode 100644
index 0000000000000000000000000000000000000000..7c36300c3272430b97f5cda7cb1a835421298382
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/oh-package-lock.json5
@@ -0,0 +1,19 @@
+{
+ "meta": {
+ "stableOrder": true,
+ "enableUnifiedLockfile": false
+ },
+ "lockfileVersion": 3,
+ "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
+ "specifiers": {
+ "libentry.so@src/main/cpp/types/libentry": "libentry.so@src/main/cpp/types/libentry"
+ },
+ "packages": {
+ "libentry.so@src/main/cpp/types/libentry": {
+ "name": "libentry.so",
+ "version": "1.0.0",
+ "resolved": "src/main/cpp/types/libentry",
+ "registryType": "local"
+ }
+ }
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/oh-package.json5 b/Security/UniversalKeystoreKit/CMAC/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..118bdd4fe7699368a010e04c24f5bfc887cf1298
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/oh-package.json5
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "libentry.so": "file:./src/main/cpp/types/libentry"
+ }
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/CMakeLists.txt b/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0a6fa49673dd77e7b109b82e84f31911ec5b5e9f
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,15 @@
+# the minimum version of CMake.
+cmake_minimum_required(VERSION 3.5.0)
+project(GenerateKey)
+
+set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+if(DEFINED PACKAGE_FIND_FILE)
+ include(${PACKAGE_FIND_FILE})
+endif()
+
+include_directories(${NATIVERENDER_ROOT_PATH}
+ ${NATIVERENDER_ROOT_PATH}/include)
+
+add_library(entry SHARED napi_init.cpp)
+target_link_libraries(entry PUBLIC libace_napi.z.so libhuks_ndk.z.so)
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/napi_init.cpp b/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/napi_init.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..46bdd146757f1ac4959840a71747a5d92f57c330
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/napi_init.cpp
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start cmac_key]
+/* 以下以CMAC为例 */
+#include "huks/native_huks_api.h"
+#include "huks/native_huks_param.h"
+#include "huks/native_huks_type.h"
+#include "napi/native_api.h"
+#include
+
+static const uint32_t CMAC_COMMON_SIZE = 8;
+static const uint32_t IV_SIZE = 8;
+static uint8_t IV[IV_SIZE] = { 0 };
+
+OH_Huks_Result InitParamSet(struct OH_Huks_ParamSet **paramSet, const struct OH_Huks_Param *params,
+ uint32_t paramCount)
+{
+ OH_Huks_Result ret = OH_Huks_InitParamSet(paramSet);
+ if (ret.errorCode != OH_HUKS_SUCCESS) {
+ return ret;
+ }
+ ret = OH_Huks_AddParams(*paramSet, params, paramCount);
+ if (ret.errorCode != OH_HUKS_SUCCESS) {
+ OH_Huks_FreeParamSet(paramSet);
+ return ret;
+ }
+ ret = OH_Huks_BuildParamSet(paramSet);
+ if (ret.errorCode != OH_HUKS_SUCCESS) {
+ OH_Huks_FreeParamSet(paramSet);
+ return ret;
+ }
+ return ret;
+}
+
+static struct OH_Huks_Param g_genParams[] = {
+ {
+ .tag = OH_HUKS_TAG_ALGORITHM,
+ .uint32Param = OH_HUKS_ALG_3DES
+ }, {
+ .tag = OH_HUKS_TAG_KEY_SIZE,
+ .uint32Param = OH_HUKS_3DES_KEY_SIZE_128
+ }, {
+ .tag = OH_HUKS_TAG_PURPOSE,
+ .uint32Param = OH_HUKS_KEY_PURPOSE_MAC
+ }
+};
+
+static struct OH_Huks_Param g_cmacParams[] = {
+ {
+ .tag = OH_HUKS_TAG_ALGORITHM,
+ .uint32Param = OH_HUKS_ALG_CMAC
+ }, {
+ .tag = OH_HUKS_TAG_KEY_SIZE,
+ .uint32Param = OH_HUKS_3DES_KEY_SIZE_128
+ }, {
+ .tag = OH_HUKS_TAG_PURPOSE,
+ .uint32Param = OH_HUKS_KEY_PURPOSE_MAC
+ }, {
+ .tag = OH_HUKS_TAG_BLOCK_MODE,
+ .uint32Param = OH_HUKS_MODE_CBC
+ }, {
+ .tag = OH_HUKS_TAG_PADDING,
+ .uint32Param = OH_HUKS_PADDING_ISO_IEC_9797_1
+ }, {
+ .tag = OH_HUKS_TAG_IV,
+ .blob = {
+ .size = IV_SIZE,
+ .data = (uint8_t *)IV
+ }
+ }
+};
+
+OH_Huks_Result HksCmacTest(const struct OH_Huks_Blob *keyAlias, const struct OH_Huks_ParamSet *cmacParamSet,
+ const struct OH_Huks_Blob *inData, struct OH_Huks_Blob *outData)
+{
+ uint8_t handleE[sizeof(uint64_t)] = {0};
+ struct OH_Huks_Blob handle = {sizeof(uint64_t), handleE};
+ OH_Huks_Result ret = OH_Huks_InitSession(keyAlias, cmacParamSet, &handle, nullptr);
+ if (ret.errorCode != OH_HUKS_SUCCESS) {
+ return ret;
+ }
+ ret = OH_Huks_FinishSession(&handle, cmacParamSet, inData, outData);
+ return ret;
+}
+
+static napi_value CmacKey(napi_env env, napi_callback_info info)
+{
+ /* 1.确定密钥别名 */
+ char tmpKeyAlias[] = "test_cmac";
+ struct OH_Huks_Blob keyAlias = { (uint32_t)strlen(tmpKeyAlias), (uint8_t *)tmpKeyAlias };
+ struct OH_Huks_ParamSet *genParamSet = nullptr;
+ struct OH_Huks_ParamSet *cmacParamSet = nullptr;
+ OH_Huks_Result ohResult;
+ do {
+ /* 2.1 获取生成密钥算法参数配置 */
+ ohResult = InitParamSet(&genParamSet, g_genParams, sizeof(g_genParams) / sizeof(OH_Huks_Param));
+ if (ohResult.errorCode != OH_HUKS_SUCCESS) {
+ break;
+ }
+ /* 2.2 调用OH_Huks_GenerateKeyItem */
+ ohResult = OH_Huks_GenerateKeyItem(&keyAlias, genParamSet, nullptr);
+ if (ohResult.errorCode != OH_HUKS_SUCCESS) {
+ break;
+ }
+ /* 3.1. 获取CMAC算法参数配置 */
+ char tmpInData[] = "CMAC_INDATA";
+ struct OH_Huks_Blob inData = { (uint32_t)strlen(tmpInData), (uint8_t *)tmpInData };
+ uint8_t mac[CMAC_COMMON_SIZE] = { 0 };
+ struct OH_Huks_Blob macData = {CMAC_COMMON_SIZE, mac};
+ ohResult = InitParamSet(&cmacParamSet, g_cmacParams, sizeof(g_cmacParams) / sizeof(OH_Huks_Param));
+ if (ohResult.errorCode != OH_HUKS_SUCCESS) {
+ break;
+ }
+ /* 3.2 调用initSession和finishSession计算MAC */
+ ohResult = HksCmacTest(&keyAlias, cmacParamSet, &inData, &macData);
+ if (ohResult.errorCode != OH_HUKS_SUCCESS) {
+ break;
+ }
+ } while (0);
+ OH_Huks_FreeParamSet(&genParamSet);
+ OH_Huks_FreeParamSet(&cmacParamSet);
+
+ napi_value ret;
+ napi_create_int32(env, ohResult.errorCode, &ret);
+ return ret;
+}
+// [End cmac_key]
+
+EXTERN_C_START
+static napi_value Init(napi_env env, napi_value exports)
+{
+ napi_property_descriptor desc[] = {
+ {"cmacKey", nullptr, CmacKey, nullptr, nullptr, nullptr, napi_default, nullptr}};
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+EXTERN_C_END
+
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "entry",
+ .nm_priv = ((void *)0),
+ .reserved = {0},
+};
+
+extern "C" __attribute__((constructor)) void RegisterEntryModule(void) { napi_module_register(&demoModule); }
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/types/libentry/Index.d.ts b/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/types/libentry/Index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..574aa356dec66eb69b2e979c69922b5c2336da57
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/types/libentry/Index.d.ts
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export const cmacKey: () => number;
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/types/libentry/oh-package.json5 b/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/types/libentry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..6abf3b7c20f22c62aaac6a995a25cae672f73f35
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/cpp/types/libentry/oh-package.json5
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "libentry.so",
+ "types": "./Index.d.ts",
+ "version": "1.0.0",
+ "description": "Please describe the basic information."
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/ets/entryability/EntryAbility.ets b/Security/UniversalKeystoreKit/CMAC/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..965554bb3a331e2418180b86da1993baf5e8d536
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+};
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/Security/UniversalKeystoreKit/CMAC/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/ets/pages/Index.ets b/Security/UniversalKeystoreKit/CMAC/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..32aad51710c43325a6e7815eed1508b5cc062384
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start cmac_key_ar]
+
+import { huks } from '@kit.UniversalKeystoreKit';
+import { BusinessError } from "@kit.BasicServicesKit";
+import { cryptoFramework } from '@kit.CryptoArchitectureKit';
+import testNapi from 'libentry.so';
+
+/* 1.确定密钥别名 */
+let keyAlias = 'test_cmac';
+let handle: number;
+let plainText = '123456';
+let IV = cryptoFramework.createRandom().generateRandomSync(8).data;
+let macData: Uint8Array;
+
+function StringToUint8Array(str: String) {
+ let arr: number[] = new Array();
+ for (let i = 0, j = str.length; i < j; ++i) {
+ arr.push(str.charCodeAt(i));
+ }
+ return new Uint8Array(arr);
+}
+
+function Uint8ArrayToString(fileData: Uint8Array) {
+ let dataString = '';
+ for (let i = 0; i < fileData.length; i++) {
+ dataString += String.fromCharCode(fileData[i]);
+ }
+ return dataString;
+}
+
+/* 2.初始化密钥生成属性集 */
+function GenerateKeyProperties() {
+ const properties: Array = [{
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_3DES
+ }, {
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
+ value: huks.HuksKeySize.HUKS_3DES_KEY_SIZE_128
+ }, {
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC
+ }];
+ return properties;
+}
+
+/* 3.初始化CMAC属性集 */
+function GetCmacProperties() {
+ const properties: Array = [{
+ tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
+ value: huks.HuksKeyAlg.HUKS_ALG_CMAC
+ }, {
+ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
+ value: huks.HuksKeySize.HUKS_3DES_KEY_SIZE_128
+ }, {
+ tag: huks.HuksTag.HUKS_TAG_PURPOSE,
+ value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_MAC
+ }, {
+ tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
+ value: huks.HuksCipherMode.HUKS_MODE_CBC
+ }, {
+ tag: huks.HuksTag.HUKS_TAG_PADDING,
+ value: huks.HuksKeyPadding.HUKS_PADDING_ISO_IEC_9797_1
+ }, {
+ tag: huks.HuksTag.HUKS_TAG_IV,
+ value: IV
+ }];
+ return properties;
+}
+
+/* 4.生成密钥 */
+async function GenerateCmacKey() {
+ /* 4.1 获取生成密钥算法参数配置 */
+ let genProperties = GenerateKeyProperties();
+ let options: huks.HuksOptions = {
+ properties: genProperties
+ }
+ /* 4.2 调用generateKeyItem */
+ await huks.generateKeyItem(keyAlias, options)
+ .then(() => {
+ console.info(`promise: generate cmac key success`);
+ }).catch((error: BusinessError) => {
+ console.error(`promise: generate cmac key failed, errCode : ${error.code}, errMsg : ${error.message}`);
+ })
+}
+
+/* 5.执行CMAC操作 */
+async function CmacData() {
+ /* 5.1 获取CMAC算法参数配置 */
+ let cmacProperties = GetCmacProperties();
+ let options: huks.HuksOptions = {
+ properties: cmacProperties,
+ inData: StringToUint8Array(plainText)
+ }
+ /* 5.2 调用initSession获取handle */
+ await huks.initSession(keyAlias, options)
+ .then((data) => {
+ handle = data.handle;
+ }).catch((error: BusinessError) => {
+ console.error(`promise: init EncryptData failed, errCode : ${error.code}, errMsg : ${error.message}`);
+ })
+ /* 5.3 调用finishSession获取CMAC的结果 */
+ await huks.finishSession(handle, options)
+ .then((data) => {
+ macData = data.outData as Uint8Array;
+ console.info(`promise: cmac data success, data is ${Uint8ArrayToString(macData)}`);
+ }).catch((error: BusinessError) => {
+ console.error(`promise: cmac data failed, errCode : ${error.code}, errMsg : ${error.message}`);
+ })
+}
+
+async function testCMAC(): Promise {
+ await GenerateCmacKey();
+ await CmacData();
+ return 'Success';
+}
+
+// [End cmac_key_ar]
+
+@Entry
+@Component
+struct Index {
+ @State message: string = 'CMAC Key';
+
+ build() {
+ Column({ space: 5 }) {
+ Text(this.message)
+ .fontWeight(FontWeight.Regular)
+ .fontSize($r('sys.float.ohos_id_text_size_body1'))
+ .fontColor($r('sys.color.ohos_id_color_text_primary'))
+ .maxLines(Infinity)
+ .textAlign(TextAlign.Start)
+ Button($r('app.string.call_cpp'))
+ .padding('12vp')
+ .height('40vp')
+ .borderRadius($r('sys.float.ohos_id_corner_radius_button'))
+ .backgroundColor($r('sys.color.ohos_id_color_emphasize'))
+ .fontSize('14sp')
+ .fontColor('#ffffff')
+ .onClick(() => {
+ let ret: number = testNapi.cmacKey();
+ this.message = 'C/C++ Call Result: ' + ret.toString();
+ })
+ Button($r('app.string.call_arkts'))
+ .padding('12vp')
+ .height('40vp')
+ .borderRadius($r('sys.float.ohos_id_corner_radius_button'))
+ .backgroundColor($r('sys.color.ohos_id_color_emphasize'))
+ .fontSize('14sp')
+ .fontColor('#ffffff')
+ .onClick(async () => {
+ let ret = await testCMAC();
+ this.message = 'ArkTS Call Result: ' + ret;
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/module.json5 b/Security/UniversalKeystoreKit/CMAC/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..4144486d1af4c03b0d767cce1cda86fc0d697f91
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/module.json5
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/element/color.json b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/element/string.json b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..0d407cd54ed67189fa3533391a7441314a13326a
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,24 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "GenerateKey"
+ },
+ {
+ "name": "call_cpp",
+ "value": "Call C/C++"
+ },
+ {
+ "name": "call_arkts",
+ "value": "Call ArkTS"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/background.png b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/background.png differ
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/foreground.png b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/foreground.png differ
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/layered_image.json b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/startIcon.png b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/profile/backup_config.json b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/profile/main_pages.json b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/dark/element/color.json b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/dark/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/resources/dark/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#000000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/main/syscap.json b/Security/UniversalKeystoreKit/CMAC/entry/src/main/syscap.json
new file mode 100644
index 0000000000000000000000000000000000000000..58807ea39e11693ca27a86658ee91af45d5a1eca
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/main/syscap.json
@@ -0,0 +1,16 @@
+{
+ "devices": {
+ "general": ["default","tablet"]
+ },
+ "production": {
+ "removedSysCaps": [
+ "SystemCapability.HiviewDFX.HiDumper",
+ "SystemCapability.Multimedia.AVSession.ExtendedDisplayCast",
+ "SystemCapability.Security.DeviceSecurityLevel",
+ "SystemCapability.UserIAM.UserAuth.PinAuth",
+ "SystemCapability.Security.DeviceAuth",
+ "SystemCapability.Security.DataTransitManager",
+ "SystemCapability.Window.SessionManager"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/ets/test/Ability.test.ets b/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0f8ce9a2c012f8fe36114cef65216ef0b6254f41
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ })
+ })
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/ets/test/CmacKey.test.ets b/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/ets/test/CmacKey.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c858ce91652acb5ed1fa2cf8a12e9c3f693455a2
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/ets/test/CmacKey.test.ets
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, it, expect, beforeAll } from '@ohos/hypium';
+// 导入测试依赖kit
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+let want: Want;
+
+export default function cmacKeyTest() {
+ describe('cmacKeyTest', () => {
+ /**
+ * 打开应用
+ */
+ beforeAll(async () => {
+ want = {
+ bundleName: bundleName,
+ abilityName: 'EntryAbility'
+ };
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ await driver.delayMs(1000);
+ expect(ability.context.abilityInfo.name).assertEqual('EntryAbility');
+ })
+
+ /**
+ * 点击按钮,执行CMAC(C/C++)
+ */
+ it('testCmacKey001', 0, async () => {
+ console.info('uitest: testCmacKey001 begin');
+ const driver = Driver.create();
+ const button1 = await driver.findComponent(ON.text('Call C/C++'));
+ await driver.delayMs(1000);
+ await button1.click();
+ await driver.delayMs(1000);
+ console.info('uitest: testCmacKey001 end');
+ })
+
+ /**
+ * 点击按钮,执行CMAC(ArkTS)
+ */
+ it('testCmacKey002', 0, async () => {
+ console.info('uitest: testCmacKey002 begin');
+ const driver = Driver.create();
+ const button1 = await driver.findComponent(ON.text('Call ArkTS'));
+ await driver.delayMs(1000);
+ await button1.click();
+ await driver.delayMs(1000);
+ console.info('uitest: testCmacKey002 end');
+ })
+ })
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/ets/test/List.test.ets b/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..906c2094fe8519d0fcd566f0a910d2cf6399906d
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import cmacKeyTest from './CmacKey.test';
+
+export default function testsuite() {
+ cmacKeyTest();
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/module.json5 b/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c3fd9dda3040d888d9d8b0b62bcb5d3b6fbeb614
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/test/List.test.ets b/Security/UniversalKeystoreKit/CMAC/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f1186b1f53c3a70930921c5dbd1417332bec56c9
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/entry/src/test/LocalUnit.test.ets b/Security/UniversalKeystoreKit/CMAC/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7fc57c77dbf76d8df08a2b802a55b948e3fcf968
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/hvigor/hvigor-config.json5 b/Security/UniversalKeystoreKit/CMAC/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d584c19c247db9a7caee4b606bb931aa9279c637
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.1",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/Security/UniversalKeystoreKit/CMAC/hvigorfile.ts b/Security/UniversalKeystoreKit/CMAC/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/Security/UniversalKeystoreKit/CMAC/oh-package-lock.json5 b/Security/UniversalKeystoreKit/CMAC/oh-package-lock.json5
new file mode 100644
index 0000000000000000000000000000000000000000..5228468e42bf0223ddadb188bf2763b4afdb28e6
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/oh-package-lock.json5
@@ -0,0 +1,28 @@
+{
+ "meta": {
+ "stableOrder": true,
+ "enableUnifiedLockfile": false
+ },
+ "lockfileVersion": 3,
+ "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
+ "specifiers": {
+ "@ohos/hamock@1.0.0": "@ohos/hamock@1.0.0",
+ "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19"
+ },
+ "packages": {
+ "@ohos/hamock@1.0.0": {
+ "name": "@ohos/hamock",
+ "version": "1.0.0",
+ "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==",
+ "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hamock/-/hamock-1.0.0.har",
+ "registryType": "ohpm"
+ },
+ "@ohos/hypium@1.0.19": {
+ "name": "@ohos/hypium",
+ "version": "1.0.19",
+ "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==",
+ "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har",
+ "registryType": "ohpm"
+ }
+ }
+}
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/oh-package.json5 b/Security/UniversalKeystoreKit/CMAC/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e41bae026aab3b50d0abb42fece08ba43b4a772b
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.1",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.19",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/Security/UniversalKeystoreKit/CMAC/ohosTest.md b/Security/UniversalKeystoreKit/CMAC/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..583c36c6a168769ab28f354bed054cb4d2ca35ea
--- /dev/null
+++ b/Security/UniversalKeystoreKit/CMAC/ohosTest.md
@@ -0,0 +1,9 @@
+# CMAC测试用例归档
+
+## 用例表
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+|-----------------| ------------ | ---- | ---------------- | -------- | -------- |
+| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 是 | Pass |
+| 点击按钮,Call C/C++ | 成功拉起应用 | | 成功新增输出日志 | 是 | Pass |
+| 点击按钮,Call ArkTS | 成功拉起应用 | | 成功新增输出日志 | 是 | Pass |
\ No newline at end of file
diff --git a/Security/UniversalKeystoreKit/CMAC/screenshots/ArkTS_1.png b/Security/UniversalKeystoreKit/CMAC/screenshots/ArkTS_1.png
new file mode 100644
index 0000000000000000000000000000000000000000..504a5c10f6a9402a1b25348c5021d3a830c4dcc9
Binary files /dev/null and b/Security/UniversalKeystoreKit/CMAC/screenshots/ArkTS_1.png differ
diff --git a/Security/UniversalKeystoreKit/CMAC/screenshots/ArkTS_2.png b/Security/UniversalKeystoreKit/CMAC/screenshots/ArkTS_2.png
new file mode 100644
index 0000000000000000000000000000000000000000..d37a9524bc0b474eb583a0dd085e1d7080370bae
Binary files /dev/null and b/Security/UniversalKeystoreKit/CMAC/screenshots/ArkTS_2.png differ
diff --git a/Security/UniversalKeystoreKit/CMAC/screenshots/Cpp_1.png b/Security/UniversalKeystoreKit/CMAC/screenshots/Cpp_1.png
new file mode 100644
index 0000000000000000000000000000000000000000..504a5c10f6a9402a1b25348c5021d3a830c4dcc9
Binary files /dev/null and b/Security/UniversalKeystoreKit/CMAC/screenshots/Cpp_1.png differ
diff --git a/Security/UniversalKeystoreKit/CMAC/screenshots/Cpp_2.png b/Security/UniversalKeystoreKit/CMAC/screenshots/Cpp_2.png
new file mode 100644
index 0000000000000000000000000000000000000000..3fbc46b8d142e5de7e56f044eeb845e2d70ce08c
Binary files /dev/null and b/Security/UniversalKeystoreKit/CMAC/screenshots/Cpp_2.png differ