OpenSSL - 查找 AES 密钥
我使用 OpenSSL 库在客户端和主机之间用 C 创建了一个 SSL 套接字。 我需要 SSL 会话的 AES 密钥来正确加密消息,但无法使用标准函数 ssl_write 和 ssl_read。 我发现有一个名为 AES_KEY 的结构,但我不知道如何找到它!
SSL_write 和 SSL_read 仅适用于数据包类型:23(“应用程序协议”)
例如,如何解密来自服务器的 SSL Hello 消息(我使用此服务器打开了 SSL 通道)?如何加密来自其他客户端的 SSL Hello 客户端(位于 clair 中)?
我试图演示 TLS 协议的“TLS 重新协商”阶段的攻击。我正在尝试使用自定义代理模拟攻击 MITM。
现在,服务器向代理发送一定数量的类型 22(握手)和 20(ChangeCipherSpec)的加密消息。我如何读取这些消息并解密它们?标准库 ssl_read 仅适用于消息 23(应用程序)。
此外,客户端向代理发送客户端Hello和其他类型22和20的消息。我如何编写这些消息并加密它们?我尝试使用 ssl_write,但服务器无法理解这些消息。
I created a SSL socket in C between a client and a host using the OpenSSL library.
I need the AES key of a SSL session to encrypt correctly a message and I can't use the standard functions ssl_write and ssl_read.
I found that there is a struct called AES_KEY, but I don't know how I can found it!
SSL_write and SSL_read work correctly only with packet type: 23 ("Application protocol")
How can I decrypt, for example, an SSL Hello Message that come from server (i opened the SSL channel with this server)? How can I encrypt an SSL Hello Client (it's in clair) that comes from an other client?
I'm trying to demonstrate an attack during the phase of "TLS Renegotiation" of TLS Protocol. I'm trying to simulate an attack MITM with a custom proxy.
Now, the server send to proxy a certain number of encrypted messages of type 22 (Handshake) and 20 (ChangeCipherSpec). How can I read these messages and decrypt them? The standard library ssl_read works only with messages 23 (Application).
Moreover, the client send to proxy a client Hello and other messages of type 22 and 20. How can I write these messages and encrypt them? I tried using ssl_write, but the server doesn't understand these messages.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用 SSL_CTX_set_info_callback 来获取在你想要的信息。
Instead of manually (en|de)crypting records, you should use SSL_CTX_set_info_callback to get at the information you want.
我找到了解决方案。其功能是:
I found the solution. The functions are: