跳到主要内容
uencoder

Implement end-to-end 加密 (E2EE)

End-to-end 加密 ensures 仅 communicating parties 能够读取 messages — 否 intermediary 服务器 holds 解密关键. Learn hybrid 加密模式.

  1. 1

    E2EE 我们 hybrid 加密: symmetric 键 (AES) encrypts 消息, 和 recipient's 公共键 (RSA/ECDSA) encrypts symmetric 键. 服务器 stores 仅 ciphertext. recipient decrypts symmetric 键具有其 私有键, 然后 decrypts 消息.

  2. 2
    AES 加密器 →

    加密 the message with a fresh random AES-256 key. This key is generated per message and never reused. The ciphertext is what gets stored and transmitted.

  3. 3
    RSA 工具 →

    加密 the AES key with the recipient's RSA public key. The recipient's private key is needed to recover the AES key. This is the key encapsulation step.

  4. 4
    HMAC 生成器 →

    生成 an HMAC over the ciphertext to detect tampering in transit. The recipient verifies the HMAC before attempting decryption.

  5. 5

    为 messaging apps, 每个用户有 长-项 identity 键对. 为 forward secrecy, use ephemeral Diffie-Hellman per 会话: 生成 temporary 键对, exchange 公共关键, derive shared secret, 和 discard ephemeral 关键之后会话.

常见问题

为什么 hybrid 加密而非仅 RSA?
RSA 是慢 和有 大小限制 (plaintext 必须是 smaller than modulus). AES 是快 和 handles 任何大小. Hybrid combines strengths: RSA 为键 exchange, AES 为 bulk 数据.
能够服务器解密 E2EE messages?
否 — 通过设计. 服务器仅 stores ciphertext 和 encrypted 关键. 仅 recipient's device 有私有键. 此是 defining 属性的 E2EE, 但它 means 服务器 cannot 提供搜索或 备份 features 无客户端-边解密.

解决此任务的工作流

相关工具