rsa-javascript
v1.0.1
Published
RSA前端js加密,后端java解密 ;由后端产生公钥给前端加密,前端拿到公钥加密参数给后端。
Downloads
1
Maintainers
Readme
rsa-js-java
rsa-js-java
NPM 下载包
npm i rsa-js-java --save-dev
js使用 (加密)
import RSA from 'rsa-js-java'
RSA.setMaxDigits(130)
key = new RSA.RSAKeyPair(10001,'','1e2qwe2we32qw35e4qw3e43qwe4qw3e')
RSA.encryptedString(key, 'pwd') // 对你的密码加密处理
java使用 (解密)
Java生成秘钥及存储私钥进Redis
//解密
try {
PrivateKey privateKey = SecurityKeyUtil.getPrivateKey(UserAspect.privateKeyString);
aco = SecurityKeyUtil.decrypt(privateKey, aco);
pwd = SecurityKeyUtil.decrypt(privateKey, pwd);
} catch (Exception e) {
e.printStackTrace();
throw new PersonUserException(PersonUserEnum.SESSION_TIMEOUT);
}
For detailed explanation on how things work, checkout the docs for rsa-js-java.