implementing-aes-encryption-for-data-at-rest
Skill này làm gì
Công cụ này giúp bảo vệ tệp và dữ liệu của bạn bằng phương pháp mã hóa AES-256 ở chế độ GCM. Nó đảm bảo dữ liệu được giữ an toàn và mọi thay đổi trái phép đều được phát hiện.
Khi nào nên dùng
- ✓Khi thiết lập bảo mật để bảo vệ dữ liệu lưu trữ.
- ✓Để đảm bảo các biện pháp bảo mật của bạn đáp ứng yêu cầu tuân thủ.
- ✓Khi xem xét mức độ bảo mật của một hệ thống hiện có.
Liên kết skill
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-aes-encryption-for-data-at-rest/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm thế nào để tôi dùng AES-256-GCM để mã hóa tệp tên 'secret_document.txt' với mật khẩu 'mypassword123'?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ dùng một chuẩn mã hóa mạnh (AES-256-GCM) để xáo trộn dữ liệu của bạn. Nó tạo khóa bí mật từ mật khẩu, dùng một số duy nhất (nonce) cho mỗi lần mã hóa và thêm một thẻ (tag) để đảm bảo dữ liệu không bị giả mạo.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Implementing AES Encryption for Data at Rest
Overview
AES (Advanced Encryption Standard) is a symmetric block cipher standardized by NIST (FIPS 197) used to protect classified and sensitive data. This skill covers implementing AES-256 encryption in GCM mode for encrypting files and data stores at rest, including proper key derivation, IV/nonce management, and authenticated encryption.
When to Use
- When deploying or configuring implementing aes encryption for data at rest 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 AES-256-GCM encryption and decryption for files
- Derive encryption keys from passwords using PBKDF2 and Argon2
- Manage initialization vectors (IVs) and nonces securely
- Encrypt and decrypt entire directory trees
- Implement authenticated encryption to detect tampering
- Handle large files with streaming encryption
Key Concepts
AES Modes of Operation
| Mode | Authentication | Parallelizable | Use Case |
|---|---|---|---|
| GCM | Yes (AEAD) | Yes | Network data, file encryption |
| CBC | No | Decrypt only | Legacy systems, disk encryption |
| CTR | No | Yes | Streaming encryption |
| CCM | Yes (AEAD) | No | IoT, constrained environments |
Key Derivation
Never use raw passwords as encryption keys. Always derive keys using:
- PBKDF2: NIST-approved, widely supported (minimum 600,000 iterations as of 2024)
- Argon2id: Winner of Password Hashing Competition, memory-hard
- scrypt: Memory-hard, good alternative to Argon2
Nonce/IV Management
- GCM requires a 96-bit (12-byte) nonce that must NEVER be reused with the same key
- Generate nonces using
os.urandom()(CSPRNG) - Store nonce alongside ciphertext (it is not secret)
Workflow
- Install the
cryptographylibrary:pip install cryptography - Generate or derive an encryption key
- Create a random nonce for each encryption operation
- Encrypt data using AES-256-GCM with the key and nonce
- Store nonce + ciphertext + authentication tag together
- For decryption, extract nonce, verify tag, and decrypt
Encrypted File Format
[salt: 16 bytes][nonce: 12 bytes][ciphertext: variable][tag: 16 bytes]
Security Considerations
- Always use authenticated encryption (GCM, CCM) to prevent tampering
- Never reuse a nonce with the same key (catastrophic in GCM)
- Use at least 256-bit keys for long-term data protection
- Securely wipe keys from memory after use when possible
- Rotate encryption keys periodically per organizational policy
- For disk-level encryption, consider XTS mode (AES-XTS)
Validation Criteria
- AES-256-GCM encryption produces valid ciphertext
- Decryption recovers original plaintext exactly
- Authentication tag detects any ciphertext modification
- Key derivation uses sufficient iterations/parameters
- Nonces are never reused for the same key
- Large files (>1GB) can be processed via streaming
- Encrypted file format includes all necessary metadata
Câu hỏi thường gặp
AES-256-GCM là gì?
Đây là phương pháp mã hóa hiện đại và mạnh mẽ, vừa bảo vệ dữ liệu vừa kiểm tra xem dữ liệu có bị thay đổi hay không.
Tôi có thể dùng trực tiếp mật khẩu làm khóa không?
Không, tuyệt đối không! Công cụ chuyển mật khẩu của bạn thành một khóa mã hóa mạnh bằng các phương pháp an toàn như PBKDF2 hoặc Argon2id để tăng cường bảo vệ.
Nonce là gì và vì sao quan trọng?
Nonce là một số chỉ dùng một lần. Nó rất quan trọng đối với bảo mật của chế độ GCM, vì dùng lại nonce với cùng một khóa có thể làm suy yếu toàn bộ quá trình mã hóa.
Chi tiết
Mô tả gốc của tác giả
Guides implementing AES-256 encryption in GCM mode (FIPS 197) for files and data stores at rest, covering key derivation, IV/nonce management, and authenticated encryption. Use when deploying or configuring encryption for data at rest, establishing controls to meet compliance requirements, or reviewing an implementation during a security assessment.
Độ phổ biến
- Sao GitHub
- 35k
- Vị trí xếp hạng
- #7981
- Giấy phép
- Apache-2.0
- Cập nhật
- 31/8/2026
Bình luận
- …
Thêm skill từ kho mã này
abusing-dpapi-for-credential-access
35kCung cấp cho agent AI của bạn hướng dẫn có sẵn cho một tác vụ cụ thể, giúp nó làm việc tốt hơn và nhanh hơn.
abusing-shadow-credentials-for-privesc
35kDạy agent AI của bạn viết văn bản rõ ràng và có cấu trúc tốt.
achieving-cmmc-level-2-compliance
35kGiúp agent của bạn chuẩn bị môi trường để tuân thủ CMMC Level 2. Triển khai các yêu cầu bảo mật và quản lý tài liệu cần thiết.
acquiring-disk-image-with-dd-and-dcfldd
35kGiúp agent của bạn tạo bản sao chính xác của ổ đĩa. Cách này đảm bảo không mất hay thay đổi thông tin trong quá trình điều tra.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.