【发布时间】:2016-06-17 23:03:07
【问题描述】:
我有以下用于解密的 Python 脚本:
from Crypto.Cipher import AES
shared_secret = raw_input('Enter crypted_shared_secret: ').strip()
cipher = AES.new(shared_secret.decode('base64'), AES.MODE_ECB)
blob = raw_input('Enter crypted_blob: ').strip()
plain = cipher.decrypt(blob.decode('base64'))
print(plain)
我正在尝试使用 Node.js 使用该脚本生成将生成原始 blob 的值。这是我的尝试:
const Crypto = require('crypto');
var shared_secret = Crypto.randomBytes(32);
var cipher = Crypto.createCipher('aes-256-ecb', shared_secret);
crypted_blob = cipher.update(blob, 'utf8', 'base64') + cipher.final('base64');
我只能修改 Node.js 脚本,但我不确定它哪里出错了。
【问题讨论】:
标签: python node.js encryption aes