【发布时间】:2020-06-18 03:09:46
【问题描述】:
我正在尝试使用 javascript 加密前端中的一些字符串,使用一些公钥-私钥方法,其中只有后端可以使用私钥解密,这可能吗?我怎样才能实现它?
我不介意它是否具有真正的基本加密,只要它有一个公共和私人密钥
// This is an EXAMPLE of what I want:
let message = encrypt("hello word!","public_key");
let decrypt_message = decrypt(message, "public_key");
/* the decrypt() method should throws error cuz the user shouldn't be able to
* decrypt his own message with the public_key
*/
还请注意,我已经在使用 HTTPS,但具有额外的安全性并不会伤害任何人 :)
提前谢谢你♥
【问题讨论】:
标签: javascript encryption