用于ios的RC4算法

时间:2014-01-10 07:17:42

标签: ios encryption rc4-cipher

我有使用rc4算法的密钥和加密值我需要解密它。请你帮我解决这个问题。使用本机ios。请给我任何解决方案。我已经提到了一些它对我没用的链接。我从服务器收到了一些加密值,我已经生成了密钥。使用该加密值和密钥,我需要使用RC4算法解密。

1 个答案:

答案 0 :(得分: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(等),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.