aesDecrypt()
function aesDecrypt(
cipherText,
keyString,
ivString): Promise<string>;
Defined in: crypto/aesDecrypt.ts:17
使用 AES-GCM 算法解密数据
Parameters
| Parameter | Type | Description |
|---|---|---|
cipherText | string | Base64 编码的密文字符串 |
keyString | string | Base64 编码的 AES 密钥字符串 |
ivString | string | Base64 编码的初始化向量字符串 |
Returns
Promise<string>
解密后的明文字符串
Throws
当解密失败时抛出错误
Example
const plaintext = await aesDecrypt('encryptedData', 'keyInBase64', 'ivInBase64');
console.log(plaintext); // 输出解密后的明文
**Note:** 使用 Web Crypto API 进行 AES-GCM 解密
**Note:** 密钥长度为 256 位
**Note:** 所有输入参数都应为有效的 Base64 字符串