带有 NodeJS 的 Crypto-js 包

Crypto-js package with NodeJS

into GitHub 不清楚,因为我必须使用第二个参数(在本例中为“secretKey”)进行加密或解密:

//Encrypt
var encryptedMessage = crypto.AES.encrypt(secretMessage, secretKey);
console.log("Encrypted message " + encryptedMessage);

//Decrypted
var bytes = crypto.AES.decrypt(encryptedMessage, secretKey);
var decryptedMessage = bytes.toString(crypto.enc.Utf8); // convert into string and encoding Utf8

如果我在没有第二个参数的情况下编译,Node 会响应 属性 "words" 未定义。为什么? 谢谢大家 莫里斯

你问为什么要用秘钥解密?对于拥有真正安全的加密实现来说,这是一个微不足道的要求。如果您的加密消息可以在不使用密钥的情况下解密,那么地球上的每个人都可以解密您的消息。

我很确定你不是在问那个,但我不知道你在问什么,看看你的问题,这与你的要求最接近。