运用网页设计的方式写了一个RSA小工具
有浏览器能看网页的机器上都能用
源码地址:http://download.csdn.net/download/qq389146213/9596275
生成RSA密钥:
cryptico.browser.js 是网上找到的现成代码 我只做了一点点修改
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes" />
<script language="JavaScript" type="text/javascript" src="cryptico.browser.js"></script>
<title>生成RSA密钥</title>
</head>
<body>
<script type="text/javascript">
function showKey()
{
var psw=document.getElementById("keyForPrivate").value;
if(psw==document.getElementById("keyForPrivate2").value){
var Bits = 2048;
var rsaKey = cryptico.generateRSAKey(psw, Bits);
var publicKeyString = cryptico.publicKeyString(rsaKey);
var aesKey = cryptico.string2bytes(cryptico.b64to256(
"L7UotmZPW5e1DFI3xEN1Y2jfLatPhtNNRNL2Zb/TyUE="));
aesKey = cryptico.string2bytes(cryptico.b64to256(
cryptico.encryptAESECB(escape(psw), aesKey)));
aesKey = aesKey.slice(0, 16);
var privateKeyString = cryptico.privateKeyString(rsaKey,aesKey);
document.getElementById("publicKey").value=publicKeyString;
document.getElementById("privateKey").value=privateKeyString;
var myDiv=document.getElementById("err");
myDiv.innerText="请记住这个密码以后会用得到";
}
else{
var myDiv=document.getElementById("err");
myDiv.innerText="两次输入的密码不一致请重试!";