发布网友 发布时间:2022-04-26 09:30
共2个回答
热心网友 时间:2022-04-22 23:03
js对公钥串进行加密的写法:
依赖:RSA.js BigInt.js 和Barrett.js
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
<html:base />
<title>login</title>
<meta http-equiv="pragma" content="no-cache">
<script type="text/javascript" src="js/RSA.js"></script>
<script type="text/javascript" src="js/BigInt.js"></script>
<script type="text/javascript" src="js/Barrett.js"></script>
<script type="text/javascript">
function rsalogin()
{
bodyRSA();
var result = encryptedString(key, document.getElementById("pwd").value);
//alert(result);
loginForm.action="login.do?result="+result;
loginForm.submit();
}
var key ;
function bodyRSA()
{
setMaxDigits(130);
key = new RSAKeyPair("10001","","8c1cd09a04ed01aafe70dc84c5f32ae23a16fe8fc88aba6797c5a9c708720de4f08dbf086af429fc51c0636208f56de20a8ab5686affd9bdfb3ae1e90d5617155c4867eef06b0884ba8ecd187907c7069ae3eed4f0155eeca65734118035ae803ad8fd91a0cc479f27e41b19c13465ab30f3cfbfd14de56f49cbd09481");
}
</script>
热心网友 时间:2022-04-23 00:21
首先,你要将这个xml转成json格式,网络上有很多这样的工具
其次,要用高精度数运算加密,见https://github.com/jasondavies/jsbn,jsbn是一个很好的大整数运算库.里面有RSA加密的例子