您好,我有我在 Javascript 中设置的这个脚本:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript" src="jsbn.js"></script>
<script language="JavaScript" type="text/javascript" src="rsa.js"></script>
<script language="JavaScript">
function encryptData(){
var pem ="-----BEGIN PUBLIC KEY-----\
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+tii3IwzHa4i142kAB0dRVXoXA2Q8oF48UgMA\
AV54+JDED5iVyJK1s7J/xGi4U3+9sRoraE7bS19Nihs5DuYa0gsbKs/5jXOtKiw94fAtMyJTcX0d\
SzZhJKcX9vEzI27Hdu1rNFY64Ixz3KjrG1N/pXHtwjE1Ira5XZdTezx0wwIDAQAB\
-----END PUBLIC KEY-----";
var key = RSA.getPublicKey(pem);
var message = "some text to RSA encrypt";
var encryptedMessage = RSA.encrypt(message, key);
$('#RSAMessageEncrypted').html(encryptedMessage);
}
</script>
</head>
<body onload=encryptData();>
<form>
<strong>RSA encrypted Message :</strong> <textarea rows="10" cols="100" id="RSAMessageEncrypted"></textarea><br>
</form>
</body>
</html>
我的文本区域充满了我使用上面的公钥在 RSA 中加密的消息。
加密的消息是:
oH1JVWIT7MOH4ObCjFlBuFcAUvooSZANMokFy5jApSi8n0ABVc9vwXP2EFl2x5+UColU6s2VAU+RsZPV4ZgZu3+GhN9pDUb1ZMVyYRECDy/7h+mE+UdDZTPwP1TAcBrspL/XM6+q6mJfUWbEKfR/2vyNUhBxpt6QOhVaI29aHfU=
我的问题如下:如何使用派生此公钥的私钥对解密我的消息?有没有解密的库?
我的私钥是:
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQC+tii3IwzHa4i142kAB0dRVXoXA2Q8oF48UgMAAV54+JDED5iVyJK1s7J/xGi4
U3+9sRoraE7bS19Nihs5DuYa0gsbKs/5jXOtKiw94fAtMyJTcX0dSzZhJKcX9vEzI27Hdu1rNFY6
4Ixz3KjrG1N/pXHtwjE1Ira5XZdTezx0wwIDAQABAoGBAJY4Gd4XZ6t1Epxi4oQ5N33jXGXgMAZp
M5FD8EUCzw1ujWlB96iT8qvZPdLSPMJkUwxyAfELGoI13n3POR46lBhRpYKkTZm1UmEBscdO2B9w
B7YUM9caJG4TgWBKxD8KLriQANnXZrv9zNGx4Cs0USeQgWuDfgkBF+PvL5AVq+jRAkEA+O0MNvBM
kGtGCLt/V34jiivGs9HtXKSJY6vI60GYZYB7D3SniYVUsMocC+O3vyqdpMiO/szfLTAWdXB2yl3Q
VwJBAMQhmQkT57rJ07SS40t1HGonryrmGF3BcHw9sVCijZF/jrbKeL5XmhnbCr9Lhy/InepcSRFI
Pqzj32w0timLi3UCQCVsliKIXCp2RlA3yDxiNXunezc7v4DnJ9S5VfqwoPXZrCa1th6B0irGKBNN
iCmQgaTtljoOmRsVGLtNTj68ff8CQGeiLR/b0bUkEeY3OzzS27nH0EoFnNhlbw9m9btauR0pXnp9
j8FbvoRs9kfQG9WG1tJQAxfLqbpnCdY+IAbhwkUCQQDOIrm78sSuVL+U6f98P2eDSzhKgnepEEVJ
u5iBs3lT5T+p+Xov6DPLd13Pm7Lyppj8S7pW/1CwkTVwW+U3O2kj
-----END RSA PRIVATE KEY-----