我一直在使用jCryption进行安全登录。在客户端,我使用JavaScript包,在Java解密中,我使用BouncyCastle jar进行解密。
问题是,它在Tomcat中工作得很好,但当我使用相同的webapp并在Jboss上部署时,我在加载BouncyCastle jar时遇到了问题。
我的问题是:有没有一种方法可以使用jCryption加密,从而产生更标准化的RSA输出,从而允许我使用其他安全提供商?
发布于 2012-03-30 00:26:51
jcryption并不像你想象的那样安全:
http://www.securityfocus.com/archive/1/520683
我的建议是。做一些类似这样的事情:
http://www.frostjedi.com/terra/dev/rsa/index.php
以下URL详细说明:
http://area51.phpbb.com/phpBB/viewtopic.php?f=84&t=33024&start=0
发布于 2012-03-30 00:33:46
一般来说,如果你想要安全性,avoid JavaScript cryptography,使用SSL/TLS代替。
主要问题是:
不幸的是,在你的网站上使用JavaScript加密实际上并没有增加太多的安全性。
发布于 2013-08-22 21:52:07
下面是与jCryption兼容的RSA解码代码片段。我们假设encExternalKey是jCryption在握手调用时在key参数中发送的内容。modulus和secretExponent取自jCryption随附的100_1024_keys.inc.php文件。
RSAPrivateKeySpec privateKeySpec =
new RSAPrivateKeySpec(new BigInteger(modulus, 10), new BigInteger(secretExponent, 10));
RSAPrivateKey privateKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(privateKeySpec);
Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding");
cipher.init(Cipher.DECRYPT_MODE, privateKey);
StringBuilder externalKeyBuf =
new StringBuilder(new String(cipher.doFinal(new BigInteger(encExternalKey, 16).toByteArray())));
String externalKey = externalKeyBuf.reverse().toString().trim();https://stackoverflow.com/questions/9917736
复制相似问题