mozilla/pdf.js · error · FormatError
Unknown crypto method
Error message
Unknown crypto method
What it means
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.
Source
Thrown at src/core/crypto.js:1329
num,
gen,
this.encryptionKey,
/* isAes = */ false
)
);
}
if (cfm.name === "AESV2") {
return AES128Cipher.bind(
null,
this.#buildObjectKey(
num,
gen,
this.encryptionKey,
/* isAes = */ true
)
);
}
throw new FormatError("Unknown crypto method");
};
const transform = new CipherTransform(
resolveCipher,
this.strf,
this.stmf
);
transform.embeddedFilterName = this.eff;
return transform;
}
// algorithms 1 and 2
/** @type {ResolveCipher} */
const resolveCipher = () =>
ARCFourCipher.bind(
null,
this.#buildObjectKey(num, gen, this.encryptionKey, /* isAes = */ false)
);View on GitHub (pinned to 5903d58d58)
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.
Defensive patterns
Strategy: try-catch
Try / catch
try {
const doc = await getDocument({ url }).promise;
} catch (e) {
if (e.name === 'FormatError' && e.message === 'Unknown crypto method') {
notifyUser('Unsupported crypt filter method (CFM). Only None, V2, AESV2, AESV3 are supported.');
return;
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Newer encryption methods pdf.js has not adopted; hand-edited CF dicts; buggy producers.
Related errors
- unknown encryption method
- unsupported encryption algorithm
- Invalid crypt filter name.
- invalid key length
- No password given
AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13).
Data as JSON: /api/errors/2d8530b068556493.
Report an issue: GitHub.