{"record":{"id":"2d8530b068556493","repo":"mozilla/pdf.js","slug":"unknown-crypto-method","errorCode":null,"errorMessage":"Unknown crypto method","messagePattern":"Unknown crypto method","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"error","filePath":"src/core/crypto.js","lineNumber":1329,"sourceCode":"              num,\n              gen,\n              this.encryptionKey,\n              /* isAes = */ false\n            )\n          );\n        }\n        if (cfm.name === \"AESV2\") {\n          return AES128Cipher.bind(\n            null,\n            this.#buildObjectKey(\n              num,\n              gen,\n              this.encryptionKey,\n              /* isAes = */ true\n            )\n          );\n        }\n        throw new FormatError(\"Unknown crypto method\");\n      };\n\n      const transform = new CipherTransform(\n        resolveCipher,\n        this.strf,\n        this.stmf\n      );\n      transform.embeddedFilterName = this.eff;\n      return transform;\n    }\n\n    // algorithms 1 and 2\n    /** @type {ResolveCipher} */\n    const resolveCipher = () =>\n      ARCFourCipher.bind(\n        null,\n        this.#buildObjectKey(num, gen, this.encryptionKey, /* isAes = */ false)\n      );","sourceCodeStart":1311,"sourceCodeEnd":1347,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/crypto.js#L1311-L1347","documentation":"FormatError thrown by the V=4/V=5 cipher resolver when a crypt filter's CFM (Crypt Filter Method) name is not one of the supported values: None, AESV3, V2, AESV2. An unknown CFM means pdf.js has no cipher implementation for that filter and cannot decrypt streams referencing it.","triggerScenarios":"A CF dict entry with CFM set to a future or proprietary method (e.g., AESV4); a corrupt CFM value; a producer that emits a custom crypt filter method.","commonSituations":"Newer encryption methods pdf.js has not adopted; hand-edited CF dicts; buggy producers.","solutions":["Re-encrypt with a supported CFM (V2 RC4, AESV2, AESV3).","If only some streams use the unsupported filter, set those CF entries to None or remap them to Identity to skip decryption (advanced, may yield unreadable content).","Surface an 'unsupported crypt filter method' message."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const doc = await getDocument({ url }).promise;\n} catch (e) {\n  if (e.name === 'FormatError' && e.message === 'Unknown crypto method') {\n    notifyUser('Unsupported crypt filter method (CFM). Only None, V2, AESV2, AESV3 are supported.');\n    return;\n  }\n  throw e;\n}","preventionTips":["Re-encrypt with a supported CFM before ingestion.","Audit producers for non-standard CFM values when adding new ones.","Classify unsupported CFM as a hard error in the UI rather than retrying."],"tags":["encryption","pdf-security","format-error","crypt-filter","unsupported-feature"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}