implementing-end-to-end-encryption-for-messaging
它能做什么
这个工具可以帮你搭建一套消息系统,只有正在聊天的双方能看到消息内容。即使负责传递消息的服务器也无法读取。它采用先进的加密方法来保障安全。
适用场景
- ✓当你在开发一款安全的聊天应用时。
- ✓当你需要设置安全措施来保护对话内容时。
- ✓当你在评估如何防止消息被窃听时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-end-to-end-encryption-for-messaging/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我该如何为我的聊天应用设置端到端加密?”
每周 5 个新技能,1 分钟读完。
工作原理
它使用一种名为“Signal 协议”的方法,为每条消息生成唯一的安全密钥。这些密钥确保即使有人截获了消息,也无法读取其内容。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Implementing End-to-End Encryption for Messaging
Overview
End-to-end encryption (E2EE) ensures that only the communicating parties can read messages, with no intermediary (including the server) able to decrypt them. This skill implements a simplified version of the Signal Protocol's Double Ratchet algorithm, using X25519 for key exchange, HKDF for key derivation, and AES-256-GCM for message encryption.
When to Use
- When deploying or configuring implementing end to end encryption for messaging capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
Prerequisites
- Familiarity with cryptography concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Objectives
- Implement X25519 Diffie-Hellman key exchange for session establishment
- Build the Double Ratchet key management algorithm
- Encrypt and decrypt messages with per-message keys
- Implement forward secrecy (compromise of current key does not reveal past messages)
- Handle out-of-order message delivery
- Implement key agreement using X3DH (Extended Triple Diffie-Hellman)
Key Concepts
Signal Protocol Components
| Component | Purpose | Algorithm |
|---|---|---|
| X3DH | Initial key agreement | X25519 |
| Double Ratchet | Ongoing key management | X25519 + HKDF + AES-GCM |
| Sending Chain | Per-message encryption keys | HMAC-SHA256 chain |
| Receiving Chain | Per-message decryption keys | HMAC-SHA256 chain |
| Root Chain | Derives new chain keys on DH ratchet | HKDF |
Forward Secrecy
Each message uses a unique encryption key derived from a ratcheting chain. After a key is used, it is deleted, ensuring that compromise of the current state does not reveal previously sent/received messages.
Security Considerations
- Delete message keys immediately after decryption
- Implement message ordering and replay protection
- Use authenticated encryption (AES-GCM) for all messages
- Protect identity keys with device-level security
- Verify identity keys out-of-band (safety numbers)
Validation Criteria
- X25519 key exchange produces shared secret
- Messages encrypt and decrypt correctly between two parties
- Different messages produce different ciphertexts
- Forward secrecy: old keys cannot decrypt new messages
- Out-of-order messages can be decrypted
- Tampered messages are rejected by authentication
常见问题
什么是端到端加密?
这是一种安全机制,确保只有你和你的聊天对象能读取消息内容,其他人,包括提供服务的公司,都无法读取。
什么是“前向保密”?
它的意思是,即使当前的安全密钥泄露,之前的旧消息依然是安全的,无法被解读。
使用这个工具需要成为密码学专家吗?
最好具备一些基础知识,但这个工具简化了流程,让你不必成为专家也能实现安全防护。
详情
作者的原始描述
Implements a simplified Signal Protocol-style end-to-end encryption scheme for messaging, covering key exchange, forward secrecy, and the core cryptographic components so no server or intermediary can decrypt messages. Use when designing or building E2EE messaging, or evaluating forward-secrecy and key-management tradeoffs for a messaging system.
热度
- GitHub 星标
- 35k
- 排名
- #8035
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。