【问题标题】:How to find RC4 key from decrypted and encrypted data?如何从解密和加密的数据中找到 RC4 密钥?
【发布时间】:2012-09-17 13:50:32
【问题描述】:

我在文档中进行了一些转储分析,显示了一堆加密数据,以及由此产生的解密数据。解释了使用的算法(简单的 RC4)。唯一缺少的信息是用于从加密数据到解密数据的密钥。

我正在根据此文档材料编写自动化测试。我可以选择自己的一些密钥并从明文中重新创建加密数据,但我想知道是否有任何简单的密码分析方法可以找到用于加密原始数据的原始密钥。

蛮力方法可能是可能的,因为密钥非常小,但我更想知道是否存在任何更聪明的方法。

以下是我目前的 C 加密代码(使用 OpenSSL):

unsigned char source[16] = {
    0xdb, 0xa3, 0x13, 0x30, 0x79, 0xa3, 0xcd, 0x9e,
    0x48, 0xf4, 0x8f, 0x06, 0x37, 0x1b, 0x45, 0xdd};
unsigned char expected_target[16] = {
    0x00, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x00, 0x00,
    0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66};
unsigned char target[16] = {};
unsigned char key[16] = {};

RC4_KEY crypt_key;
RC4_set_key(&crypt_key, 16, key);
RC4(&crypt_key, 16, source, target);

printf("key    = [%02x %02x %02x %02x %02x %02x %02x %02x "
               "- %02x %02x %02x %02x %02x %02x %02x %02x]\n",
    key[0], key[1], key[2], key[3],
    key[4], key[5], key[6], key[7],
    key[8],  key[9], key[10], key[11],
    key[12], key[13], key[14], key[15]);

printf("source = [%02x %02x %02x %02x %02x %02x %02x %02x "
               "- %02x %02x %02x %02x %02x %02x %02x %02x]\n",
    source[0], source[1], source[2], source[3],
    source[4], source[5], source[6], source[7],  
    source[8], source[9], source[10], source[11],
    source[12], source[13], source[14], source[15]);

printf("target = [%02x %02x %02x %02x %02x %02x %02x %02x "
               "- %02x %02x %02x %02x %02x %02x %02x %02x]\n",
    target[0], target[1], target[2], target[3],
    target[4], target[5], target[6], target[7],
    target[8], target[9], target[10], target[11],
    target[12], target[13], target[14], target[15]);

printf("expected_target = [%02x %02x %02x %02x %02x %02x %02x %02x "
                        "- %02x %02x %02x %02x %02x %02x %02x %02x]\n",
    expected_target[0], expected_target[1], expected_target[2], expected_target[3],
    expected_target[4], expected_target[5], expected_target[6], expected_target[7],
    expected_target[8], expected_target[9], expected_target[10], expected_target[11],
    expected_target[12], expected_target[13], expected_target[14], expected_target[15]);

【问题讨论】:

  • 蛮力?不过说真的,加密的全部意义在于让这类东西在计算上变得困难。
  • 我不清楚。我相信经过计算证明的困难是在给定密文的情况下找到一些未知的明文。就我而言,我有加密文本和明文。我不清楚这是同一个问题(但蛮力可能确实不是一种选择)。
  • 同样的问题。已知的明文使某些攻击更容易,但在 RC4 的情况下,没有此类攻击是已知的。抱歉,如果您不知道这里的密钥,那么您就是 SOL。

标签: c cryptanalysis rc4-cipher


【解决方案1】:
  1. 没有。没有已知的有效 RC4 破解方法。

  2. 您需要数百万年的时间来暴力破解 128 位密钥。您可以尝试使用密码列表。

【讨论】:

  • 据我所知,密钥很可能是随机数,密码列表不在图片中。但我不确定我要寻找的是真的 RC4 破解,因为我已经有了明文(也许无论如何,但我仍然对解释原因的指针感兴趣)。
  • 如果密钥真的是随机的,你就没有机会了。 RC4现在没有坏。已知明文攻击模型也不例外。
  • 另外,如果你有一个旧的 RC4 实现(我认为没有),你可以试试Fluhrer, Mantin and Shamir attack
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多