{
  "schemaVersion": "ebb.rule.v1",
  "id": "nodejs.symbol.crypto.createcipher",
  "ecosystem": "nodejs",
  "purl": "pkg:generic/nodejs",
  "affectedVersions": "vers:semver/>=22.0.0",
  "event": "removed",
  "severity": "high",
  "title": "crypto.createCipher and createDecipher have been removed",
  "summary": "Node.js removed crypto.createCipher() and crypto.createDecipher() because they use a weak key derivation (MD5, no salt) and static IVs (DEP0106, end-of-life since v22.0.0).",
  "replacement": "crypto.createCipheriv() and crypto.createDecipheriv(), with keys from crypto.scrypt() or crypto.pbkdf2() and random salts",
  "sources": [
    {
      "title": "Node.js deprecations: DEP0106 crypto.createCipher",
      "url": "https://nodejs.org/api/deprecations.html",
      "accessedAt": "2026-10-21"
    }
  ],
  "provenance": {
    "observedAt": "2026-10-21",
    "reviewedAt": "2026-10-21",
    "reviewer": "arminazimi"
  },
  "migration": {
    "constraints": [
      "Keep the behavior of the call unchanged; check the replacement's argument and error handling differences."
    ],
    "steps": [
      {
        "id": "replace-symbol",
        "title": "Switch to the iv variants",
        "instructions": "Derive the key with crypto.scrypt and a random salt, generate a random IV, and call createCipheriv or createDecipheriv; existing ciphertext needs a decryption-then-reencrypt migration.",
        "targets": "usages"
      }
    ],
    "verification": [
      {
        "command": "npm run test --if-present",
        "purpose": "Run the repository tests when defined."
      }
    ]
  }
}
