大网数据广告活动
服务器运维问答

How is a proxy able to decrypt HTTPS traffic without the server certificates?

· 52CE 我爱测

I'm working on a project that involves proxying traffic between some client applications and servers. For this I'm using AnyProxy . My project requires decrypting HTTPS. I'm able to this with AnyProxy, by having it generate a roo…

问题原文

原帖链接 · conectionist · CC BY-SA 4.0

I'm working on a project that involves proxying traffic between some client applications and servers. For this I'm using AnyProxy.

My project requires decrypting HTTPS. I'm able to this with AnyProxy, by having it generate a rootCA and then trusting that rootCA on the client machine(s).

And it works, but I don't understand how/why it works from a theoretical point of view.

As far as I know, HTTPS encryption/decryption works like this:

  1. The server generates a public key and a private key.
  2. The server generates a certificate based on the keys.
  3. It registers said certificate with a CA (certificate authority). This is so client applications (such as web browsers) can verify the authenticity of the certificate from a trusted source.
  4. A client application makes an HTTPS request to the server.
  5. During handshake, the client verifies the authenticity of the certificate (and thus, of the server) and receives the server's public key.
  6. The client encrypts the request with the server's public key.
  7. The server decrypts the request with its private key.

With the proxy comes into the picture, it would need the server's private key to decrypt the client's request. How does it get it? Can someone please explain what I'm missing (or, if I got it all wrong)?

已采纳解答

原帖链接 · Esa Jokinen · CC BY-SA 4.0

This is exactly why you need the root CA generated and installed on the client: it enables your proxy to issue fake certificates for every domain. The proxy doesn't decrypt an existing connection between the client, but establishes two separate connections: it's acting as a client towards the server and as a server for the client. Roughly like this:

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-04-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。