{"record":{"id":"81d18be7351d448d","repo":"denoland/deno","slug":"err-invalid-arg-value-81d18b","errorCode":"ERR_INVALID_ARG_VALUE","errorMessage":"The property 'options.dsaEncoding' is invalid. Received ${dsaEncoding}","messagePattern":"The property 'options\\.dsaEncoding' is invalid\\. Received (.+?)","errorType":"error_code","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/internal/crypto/sig.ts","lineNumber":90,"sourceCode":"const FastBuffer = Buffer[SymbolSpecies];\n\nfunction getPadding(options) {\n  return getIntOption(\"padding\", options);\n}\n\nfunction getSaltLength(options) {\n  return getIntOption(\"saltLength\", options);\n}\n\nfunction getDSASignatureEncoding(options) {\n  if (typeof options === \"object\") {\n    const { dsaEncoding = \"der\" } = options;\n    if (dsaEncoding === \"der\") {\n      return 0;\n    } else if (dsaEncoding === \"ieee-p1363\") {\n      return 1;\n    }\n    throw new ERR_INVALID_ARG_VALUE(\"options.dsaEncoding\", dsaEncoding);\n  }\n\n  return 0;\n}\n\nfunction getIntOption(name, options) {\n  const value = options[name];\n  if (value !== undefined) {\n    if (value === value >> 0) {\n      return value;\n    }\n    throw new ERR_INVALID_ARG_VALUE(`options.${name}`, value);\n  }\n  return undefined;\n}\n\n// Private key types that need to be converted to public keys for verification\nconst PRIVATE_KEY_TYPES = [\"pkcs8\", \"sec1\"];","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/internal/crypto/sig.ts#L72-L108","documentation":"Thrown by getDSASignatureEncoding in Deno's node:crypto polyfill (ext/node/polyfills/internal/crypto/sig.ts:90) when the dsaEncoding option on the key object passed to sign()/verify() is not 'der' or 'ieee-p1363'. EC/DSA signatures can be encoded either as DER (default) or as the fixed-length IEEE P1363 r||s form; any other string is rejected with ERR_INVALID_ARG_VALUE.","triggerScenarios":"crypto.sign(null, data, { key: ecPrivateKey, dsaEncoding: 'p1363' }) — the correct spelling is 'ieee-p1363'. Also 'ieeeP1363', 'P1363', or passing dsaEncoding on a non-DSA flow with a stray value.","commonSituations":"Interop with JWS/COSE/WebCrypto which use the raw r||s format, where developers abbreviate the option name; casing errors; copying the option between sign and verify with different spellings so one side fails.","solutions":["Use exactly 'ieee-p1363' or 'der' (the default — omit dsaEncoding for DER).","If you need WebCrypto-style raw signatures, keep the byte-exact string 'ieee-p1363' in a shared constant.","Check both the signing and verifying sides use the same encoding string."],"exampleFix":"// before\nconst sig = crypto.sign('sha256', data, { key, dsaEncoding: 'p1363' });\n\n// after\nconst sig = crypto.sign('sha256', data, { key, dsaEncoding: 'ieee-p1363' });","handlingStrategy":"validation","validationCode":"const DSA_ENCODINGS = new Set(['der', 'ieee-p1363']);\nif (keyObj.dsaEncoding !== undefined && !DSA_ENCODINGS.has(keyObj.dsaEncoding)) throw new TypeError('dsaEncoding must be der or ieee-p1363');","typeGuard":"const isDsaEncoding = (v) => v === undefined || v === 'der' || v === 'ieee-p1363';","tryCatchPattern":"try { sig = crypto.sign(algo, data, keyObj); } catch (e) { if (e.code === 'ERR_INVALID_ARG_VALUE' && e.message.includes('dsaEncoding')) { keyObj = { ...keyObj, dsaEncoding: 'ieee-p1363' }; sig = crypto.sign(algo, data, keyObj); } else throw e; }","preventionTips":["Keep the literal 'ieee-p1363' in one shared constant.","Match encoding on sign and verify sides; WebCrypto/JWS expect ieee-p1363."],"tags":["node-compat","crypto","signing","dsa","ecdsa","option-validation"],"backgroundTag":"invalid-option-value","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}