> ## 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" />
```
