---
title: revealShareByFile
description: "用于还原最终的计算结果。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengcctrustzone/tee/kcal/kunpeng_kcal_16_0093.html
sourcePath: /source/zh/kunpengcctrustzone/tee/kcal/kunpeng_kcal_16_0093.html
indexId: 421fa9a4ab84806c2aa68d7b67e3bca8b807e3e17e546dcb3a59ec181380d8b564
---
# revealShareByFile

用于还原最终的计算结果。
```
int revealShareByFile(
DG_TeeCtx *dgTeeCtx,
const DG_MpcFileInput *input,
DG_MpcFileOutput *output
)
```


#### 参数

| 参数名 | 描述 | 取值范围 | 输入/输出 |
| --- | --- | --- | --- |
| dgTeeCtx | KCAL上下文信息 | 为initTeeCtx成功初始化的结果 | 输入 |
| input | DG\_MpcFileInput | 不能输入为NULL | 输入 |
| output | DG\_MpcFileOutput | 不能输入为NULL | 输出 |


**表1 DG_MpcFileInputSet结构体**

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| shareInputSet | DG\_MpcFileInput | 每个参与方的分片文件 |
| size | unsigned long | 参与方数量 |


**表2 DG_MpcFileInput结构体**

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| filePath | char\* | 文件路径 |
| pathLen | uint32\_t | 路径长度 |
| dataSize | uint64\_t | 数据大小 |


**表3 DG_MpcFileOutput结构体**

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| filePath | char\* | 文件路径 |
| pathLen | uint32\_t | 路径长度 |
| dataSize | uint64\_t | 数据大小 |


#### 返回值

- 成功：返回0。
- 失败：返回错误码。


#### 错误码

| 错误码 | 错误码值 | 描述 | 特殊说明 |
| --- | --- | --- | --- |
| DG\_ERR\_MPC\_TEE\_INVALID\_PARAM 4516 | 4501 DG\_ERR\_MPC\_TEE\_TMP\_PATH\_SET\_ERROR | 无效参数 临时目录设置错误 | \- |
| DG\_ERR\_MPC\_TEE\_INVALID\_ALGORITHM\_TYPE 4514 | 4502 DG\_ERR\_MPC\_TEE\_CHUNK\_SIZE\_SET\_ERROR | 无效算法类型 文件分片块大小设置错误 | \- |


#### 依赖

- dgTeeCtx依赖  initTeeCtx
的成功初始化。
- 依赖的头文件为"data_guard_mpc.h"。


#### 示例

根据output的输出路径获取输出结果。


```
#include  "data_guard_mpc.h"
//计算方
DG_MpcFileInput teeFileInput;
teeFileInput.filePath = const_cast<char *>(shareFilePath.c_str());
teeFileInput.pathLen = static_cast<uint32_t>(shareFilePath.length());
DG_MpcFileOutput teeFileOutput;
teeFileOutput.filePath = const_cast<char *>(outputFilePath.c_str());
teeFileOutput.pathLen = static_cast<uint32_t>(outputFilePath.length());
int ret = opts_->revealShareByFile(dgTeeCtx_, &teeFileInput, &teeFileOutput);
```
