跳到主要内容
知仓学习社ZHICANG

implementing-rsa-key-pair-management

Generates, stores, rotates, and manages RSA key pairs following NIST

读凭据写文件读文件严重 2 · 高危 0mukul975/Anthropic-Cybersecurity-Skills

它会碰到什么

扫了多少8 个文本文件,46 KB
它会碰到什么读凭据写文件读文件
命中总数9 处
命中统计严重 2 · 高 0 · 中 5 · 低 0
逐条看命中(2 条严重或高危)
  • 严重 scripts/agent.py:182cred-paths
    p_gen.add_argument("--private-key", default="id_rsa", help="Private key output path")
  • 严重 scripts/agent.py:183cred-paths
    p_gen.add_argument("--public-key", default="id_rsa.pub", help="Public key output path")

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Implementing RSA Key Pair Management

Overview

RSA (Rivest-Shamir-Adleman) is the most widely deployed asymmetric cryptographic algorithm, used for digital signatures, key exchange, and encryption. This skill covers generating, storing, rotating, and managing RSA key pairs following NIST SP 800-57 key management guidelines, including key serialization formats (PEM, DER, PKCS#8), passphrase protection, and key strength validation.

When to Use

  • When deploying or configuring implementing rsa key pair management 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

  • Generate RSA key pairs with appropriate key sizes (2048, 3072, 4096 bits)
  • Serialize keys in PEM and DER formats with PKCS#8
  • Protect private keys with strong passphrase encryption
  • Implement key rotation with versioning
  • Extract public key components and fingerprints
  • Validate key strength and detect weak keys
  • Sign and verify data using RSA-PSS

Key Concepts

RSA Key Sizes and Security Strength

| Key Size (bits) | Security Strength (bits) | Recommended Until |

|-----------------|-------------------------|-------------------|

| 2048 | 112 | 2030 |

| 3072 | 128 | Beyond 2030 |

| 4096 | ~140 | Beyond 2030 |

RSA Padding Schemes

| Scheme | Use Case | Standard |

|--------|----------|----------|

| OAEP | Encryption | PKCS#1 v2.2 (RFC 8017) |

| PSS | Signatures | PKCS#1 v2.2 (RFC 8017) |

| PKCS#1 v1.5 | Legacy only | Deprecated for new systems |

Key Storage Formats

  • PEM: Base64-encoded with headers, human-readable
  • DER: Binary ASN.1 encoding, compact
  • PKCS#8: Standard for private key encapsulation
  • PKCS#12/PFX: Bundled key + certificate, password-protected

Security Considerations

  • Minimum 3072-bit keys for new deployments (NIST recommendation)
  • Always protect private keys with AES-256-CBC passphrase encryption
  • Use RSA-PSS for signatures (not PKCS#1 v1.5)
  • Use RSA-OAEP for encryption (not PKCS#1 v1.5)
  • Store private keys with restrictive file permissions (0600)
  • Implement key rotation at least annually

Validation Criteria

  • [ ] Key generation produces valid RSA key pair
  • [ ] Public key can be extracted from private key
  • [ ] Private key is protected with passphrase
  • [ ] RSA-PSS signature verification succeeds
  • [ ] Tampered signature verification fails
  • [ ] Key fingerprint is computed correctly
  • [ ] Key rotation maintains old key access for verification

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。