Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计提醒

cryptographycryptography 开发

Agent Skill

cryptography 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

659

周安装

28

GitHub Stars

6

下载量

231
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cryptography(cryptography 开发)
来源仓库:https://github.com/hack23/homepage
仓库路径:skills/cryptography
安装命令:
npx skills add https://github.com/hack23/homepage --skill cryptography
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/hack23/homepage --skill cryptography

简介

密码学开发技能处理 GitHub 协作信息,支持仓库状态与代码变更跟踪。

  • 适用于围绕 Issue、Pull Request 和分支管理的信息组织与整理任务。
  • 通过 npx skills add 命令安装,需查阅原始 README 了解具体功能细节。
  • 使用前应确认权限范围,避免对生产环境或私有仓库执行写操作。
  • 建议在实际使用中验证输出,确保不引入安全风险或误判情况。

SKILL.md

Cryptography Skill

Purpose

This skill enforces cryptographic requirements as defined in the Hack23 ISMS Cryptographic Controls Policy. It ensures that all cryptographic operations use approved algorithms and follow best practices for key management.

Rules

Approved Algorithms

Symmetric Encryption - MUST USE:

  • AES-256 (Advanced Encryption Standard, 256-bit key)
  • AES-128 (minimum, prefer AES-256)
  • ChaCha20-Poly1305 (for authenticated encryption)

Asymmetric Encryption - MUST USE:

  • RSA-2048 or higher (minimum 2048-bit key, prefer 3072 or 4096)
  • ECDSA with P-256, P-384, or P-521 curves
  • Ed25519 (EdDSA with Curve25519)

Hashing - MUST USE:

  • SHA-256 (minimum)
  • SHA-384
  • SHA-512
  • SHA-3 family
  • BLAKE2 (for high-performance applications)

Password Hashing - MUST USE:

  • bcrypt (cost factor 12 minimum)
  • scrypt
  • Argon2id (preferred)
  • PBKDF2 with SHA-256, minimum 100,000 iterations

Message Authentication - MUST USE:

  • HMAC-SHA256 (minimum)
  • HMAC-SHA512

MUST NOT USE (Deprecated/Broken):

  • DES, 3DES
  • MD5, SHA-1 (except for non-security purposes like checksums)
  • RC4
  • RSA < 2048 bits
  • CBC mode without authenticated encryption
  • ECB mode (ever)

TLS/SSL Requirements

MUST:

  • Use TLS 1.2 as minimum
  • Prefer TLS 1.3
  • Use strong cipher suites only
  • Verify server certificates
  • Use certificate pinning for high-security applications
  • Enforce HSTS (HTTP Strict Transport Security)
  • Use Perfect Forward Secrecy (PFS) cipher suites

TLS 1.2 Approved Cipher Suites (in order of preference):

TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256

TLS 1.3 Approved Cipher Suites:

TLS_AES_256_GCM_SHA384
TLS_AES_128_GCM_SHA256
TLS_CHACHA20_POLY1305_SHA256

MUST NOT:

  • Use SSL 2.0, SSL 3.0, TLS 1.0, TLS 1.1
  • Use export-grade ciphers
  • Use NULL cipher suites
  • Use anonymous cipher suites
  • Accept self-signed certificates in production (except for explicitly trusted CAs)

Key Management

MUST:

  • Generate keys using cryptographically secure random number generators (CSPRNGs)
  • Store keys securely (use key management systems, HSMs for highly sensitive keys)
  • Never hardcode keys in source code
  • Use environment variables or secret management systems
  • Rotate keys according to schedule:

- TLS certificates: Annually or before expiry - Symmetric keys: Annually for CONFIDENTIAL data, quarterly for RESTRICTED - API keys: Annually or on compromise - Passwords: 90 days for privileged accounts

  • Destroy keys securely when no longer needed
  • Log key lifecycle events (creation, rotation, destruction)
  • Separate key generation from key usage
  • Use different keys for different purposes
  • Implement key escrow for business continuity (with strict controls)

Key Length Requirements:

  • AES: 256 bits (128 minimum)
  • RSA: 2048 bits minimum (prefer 3072 or 4096)
  • ECDSA: P-256 minimum (prefer P-384 or P-521)
  • HMAC: 256 bits minimum

MUST NOT:

  • Store keys in plaintext
  • Commit keys to version control
  • Send keys via email or unencrypted channels
  • Reuse keys across different applications or contexts
  • Use weak key derivation functions
  • Share private keys

Random Number Generation

MUST:

  • Use cryptographically secure PRNGs (CSPRNGs)
  • For Node.js: crypto.randomBytes(), crypto.randomInt()
  • For Python: secrets module, os.urandom()
  • For Java: SecureRandom
  • For browser: window.crypto.getRandomValues()

MUST NOT:

  • Use Math.random() for security purposes
  • Use predictable seeds
  • Use non-cryptographic PRNGs for security tokens, keys, or IVs

Initialization Vectors (IVs) and Nonces

MUST:

  • Generate unique IV/nonce for each encryption operation
  • Use cryptographically random IVs for CBC mode
  • Use sequential nonces for CTR/GCM modes (ensure uniqueness)
  • Store IV with ciphertext (IVs are not secret)
  • Never reuse IV with same key

MUST NOT:

  • Use predictable or sequential IVs with CBC mode
  • Reuse nonces with same key in CTR/GCM modes
  • Treat IVs as secrets (they should be random but can be public)

Certificate Management

MUST:

  • Use certificates from trusted Certificate Authorities (CAs)
  • Validate certificate chains
  • Check certificate revocation status (CRL/OCSP)
  • Use Subject Alternative Names (SANs) for multiple domains
  • Implement certificate expiry monitoring and alerting
  • Renew certificates before expiry (30-day minimum buffer)
  • Use automated certificate management (e.g., Let's Encrypt with auto-renewal)
  • Store private keys securely (encrypted, access-controlled)
  • Use separate certificates for different services/environments

Certificate Validity:

  • Production: Maximum 1 year
  • Development/Testing: Maximum 90 days
  • Internal CA: Maximum 2 years

MUST NOT:

  • Use self-signed certificates in production (except for internal CA)
  • Share private keys between certificates
  • Use wildcard certificates without proper access controls
  • Ignore certificate warnings or errors

Encryption at Rest

MUST:

  • Encrypt CONFIDENTIAL and RESTRICTED data at rest
  • Use full disk encryption for laptops and mobile devices
  • Use database encryption (TDE) for sensitive databases
  • Encrypt sensitive files before storage in cloud services
  • Use envelope encryption (encrypt data key with master key)
  • Store encryption keys separately from encrypted data

MUST NOT:

  • Store unencrypted CONFIDENTIAL or RESTRICTED data
  • Use same key for encryption and authentication
  • Use deterministic encryption for high-sensitivity data

Encryption in Transit

MUST:

  • Use TLS 1.2+ for all network communications
  • Encrypt email containing CONFIDENTIAL or RESTRICTED data (S/MIME or PGP)
  • Use VPN for remote access to internal systems
  • Use SSH (not Telnet) for remote administration
  • Use HTTPS for all web applications
  • Use secure protocols (SFTP, FTPS, not FTP)

MUST NOT:

  • Transmit RESTRICTED data over unencrypted channels
  • Use unencrypted protocols (HTTP, FTP, Telnet, SMTP without TLS)
  • Disable certificate verification

Examples

Example 1: Symmetric Encryption (Node.js)

const crypto = require('crypto');

// GOOD: AES-256-GCM encryption
function encrypt(plaintext, key) {
  // Generate random IV (12 bytes for GCM)
  const iv = crypto.randomBytes(12);

  // Create cipher
  const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);

  // Encrypt
  let ciphertext = cipher.update(plaintext, 'utf8', 'hex');
  ciphertext += cipher.final('hex');

  // Get authentication tag
  const authTag = cipher.getAuthTag();

  // Return IV + authTag + ciphertext
  return {
    iv: iv.toString('hex'),
    authTag: authTag.toString('hex'),
    ciphertext: ciphertext
  };
}

function decrypt(encrypted, key) {
  // Create decipher
  const decipher = crypto.createDecipheriv(
    'aes-256-gcm',
    key,
    Buffer.from(encrypted.iv, 'hex')
  );

  // Set authentication tag
  decipher.setAuthTag(Buffer.from(encrypted.authTag, 'hex'));

  // Decrypt
  let plaintext = decipher.update(encrypted.ciphertext, 'hex', 'utf8');
  plaintext += decipher.final('utf8');

  return plaintext;
}

// Generate secure key (store securely, don't hardcode!)
const key = crypto.randomBytes(32); // 256 bits

// Usage
const encrypted = encrypt('Sensitive data', key);
console.log('Encrypted:', encrypted);

const decrypted = decrypt(encrypted, key);
console.log('Decrypted:', decrypted);

// BAD: Using deprecated algorithm
function encryptBad(plaintext, key) {
  // NEVER use DES!
  const cipher = crypto.createCipheriv('des-ede3-cbc', key, iv);
  return cipher.update(plaintext, 'utf8', 'hex') + cipher.final('hex');
}

Example 2: Password Hashing (Node.js with bcrypt)

const bcrypt = require('bcrypt');

// GOOD: bcrypt with appropriate cost factor
async function hashPassword(password) {
  // Cost factor 12 = 2^12 iterations (minimum)
  const saltRounds = 12;
  const hash = await bcrypt.hash(password, saltRounds);
  return hash;
}

async function verifyPassword(password, hash) {
  return await bcrypt.compare(password, hash);
}

// Usage
const password = 'MySecurePassword123!';
const hash = await hashPassword(password);
console.log('Hash:', hash);

const isValid = await verifyPassword(password, hash);
console.log('Valid:', isValid);

// BAD: Using weak hashing
function hashPasswordBad(password) {
  // NEVER use MD5 or SHA-1 for passwords!
  return crypto.createHash('md5').update(password).digest('hex');
}

// BAD: Insufficient iterations
async function hashPasswordWeak(password) {
  // Cost factor 4 is too weak!
  return await bcrypt.hash(password, 4);
}

Example 3: Secure Random Generation

const crypto = require('crypto');

// GOOD: Cryptographically secure random
function generateToken(length = 32) {
  return crypto.randomBytes(length).toString('hex');
}

function generateApiKey() {
  return crypto.randomBytes(32).toString('base64');
}

function generateSecurePin(digits = 6) {
  const max = Math.pow(10, digits);
  return crypto.randomInt(0, max).toString().padStart(digits, '0');
}

// Usage
const sessionToken = generateToken();
const apiKey = generateApiKey();
const pin = generateSecurePin(6);

// BAD: Using Math.random() for security
function generateTokenBad() {
  // NEVER use Math.random() for security!
  return Math.random().toString(36).substring(2);
}

Example 4: TLS Configuration (Node.js HTTPS Server)

const https = require('https');
const fs = require('fs');

// GOOD: Secure TLS configuration
const options = {
  key: fs.readFileSync('/path/to/private-key.pem'),
  cert: fs.readFileSync('/path/to/certificate.pem'),
  ca: fs.readFileSync('/path/to/ca-bundle.pem'),

  // TLS 1.2 minimum
  minVersion: 'TLSv1.2',

  // Prefer TLS 1.3
  maxVersion: 'TLSv1.3',

  // Strong cipher suites only
  ciphers: [
    'TLS_AES_256_GCM_SHA384',
    'TLS_AES_128_GCM_SHA256',
    'TLS_CHACHA20_POLY1305_SHA256',
    'ECDHE-RSA-AES256-GCM-SHA384',
    'ECDHE-RSA-AES128-GCM-SHA256',
    'ECDHE-ECDSA-AES256-GCM-SHA384',
    'ECDHE-ECDSA-AES128-GCM-SHA256'
  ].join(':'),

  // Prefer server cipher order
  honorCipherOrder: true,

  // Enable Perfect Forward Secrecy
  ecdhCurve: 'prime256v1:secp384r1:secp521r1',

  // Require client certificate (if needed)
  requestCert: false,
  rejectUnauthorized: true
};

const server = https.createServer(options, (req, res) => {
  // Set security headers
  res.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains; preload');
  res.setHeader('X-Content-Type-Options', 'nosniff');
  res.setHeader('X-Frame-Options', 'DENY');

  res.writeHead(200);
  res.end('Secure connection');
});

server.listen(443);

// BAD: Weak TLS configuration
const optionsBad = {
  key: fs.readFileSync('/path/to/private-key.pem'),
  cert: fs.readFileSync('/path/to/certificate.pem'),

  // NEVER allow TLS 1.0/1.1
  minVersion: 'TLSv1.0', // TOO WEAK!

  // Allowing weak ciphers
  ciphers: 'ALL', // INSECURE!

  // Not rejecting unauthorized
  rejectUnauthorized: false // DANGEROUS!
};

Example 5: Key Derivation (PBKDF2)

const crypto = require('crypto');

// Derive encryption key from password
function deriveKey(password, salt, keyLength = 32) {
  // Use PBKDF2 with SHA-256, 100,000 iterations minimum
  return crypto.pbkdf2Sync(
    password,
    salt,
    100000, // iterations (minimum)
    keyLength,
    'sha256'
  );
}

// Usage
const password = 'UserPassword123!';
const salt = crypto.randomBytes(16); // Store salt with encrypted data
const key = deriveKey(password, salt, 32); // 256-bit key

console.log('Derived key:', key.toString('hex'));

// BAD: Weak key derivation
function deriveKeyWeak(password) {
  // NEVER use simple hashing for key derivation!
  return crypto.createHash('sha256').update(password).digest();
}

Example 6: Secure File Encryption

const crypto = require('crypto');
const fs = require('fs').promises;

async function encryptFile(inputPath, outputPath, key) {
  // Read file
  const plaintext = await fs.readFile(inputPath);

  // Generate IV
  const iv = crypto.randomBytes(12);

  // Encrypt
  const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
  const ciphertext = Buffer.concat([
    cipher.update(plaintext),
    cipher.final()
  ]);

  // Get auth tag
  const authTag = cipher.getAuthTag();

  // Write IV + authTag + ciphertext
  const encrypted = Buffer.concat([iv, authTag, ciphertext]);
  await fs.writeFile(outputPath, encrypted);
}

async function decryptFile(inputPath, outputPath, key) {
  // Read encrypted file
  const encrypted = await fs.readFile(inputPath);

  // Extract IV, auth tag, and ciphertext
  const iv = encrypted.slice(0, 12);
  const authTag = encrypted.slice(12, 28);
  const ciphertext = encrypted.slice(28);

  // Decrypt
  const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);
  decipher.setAuthTag(authTag);

  const plaintext = Buffer.concat([
    decipher.update(ciphertext),
    decipher.final()
  ]);

  // Write decrypted file
  await fs.writeFile(outputPath, plaintext);
}

// Usage
const key = crypto.randomBytes(32);
await encryptFile('sensitive.pdf', 'sensitive.pdf.enc', key);
await decryptFile('sensitive.pdf.enc', 'sensitive-decrypted.pdf', key);

Example 7: Certificate Validation

const https = require('https');
const tls = require('tls');

// GOOD: Verify certificate
function makeSecureRequest(url) {
  return new Promise((resolve, reject) => {
    https.get(url, {
      // Verify certificate chain
      rejectUnauthorized: true,

      // Check hostname
      checkServerIdentity: (hostname, cert) => {
        const err = tls.checkServerIdentity(hostname, cert);
        if (err) {
          return err;
        }

        // Additional checks
        const now = new Date();
        const notBefore = new Date(cert.valid_from);
        const notAfter = new Date(cert.valid_to);

        if (now < notBefore || now > notAfter) {
          return new Error('Certificate not valid for current date');
        }

        return undefined;
      }
    }, (res) => {
      let data = '';
      res.on('data', chunk => data += chunk);
      res.on('end', () => resolve(data));
    }).on('error', reject);
  });
}

// BAD: Skipping certificate verification
function makeInsecureRequest(url) {
  return new Promise((resolve, reject) => {
    https.get(url, {
      // NEVER disable certificate verification!
      rejectUnauthorized: false // DANGEROUS!
    }, (res) => {
      let data = '';
      res.on('data', chunk => data += chunk);
      res.on('end', () => resolve(data));
    }).on('error', reject);
  });
}

Related ISMS Policies

Related Documentation

Compliance Mapping

ISO 27001:2022

  • A.8.24 Use of cryptography

NIST Cybersecurity Framework

  • PR.DS-1: Data-at-rest is protected
  • PR.DS-2: Data-in-transit is protected

CIS Controls

  • Control 3: Data Protection

- 3.10 Encrypt Sensitive Data in Transit - 3.11 Encrypt Sensitive Data at Rest

Key Rotation Schedule

Key TypeRotation FrequencyTrigger for Immediate Rotation
TLS CertificatesAnnuallyCompromise, algorithm weakness
Symmetric Keys (RESTRICTED)QuarterlyCompromise, employee departure
Symmetric Keys (CONFIDENTIAL)AnnuallyCompromise
API KeysAnnuallyCompromise, employee departure
SSH Keys2 yearsCompromise
Root CA Keys10 yearsCompromise
Database Encryption Keys2 yearsCompromise

Enforcement

Violations of cryptographic requirements:

  • Critical (use of banned algorithms, hardcoded keys): Block deployment
  • High (weak configurations, missing encryption): Require immediate remediation
  • Medium (suboptimal configurations): Remediate within sprint

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.62%
按下载量换算80

Claude

29.51%
按下载量换算68

Cursor

18.8%
按下载量换算43

Gemini CLI

10.15%
按下载量换算23

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills