openharmony 鸿蒙 capi-dlp-permission-api-h

2026-08-25 浏览 (1)

dlp_permission_api.h

Overview

Defines the APIs for cross-device file access management, encrypted storage, and access authorization.

Library: libohdlp_permission.so

File to include: <DataProtectionKit/dlp_permission_api.h>

System capability: SystemCapability.Security.DataLossPrevention

Since: 14

Related module: DlpPermissionApi

Summary

Enums

Nametypedef KeywordDescription
DLP_ErrCodeDLP_ErrCodeEnumerates the DLP error codes.
DLP_FileAccessDLP_FileAccessEnumerates the permissions on a DLP file.

Functions

NameDescription
DLP_ErrCode OH_DLP_GetDlpPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t *flags)Obtains the permission information of this DLP file.
DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char **originalFileName)Obtains the original file name of a DLP file.
DLP_ErrCode OH_DLP_IsInSandbox(bool *isInSandbox)Checks whether this application is running in a DLP sandbox environment.
DLP_ErrCode OH_DLP_SetSandboxAppConfig(const char *configInfo)Sets sandbox application configuration.
DLP_ErrCode OH_DLP_GetSandboxAppConfig(char **configInfo)Obtains the sandbox application configuration.
DLP_ErrCode OH_DLP_CleanSandboxAppConfig()Cleans the sandbox application configuration.

Enum Description

DLP_ErrCode

enum DLP_ErrCode

Description

Enumerates the DLP error codes.

Since: 14

EnumDescription
ERR_OH_SUCCESS = 0The operation is successful.
ERR_OH_INVALID_PARAMETER = 19100001Invalid parameters are specified.
ERR_OH_API_ONLY_FOR_SANDBOX = 19100006The caller is not a DLP sandbox application.
ERR_OH_API_NOT_FOR_SANDBOX = 19100007The API is not available to a DLP sandbox application.
ERR_OH_SYSTEM_SERVICE_EXCEPTION = 19100011The system service is abnormal.
ERR_OH_OUT_OF_MEMORY = 19100012The memory allocation fails.
ERR_OH_APPLICATION_NOT_AUTHORIZED = 19100018The application is not authorized to perform the operation.

DLP_FileAccess

enum DLP_FileAccess

Description

Enumerates the permissions on a DLP file.

Since: 14

EnumDescription
NO_PERMISSION = 0No permission on the file.
READ_ONLY = 1Read-only permission.
CONTENT_EDIT = 2Editing permission.
FULL_CONTROL = 3Full control.

Function Description

OH_DLP_GetDlpPermissionInfo()

DLP_ErrCode OH_DLP_GetDlpPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t *flags)

Description

Obtains the permission information of this DLP file.

Since: 14

Parameters

ParameterDescription
DLP_FileAccess *dlpFileAccessUser permission on the DLP file, for example, read-only.
uint32_t *flagsPointer to the operation permissions allowed for the DLP file. The options are as follows:
0x00000000 indicates no permission on the file.
0x00000001 indicates the permission for viewing the file.
0x00000002 indicates the permission for saving the file.
0x00000004 indicates the permission for saving the file as another file.
0x00000008 indicates the permission for editing the file.
0x00000010 indicates the permission for capturing screenshots of the file.
0x00000020 indicates the permission for sharing the screen, on which the file is open.
0x00000040 indicates the permission for recording the screen, on which the file is open.
0x00000080 indicates the permission for copying the file.
0x00000100 indicates the permission for printing the file.
0x00000200 indicates the permission for exporting the file.
0x00000400 indicates the permission for modifying the permissions on the file.

Return value

TypeDescription
DLP_ErrCodeReturns 0 if the operation is successful.
Returns 19100001 if invalid parameters are detected.
Returns 19100006 when the access is denied for a non-DLP sandbox application.
Returns 19100011 when the system service is abnormal.
Returns 19100012 if the memory allocation fails.

OH_DLP_GetOriginalFileName()

DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char **originalFileName)

Description

Obtains the original file name of a DLP file.

Since: 14

Parameters

ParameterDescription
const char *fileNamePointer to the target file whose original file name is to be obtained.
char **originalFileNameDouble pointer to the original file name obtained.

Return value

TypeDescription
DLP_ErrCodeReturns 0 if the operation is successful.
Returns 19100001 if invalid parameters are detected.
Returns 19100012 if the memory allocation fails.

OH_DLP_IsInSandbox()

DLP_ErrCode OH_DLP_IsInSandbox(bool *isInSandbox)

Description

Checks whether this application is running in a DLP sandbox environment.

Since: 14

Parameters

ParameterDescription
bool *isInSandboxReturns true if the application is running in a DLP sandbox; returns false otherwise.

Return value

TypeDescription
DLP_ErrCodeReturns 0 if the operation is successful.
Returns 19100011 when the system service is abnormal.
Returns 19100012 if the memory allocation fails.

OH_DLP_SetSandboxAppConfig()

DLP_ErrCode OH_DLP_SetSandboxAppConfig(const char *configInfo)

Description

Sets sandbox application configuration.

Since: 14

Parameters

ParameterDescription
const char *configInfoPointer to the sandbox application configuration obtained.

Return value

TypeDescription
DLP_ErrCodeReturns 0 if the operation is successful.
Returns 19100001 if invalid parameters are detected.
Returns 19100007 if the API cannot be called by a DLP sandbox application.
Returns 19100011 when the system service is abnormal.
Returns 19100018 if the application is unauthorized.

OH_DLP_GetSandboxAppConfig()

DLP_ErrCode OH_DLP_GetSandboxAppConfig(char **configInfo)

Description

Obtains the sandbox application configuration.

Since: 14

Parameters

ParameterDescription
char **configInfoPointer to the sandbox application configuration obtained.

Return value

TypeDescription
DLP_ErrCodeReturns 0 if the operation is successful.
Returns 19100011 when the system service is abnormal.
Returns 19100012 if the memory allocation fails.
Returns 19100018 if the application is unauthorized.

OH_DLP_CleanSandboxAppConfig()

DLP_ErrCode OH_DLP_CleanSandboxAppConfig()

Description

Cleans the sandbox application configuration.

Since: 14

Return value

TypeDescription
DLP_ErrCodeReturns 0 if the operation is successful.
Returns 19100007 if the API cannot be called by a DLP sandbox application.
Returns 19100011 when the system service is abnormal.
Returns 19100018 if the application is unauthorized.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 errorcode-dlp

openharmony 鸿蒙 capi-dlppermissionapi

openharmony 鸿蒙 js-apis-dlppermission-sys

openharmony 鸿蒙 Readme-EN

openharmony 鸿蒙 js-apis-dlppermission

openharmony 鸿蒙 js-apis-identifySensitiveContent

openharmony 鸿蒙 js-apis-dlpsetdlpfeature-sys

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