使用从 openssl api 获取的密钥解密 ssl 网络数据包

发布于 2024-10-08 06:07:46 字数 635 浏览 0 评论 0原文

我的计算机上运行一个客户端应用程序,它使用 openssl 与使用 SSLv3 的服务器进行通信。我需要看看他们在说什么,所以我基本上想编辑并重新编译 openssl 库以获得相关的加密密钥。

该应用程序通常使用 TLS-DHE-RSA-WITH-AES-256-CBC-SHA 作为密码套件。有时它使用 aes128 而不是 aes256,但这在现阶段并不重要。到目前为止我编辑了 s3_enc.c 文件。在 ssl3_setup_key_block 函数的末尾,我将主密钥、密钥块(以便客户端-服务器写入密钥、mac 密钥和 IV)、服务器和客户端随机数写入文件。 http://www.ietf.org/rfc/rfc2246.txt 表示流是否密码是可导出的,客户端-服务器写入密钥将相应地更新为最终客户端-服务器写入密钥。我不确定这个密码套件是否被认为是可导出的(无论这意味着什么),但无论如何我都会创建最终的写入密钥。

问题是无论我尝试什么,我都无法成功解密使用wireshark获取的任何数据包。无论如何,输出毫无意义,我被困住了。我正在考虑在解密后检查数据包的 mac 字段,以查看解密是否正确。但这似乎也是一条死胡同。

有谁知道我错过了什么,我可能做错了什么?

I have a client application that runs on my computer, which uses openssl to communicate with server using SSLv3. I need to see what they talk so I basically want to edit and recompile openssl library in order to acquire relevant encryption keys.

The application usually uses TLS-DHE-RSA-WITH-AES-256-CBC-SHA as cipher suite. Sometimes it uses aes128 instead of aes256 but that's not critical at this stage. I edited s3_enc.c file so far. At the end of ssl3_setup_key_block function I write the master key, key block(so the client-server write keys, mac keys and IV's), server and client randoms to a file. http://www.ietf.org/rfc/rfc2246.txt says if the stream cipher is exportable, client-server write keys are to be updated as final client-server write keys accordingly. I'm not sure if this cipher suite is considered exportable(whatever that means), but I create final write keys anyway.

The problem is whatever I tried, I couldn't successfully decrypt any packet which I acquired using wireshark. The output is meaningless no matter what and I'm stuck. I am considering checking the mac fields of packets after decryption in order to see whether decryption was correct. But that also seems to be a dead end.

Does anyone have any idea what I am missing, what I might be doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

国产ˉ祖宗 2024-10-15 06:07:46

如果您可以修改 OpenSSL 并让您的客户端应用程序使用它,那么您所需要做的就是让修改后的 OpenSSL 将解密数据转储到文件中。更简单的替代方案是让 OpenSSL 使用 NULL 密码套件之一,即使应用程序请求某些加密也是如此。

If you can modify OpenSSL and make your client application use it, then all you need to do is make your modified OpenSSL dump the decrypted data to the file. Even easier alternative would be to make OpenSSL use one of NULL ciphersuites even when the application requests certain encryption.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文