我有使用 rc4 算法的密钥和加密值,我需要解密它。你能帮我解决这个问题吗?使用原生 ios。请给我任何解决方案。我已经引用了一些对我没有帮助的链接。我已经从服务器收到了一些加密值,并且我已经生成了密钥。使用该加密值和密钥,我需要使用 RC4 算法进行解密。
问问题
582 次
1 回答
1
我已经提到了一些对我没有帮助的链接。
这可能会对您有所帮助:http ://www.google.com/#q=kCCAlgorithmRC4+site:apple.com 。
代码将如下所示:
ccStatus = CCCrypt(kCCDecrypt,
kCCAlgorithmRC4,
kCCOptionPKCS7Padding,
cbKey,
kCCAlgorithmRC4,
cbInitVec,
cipherText,
cipherTextSize,
outBuffer,
outBufferSize,
&outWritten);
还有一点自行车脱落。由于偏见,RC4 并不真正适合在 SSL/TLS 中使用。确保您丢弃了密钥流的前 1K 到 2K 字节。更好的是,甚至不要使用它。
来自 AlFardan, Bernstein (et al), On the Security of RC4 in TLS and WPA :
... While the RC4 algorithm is known to have a variety of cryptographic weaknesses (see [26] for an excellent survey), it has not been previously explored how these weaknesses can be exploited in the context of TLS. Here we show that new and recently discovered biases in the RC4 keystream do create serious vulnerabilities in TLS when using RC4 as its encryption algorithm.
于 2014-01-10T14:46:04.920 回答