智能客服
你问我答,随时在线为你解决问题

























- import { bundleManager } from '@kit.AbilityKit';
- import { hilog } from '@kit.PerformanceAnalysisKit';
- import { BusinessError } from '@kit.BasicServicesKit';
-
- let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO;
- try {
- bundleManager.getBundleInfoForSelf(bundleFlags).then((data) => {
- hilog.info(0x0000, 'testTag', 'getBundleInfoForSelf successfully. Data: %{public}s', JSON.stringify(data));
- // In the data, you can obtain the signtureInfo, which is the signature certificate information of the application
- }).catch((err: BusinessError) => {
- hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed. Cause: %{public}s', err.message);
- });
- } catch (err) {
- let message = (err as BusinessError).message;
- hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed: %{public}s', message);
- }
- import { common } from '@kit.AbilityKit';
- import { BusinessError } from '@kit.BasicServicesKit';
- import { hash } from '@kit.CoreFileKit';
-
- let context = AppStorage.get("context") as common.UIAbilityContext;
- let pathDir = context.filesDir;
-
- let filePath = pathDir + "/test.txt";
- hash.hash(filePath, "sha256").then((str: string) => {
- console.info("calculate file hash succeed:" + str);
- }).catch((err: BusinessError) => {
- console.error("calculate file hash failed with error message: " + err.message + ", error code: " + err.code);
- });
参考链接
智能客服
你问我答,随时在线为你解决问题
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功