> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kasoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# cryptoDecrypt

> 使用存储在知行之桥保管库中的密钥和初始化向量解密 AES 加密数据。

使用 `AES` 算法解密加密数据。

## 必需参数

* **keyVaultEntry**：用于密钥的加密保管库项的名称。存储在此保管库项中的值必须与 keyVaultEntryFormat 中设置的编码相匹配，并满足所选算法的长度要求。
* **ivVaultEntry**：用于初始化向量 (IV) 的加密保管库项的名称。存储在此保管库项中的值必须与 ivVaultEntryFormat 中设置的编码相匹配，并满足所选算法的长度要求。

## 可选参数

* **algorithm**：用于加密的算法名称。AES 是目前唯一支持的值。它支持 128、192 和 256 位密钥长度。
* **cipherMode**：用于处理和解密加密数据的方法。可接受的值包括：`CBC`、`ECB`、`OFB`、`CFB`、`CTS`、`8OFB`、`8CFB`、`GCM`、`CTR` 和 `XTS`。默认值为 `CBC`。
* **paddingMode**：用于在解密消息时处理多余或缺失数据的方法，确保正确重建明文。可接受的值包括：`PKCS7`、`Zeros`、`None`、`ANSIX923` 和 `ISO10126`。默认值为 `PKCS7`。
* **keyVaultEntryFormat**：keyVaultEntry 项中存储值的编码。可接受的值包括：`HEX`、`BASE64`、`8BIT` 和 `RAW`。默认值为 `HEX`。
* **ivVaultEntryFormat**：ivVaultEntry 项中存储值的编码。可接受的值包括：`HEX`、`BASE64`、`8BIT` 和 `RAW`。默认值为 `HEX`。
* **data**：要解密的数据。
* **file**：要解密的文件。
* **outFile**：用于存储解密数据的文件。
* **inFormat**：加密输入数据使用的格式。可接受的值包括：`HEX`、`BASE64`、`8BIT` 和 `RAW`。默认值为 `HEX`。
* **outFormat**：加密输出数据使用的格式。可接受的值包括：`HEX`、`BASE64`、`8BIT` 和 `RAW`。默认值为 `HEX`。

## 输出属性

* **data**：如果未指定 outFile，则为解密后的数据。
* **outFile**：如果指定了 outFile，则为包含解密数据的文件。

## 示例

在以下示例中，cryptoDecrypt 操作用于解密加密值。该值使用 AES 和 HEX 编码加密，因此示例对 keyVaultEntryFormat 和 ivVaultEntryFormat 参数使用默认 AES 算法和默认 HEX 编码。这意味着 keyVaultEntry 和 ivVaultEntry 的 `key` 和 `iv` 保管库项中存储的值必须与用于加密该值的 128 位 HEX 编码值匹配。

如果未使用正确的值，则会导致解密过程中出现错误。

```xml theme={null}
<!-- Encrypted value that was retrieved in an earlier step. -->
<arc:set attr="encrypted.value" value="D13B1E9F660B797347D1AAB00046BE70" />

<!-- Set both the Key and IV values. These are the names of the vault items that were used to encrypt the original data. -->
<arc:set attr="input.keyVaultEntry" value="key"/>
<arc:set attr="input.ivVaultEntry" value="iv"/>

<!-- Default algorithm is AES -->
<arc:set attr="input.algorithm" value="AES" />

<!-- Pass in the input item and call cryptoDecrypt -->
<arc:set attr="input.data" value="[encrypted.value]"/>  
<arc:call op="cryptoDecrypt" in="input" out="result" >
  <!-- Here is where you can use the newly decrypted value/data. A new file is used here. -->
  <arc:set attr="output.data" value="[result.data]" />
  <arc:set attr="output.filename" value="MyDecryptedData.txt" />
</arc:call>

<!-- Push the decrypted data, as a file, as output. -->
<arc:push item="output" />
```
