输入文本
加密参数
结果输出
U2FsdGVkX19WkZzdEVXVB6OqXpj1zYFfQ2hQVl5/zcOD2a7mLFo8WR5aeXPnGZ7v
Jk7DIIqpz8f/YnAKP7PJGV9PZNxv+BQ5F0t1n/EDQxBt+yR0pvLS/5+6fCWS+HSs
J7YRrmk6vcQnJ+sXXTyFR/iQ3M+uuHabvZXN01ogVH3Ww7dhY0Ll9Q==
Our free AES encryption online tool helps you secure sensitive data with military-grade encryption. Use our AES decrypt online feature to easily recover your encrypted information. With support for multiple encryption modes and key sizes, our AES encrypt online service is the perfect solution for all your data security needs.
U2FsdGVkX19WkZzdEVXVB6OqXpj1zYFfQ2hQVl5/zcOD2a7mLFo8WR5aeXPnGZ7v
Jk7DIIqpz8f/YnAKP7PJGV9PZNxv+BQ5F0t1n/EDQxBt+yR0pvLS/5+6fCWS+HSs
J7YRrmk6vcQnJ+sXXTyFR/iQ3M+uuHabvZXN01ogVH3Ww7dhY0Ll9Q==
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
import base64
def encrypt_aes_cbc(plaintext, key, iv):
"""
使用AES-CBC模式加密文本
参数:
plaintext (str): 要加密的文本
key (bytes): 密钥 (16, 24, 或 32 字节,对应AES-128/192/256)
iv (bytes): 初期化向量 (16 字节)
返回:
str: Base64编码的加密文本
"""
# 将文本转换为字节并填充
plaintext_bytes = plaintext.encode('utf-8')
padded_data = pad(plaintext_bytes, AES.block_size)
# 创建AES密码对象,使用CBC模式
cipher = AES.new(key, AES.MODE_CBC, iv)
# 加密数据
ciphertext = cipher.encrypt(padded_data)
# 转换为Base64编码的字符串并返回
return base64.b64encode(ciphertext).decode('utf-8')
def decrypt_aes_cbc(ciphertext, key, iv):
"""
使用AES-CBC模式解密文本
参数:
ciphertext (str): Base64编码的加密文本
key (bytes): 密钥 (16, 24, 或 32 字节,对应AES-128/192/256)
iv (bytes): 初期化向量 (16 字节)
返回:
str: 解密后的文本
"""
# 将Base64编码的密文转换为字节
ciphertext_bytes = base64.b64decode(ciphertext)
# 创建AES密码对象,使用CBC模式
cipher = AES.new(key, AES.MODE_CBC, iv)
# 解密并去除填充
decrypted_data = cipher.decrypt(ciphertext_bytes)
unpadded_data = unpad(decrypted_data, AES.block_size)
# 将解密后的字节转换为字符串
return unpadded_data.decode('utf-8')
# 示例使用
key = b'ThisIsA32ByteKey1234567890abcdef' # 256位密钥
iv = b'ThisIsA16ByteIV!' # 16字节初始化向量
# 加密示例
plaintext = "这是要加密的敏感数据"
encrypted = encrypt_aes_cbc(plaintext, key, iv)
print(f"加密结果: {encrypted}")
# 解密示例
decrypted = decrypt_aes_cbc(encrypted, key, iv)
print(f"解密结果: {decrypted}")
Our AES encryption online tool uses industry-standard algorithms to keep your data safe from unauthorized access.
With our user-friendly AES decryption online feature, recovering your encrypted information is just a few clicks away.
Our free AES encrypt online and AES decrypt online services work without requiring any account creation or personal information.
AES encryption online is a web-based service that allows you to encrypt your sensitive data using the Advanced Encryption Standard algorithm without installing any software.
AES is considered extremely secure and is widely used by governments and organizations worldwide to protect classified information.
To use our AES decrypt online tool, simply paste your encrypted text in the input field, enter your encryption key and IV (if required), select the appropriate encryption parameters, and click the "AES Decrypt Online" button.