简体   繁体   English

如何在客户端JavaScript中使用crypto js publicEncrypt和privateDecrypt?

[英]How can use crypto js publicEncrypt and privateDecrypt in client side javascript?

I'm using nodejs api Crypto for generate public and private key. 我正在使用nodejs api Crypto生成公共和私有密钥。 And encrypt and decrypt messages using those key. 并使用这些密钥对消息进行加密和解密。 Everything is fine in server side. 在服务器端一切都很好。 But how can I use crypto.publicEncrypt() in client side? 但是如何在客户端使用crypto.publicEncrypt()

You can download the javascript file from HERE and then add it in the client side like this: 您可以从此处下载javascript文件,然后将其添加到客户端,如下所示:

<script type="text/javascript" src="path-to/bower_components/crypto-js/crypto-js.js"></script>
<script type="text/javascript">
    var encrypted = CryptoJS.AES(...);
    var encrypted = CryptoJS.SHA256(...);
</script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 javascript 中使用 node-js 加密? - How to use node-js crypto in javascript? 如何在客户端 javascript 中使用 node.js 缓冲区库 - How can I use node.js buffer library in client side javascript 如何在客户端使用JavaScript来检测页面是否已加密? - How can I use JavaScript on the client side to detect if the page was encrypted? 我可以在 electron.js 中预加载完整的 javascript 库并在客户端使用它吗? - Can I preload a full javascript library in electron.js and use it on the client side? 如何将 typescript 用于客户端 javascript? - How to use typescript for client side javascript? 如何正确使用客户端和服务器端javascript文件 - Node.js - How to use client and server side javascript files correctly - Node.js 如何在JavaScript客户端和服务器端使用输入文件类型 - How to use input file type in javascript client side and server side 如果您拥有相同字符串的解密和加密版本,您能否反向生成 RSA/AES 密钥? (JS客户端加密) - Can you reverse-generate the RSA/AES key if you have the decrypted and encrypted version of the same string? (JS client-side crypto) 在Node.js中如何与客户端JavaScript通信? - In Node.js how do I communicate with client side JavaScript? 如果设计为在客户端上运行,我如何在NodeJS应用程序的服务器端使用javascript库? - How can I use a javascript library on the server side of a NodeJS app when it was designed to run on the client?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM