React中使用jsencrypt进行RSA加密

安装jsencrypt库

npm install --save jsencrypt

 页面中引入jsencrypt

import JSEncrypt from 'jsencrypt'

调用方法

var encrypt = new JSEncrypt();
encrypt.setPublicKey('公钥字符串');
let password= encrypt.encrypt('helloworld'); 
console.info(password);

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注