davidcastagnetoa/skills

aes_256_gcm

Cifrado AES-256-GCM para datos biométricos en reposo con autenticación integrada

First seen Mar 2, 2026

Installation

$ npx skills add davidcastagnetoa/skills --skill aes_256_gcm

Also in this package

Other skills from davidcastagnetoa/skills · top by installs.

npx skills add davidcastagnetoa/skills

Browse all from davidcastagnetoa/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 1
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,435 B
  • docs SUMMARY.md 101 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 12 installs

SKILL.md

aes256gcm

AES-256-GCM es el algoritmo de cifrado simétrico estándar para proteger datos biométricos en reposo. GCM (Galois/Counter Mode) proporciona tanto confidencialidad como autenticación de la integridad — detecta si los datos cifrados han sido manipulados.

When to use

Usar para cifrar embeddings faciales y referencias a imágenes antes de almacenar en PostgreSQL o Redis. Las imágenes se cifran en MinIO con Server-Side Encryption (mismo algoritmo, gestionado por MinIO).

Instructions

  1. Instalar: pip install cryptography
  2. Implementar en backend/core/encryption.py:

``python from cryptography.hazmat.primitives.ciphers.aead import AESGCM import os class BiometricEncryption: def init(self, key: bytes): assert len(key) == 32, "Key must be 256 bits (32 bytes)" self.aesgcm = AESGCM(key) def encrypt(self, data: bytes, associateddata: bytes = b"") -> bytes: nonce = os.urandom(12) # 96-bit nonce, único por operación ciphertext = self.aesgcm.encrypt(nonce, data, associateddata) return nonce + ciphertext # nonce prepended al ciphertext def decrypt(self, encrypted: bytes, associateddata: bytes = b"") -> bytes: nonce, ciphertext = encrypted[:12], encrypted[12:] return self.aesgcm.decrypt(nonce, ciphertext, associateddata) # lanza InvalidTag si manipulado ``

  1. Cargar clave desde Vault: ENCRYPTIONKEY = bytes.fromhex(vault.read("secret/kyc/biometrickey")).
  2. associateddata debe incluir el sessionid — vincula el ciphertext a la sesión específica, previene reutilización.
  3. Rotar la clave de cifrado anualmente sin downtime: cifrar con nueva clave, almacenar versión de clave en el registro.
  4. Nunca almacenar el nonce por separado — prependerlo al ciphertext como en el ejemplo.

Notes

  • AESGCM.decrypt() lanza cryptography.exceptions.InvalidTag si el ciphertext fue manipulado — capturar y tratar como intento de fraude.
  • Los embeddings faciales son datos biométricos especiales bajo GDPR Art. 9 — su cifrado no es opcional.
  • Tamaño del embedding cifrado: 512 floats × 4 bytes = 2048 bytes de plaintext → ~2072 bytes cifrado (nonce + ciphertext + tag).