{"record":{"id":"4e7d31914acd1ee8","repo":"moonD4rk/HackBrowserData","slug":"dpapi-not-supported-on-this-platform","errorCode":null,"errorMessage":"DPAPI not supported on this platform","messagePattern":"DPAPI not supported on this platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crypto/errors.go","lineNumber":14,"sourceCode":"package crypto\n\nimport \"errors\"\n\n// Sentinel errors for crypto operations.\nvar (\n\terrShortCiphertext   = errors.New(\"ciphertext too short\")\n\terrInvalidBlockSize  = errors.New(\"ciphertext is not a multiple of the block size\")\n\terrInvalidIVLength   = errors.New(\"IV length must equal block size\")\n\terrInvalidPadding    = errors.New(\"invalid PKCS5 padding\")\n\terrInvalidNonceLen   = errors.New(\"nonce length must equal GCM nonce size\")\n\terrUnsupportedIVLen  = errors.New(\"unsupported IV length\")\n\terrDecodeASN1        = errors.New(\"failed to decode ASN1 data\")\n\terrDPAPINotSupported = errors.New(\"DPAPI not supported on this platform\") //nolint:unused // used on darwin/linux only\n)\n","sourceCodeStart":1,"sourceCodeEnd":16,"githubUrl":"https://github.com/moonD4rk/HackBrowserData/blob/0503d04d7a8d0379d060268a74f1b149e5a0aad5/crypto/errors.go#L1-L16","documentation":"errDPAPINotSupported is returned by DecryptDPAPI on darwin and linux builds, where the Windows Data Protection API does not exist. On these platforms the function is a stub that always fails, since DPAPI blob decryption is only implemented in the windows build (crypto/crypto_windows.go).","triggerScenarios":"Calling DecryptDPAPI in code compiled for GOOS=darwin or GOOS=linux. Any attempt to decrypt a DPAPI-protected blob (e.g. DPAPI-wrapped Chromium master keys) on a non-Windows host hits this sentinel.","commonSituations":"Cross-platform tooling that unconditionally calls DecryptDPAPI without checking runtime.GOOS; testing Windows key decryption on a mac/linux dev machine; Windows browser profiles copied to another OS for offline analysis.","solutions":["Only call DecryptDPAPI when runtime.GOOS == \"windows\"; branch or skip the DPAPI path otherwise.","To decrypt Windows DPAPI blobs from another OS, copy the blobs to a Windows machine (or VM) and run the tool there.","Handle the sentinel with errors.Is so unsupported-platform results degrade gracefully instead of aborting extraction.","Check build tags on files calling DecryptDPAPI so it is only referenced from _windows.go code."],"exampleFix":"// before\nkey, err := crypto.DecryptDPAPI(encryptedKey)\n// after\nif runtime.GOOS != \"windows\" {\n    return nil, errDPAPINotSupported // or skip DPAPI step\n}\nkey, err := crypto.DecryptDPAPI(encryptedKey)","handlingStrategy":"try-catch","validationCode":"if runtime.GOOS != \"windows\" { return nil, errors.New(\"DPAPI requires Windows\") }","typeGuard":null,"tryCatchPattern":"key, err := crypto.DecryptDPAPI(blob)\nif errors.Is(err, crypto.ErrDPAPINotSupported) {\n    return nil, fmt.Errorf(\"DPAPI unavailable on %s; run on Windows\", runtime.GOOS)\n}","preventionTips":["Gate DPAPI calls behind runtime.GOOS == \"windows\" checks.","Use build-tagged files (_windows.go) for DPAPI-dependent code paths.","For cross-OS workflows, run the extraction on a Windows host or VM.","Fall back to alternative key sources (e.g. v10 cookies) when DPAPI is unavailable."],"tags":["dpapi","windows","platform","unsupported"],"backgroundTag":"unsupported-platform","analyzedSha":"0503d04d7a8d0379d060268a74f1b149e5a0aad5","analyzedAt":"2026-09-06T13:38:28.707Z","contentChangedAt":"2026-09-06T13:38:28.707Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}