2 回答
TA贡献1839条经验 获得超15个赞
以下是如何使用带有 PKCS 填充的 AES-CBC 进行解密的示例。我不清楚您的示例中是否有有效的密钥/密文,因为我无法vector使用该密钥进行解密:
SELECT
AEAD.DECRYPT_STRING(
KEYS.ADD_KEY_FROM_RAW_BYTES(
b'', 'AES_CBC_PKCS', FROM_BASE64('dfrBArd8b6YZFDGTYrZtQa==')),
FROM_BASE64('/FCM1XMvr+rHwZx'), '');
这是一个有效的独立示例:
WITH EncryptedInput AS (
SELECT FROM_HEX('deed2a88e73dccaa30a9e6e296f62be27db30db16f76d3f42c85d31db3f46376') AS ciphertext,
b'1234567890123456' AS key UNION ALL
SELECT FROM_HEX('deed2a88e73dccaa30a9e6e296f62be2ea3f4c2ac2c8863306fd9ff87e10497b61d86111fafd0d0fe0046d7e199044ec'),
b'1234567890123456' UNION ALL
SELECT FROM_HEX('0102030405060708090a0b0c0d0e0f1073d8712936ea9899952e97284288c1cd7b7cbfff0a53ae87a19454f7d84082a07a25fc01031b5e08c6b7ce6520989b82'),
b'98765432101234567890123456789012' UNION ALL
SELECT NULL, b'1234567890123456' UNION ALL
SELECT FROM_HEX('deed2a88e73dccaa30a9e6e296f62be27db30db16f76d3f42c85d31db3f46376'),
NULL
)
SELECT AEAD.DECRYPT_STRING(KEYS.ADD_KEY_FROM_RAW_BYTES(b'', 'AES_CBC_PKCS', key), ciphertext, '') AS plaintext
FROM EncryptedInput;
添加回答
举报