Detect and transform complete PEM private-key blocks across all runtimes.
PRIVATE_KEY is available in Core 0.4.0 or newer.
PRIVATE_KEY is enabled by default in Rust, Python, Node.js, and browser WASM.
It recognizes complete PEM blocks using these case-sensitive labels:
PRIVATE KEY
RSA PRIVATE KEY
EC PRIVATE KEY
DSA PRIVATE KEY
OPENSSH PRIVATE KEY
ENCRYPTED PRIVATE KEY
The matching -----BEGIN …----- and -----END …----- delimiters must each
occupy an entire line. LF and CRLF line endings are supported. The body must
contain nonempty Base64-shaped lines using ASCII letters, digits, +, /, and
at most two trailing = characters. Its combined length must be divisible by
four. Empty lines, spaces, tabs, and data after padding are rejected.This is lexical detection: it does not decode, decrypt, or validate the key.
The deliberately synthetic body below demonstrates the shape without providing
a usable key. Public keys, certificates, truncated fragments, indented or inline
delimiters, and legacy Proc-Type / DEK-Info header blocks are outside this
initial detector’s scope.
Node.js uses the same configuration with scan and scanAndTransform from
@datafog/node. Browser applications import these functions and initialize
@datafog/wasm first. Rust uses scan and scan_and_transform. See the
SDK reference for each runtime’s return types.
Finding and transformation boundaries
Each finding covers the entire block, including both delimiters and every
original internal newline. It excludes the newline following the closing
delimiter and any surrounding text. The finding has entity type PRIVATE_KEY,
detector name datafog-core/private-key, the Core detector version, and no
confidence score.Byte, Unicode code-point, and JavaScript UTF-16 offsets retain the standard
finding contract. Structured scans inspect each string
value independently; a header and footer in separate fields never form a key.Redaction replaces the whole block with [PRIVATE_KEY]; masking and removal
also operate on its entire span. Existing entity selection, exact allowlists,
and source-range validation apply. Pseudonymization and reversible tokenization use
the existing providers in Rust, Python, and Node.js. Browser WASM rejects these
provider-dependent strategies as documented in its SDK reference.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"datafog","description":"Local file protection with datafog MCP and privacy SDKs with datafog core","colors":{"primary":"#A83226","light":"#FF7A1A","dark":"#C0362C"},"logo":{"light":"https://mintcdn.com/data-fog/c_gYqIyRG2e6pQHL/images/datafog-wordmark-light.svg?fit=max\u0026auto=format\u0026n=c_gYqIyRG2e6pQHL\u0026q=85\u0026s=42268b386b96762a93277a16809d5060","dark":"https://mintcdn.com/data-fog/c_gYqIyRG2e6pQHL/images/datafog-wordmark.svg?fit=max\u0026auto=format\u0026n=c_gYqIyRG2e6pQHL\u0026q=85\u0026s=b6555b4e26dabacfb597678915a04591","href":"https://datafog.ai"},"favicon":"https://mintcdn.com/data-fog/c_gYqIyRG2e6pQHL/favicon.svg?fit=max\u0026auto=format\u0026n=c_gYqIyRG2e6pQHL\u0026q=85\u0026s=c7047c2f037202d4fb3e32fbc8c71125","appearance":{"default":"system","strict":false},"background":{"color":{"light":"#EEF0EF","dark":"#0E1316"}},"navbar":{"links":[{"href":"https://datafog.ai","label":"datafog home"}]},"seo":{"metatags":{"og:image":"https://docs.datafog.ai/images/og-docs.png","twitter:image":"https://docs.datafog.ai/images/og-docs.png","twitter:card":"summary_large_image","theme-color":"#0E1316","og:image:width":"1200","og:image:height":"630","og:image:type":"image/png","og:image:alt":"datafog documentation — Guides for MCP and Core SDK.","twitter:image:alt":"datafog documentation — Guides for MCP and Core SDK.","og:site_name":"datafog documentation"}},"fonts":{"heading":{"family":"Geist","weight":300,"source":"fonts/geist-latin.woff2","format":"woff2"},"body":{"family":"Geist","weight":400,"source":"fonts/geist-latin.woff2","format":"woff2"}},"styling":{"codeblocks":{"theme":"github-dark"},"latex":false},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/DataFog"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"data-fog","hasAudioNarration":false,"actualSubdomain":"data-fog","customDomains":["docs.datafog.ai"],"gitSource":{"type":"github","owner":"datafog","repo":"datafog-core","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6af90baf642a716c8d8a5d7d","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Core SDK","count":44},{"language":"default","tag":"Reference","count":19},{"language":"default","tag":"Project","count":14},{"language":"default","tag":"Releases","count":13},{"language":"default","tag":"Detection coverage","count":12},{"language":"default","tag":"SDK reference","count":7},{"language":"default","tag":"Guides","count":6},{"language":"default","tag":"Get started","count":4},{"language":"default","tag":"MCP","count":4},{"language":"default","tag":"Research","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":"@font-face{font-family:'Geist';src:url('/fonts/geist-latin.woff2') format('woff2');font-style:normal;font-weight:100 900;font-display:swap}@font-face{font-family:'Geist Mono';src:url('/fonts/geist-mono-latin.woff2') format('woff2');font-style:normal;font-weight:100 900;font-display:swap}:root{--df-ground: #EEF0EF;--df-surface: #FFFFFF;--df-ink: #0E1316;--df-secondary: #46505A;--df-border: #D2D8D7;--df-link: #A83226;--df-inline-code: #E1E6E4;--df-orange: #C0362C;--df-signal: #FF7A1A;--df-night: #0E1316;--df-fog: #A7B2B1}.dark{--df-ground: #0E1316;--df-surface: #1A2226;--df-ink: #EEF0EF;--df-secondary: #A7B2B1;--df-border: #46505A;--df-link: #FF7A1A;--df-inline-code: #1A2226}body{color:var(--df-ink);background:var(--df-ground);-webkit-font-smoothing:antialiased}#navbar,#sidebar,#mobile-nav{background:var(--df-ground);border-color:var(--df-border)}#page-title,.mdx-content h1,.mdx-content h2,.mdx-content h3{color:var(--df-ink);font-family:'Geist', sans-serif;font-weight:300;letter-spacing:-.03em;text-wrap:balance}#page-title,.mdx-content h1{font-weight:200;letter-spacing:-.04em;line-height:1.12}.mdx-content{color:var(--df-secondary);line-height:1.65}.mdx-content strong{color:var(--df-ink)}.eyebrow{color:var(--df-link);font:400 12px 'Geist Mono', monospace;text-transform:uppercase;letter-spacing:.1em}.card{background:var(--df-surface);border:1px solid var(--df-border);border-radius:18px;box-shadow:none}.card:hover{border-color:var(--df-link)}.mdx-content a:not(.card){color:var(--df-link);text-decoration:underline;text-underline-offset:4px}.mdx-content a:not(.card):hover{text-decoration-thickness:2px}code,pre,kbd,samp{font-family:'Geist Mono', monospace!important}.mdx-content :not(pre)>code{background:var(--df-inline-code);color:var(--df-ink);border-radius:4px}.code-block,.code-group{background:var(--df-night)!important;border-color:#46505A!important;border-radius:12px;color:#EEF0EF}.code-block pre,.code-group pre{background:transparent!important}.code-block code{background:transparent;color:#EEF0EF}.code-group [role=\"tab\"]{color:var(--df-fog)}.code-group [role=\"tab\"][aria-selected=\"true\"]{color:var(--df-signal)}#search-bar-entry,#search-bar-entry-mobile{background:var(--df-surface);border:1px solid var(--df-border);border-radius:999px;color:var(--df-secondary)}:where(a,button,input,summary):focus-visible{outline:2px solid var(--df-link);outline-offset:4px}::selection{background:var(--df-orange);color:#FFFFFF}.callout[data-callout-type=\"note\"]{background:var(--df-surface);border-color:var(--df-border);border-radius:18px}.callout[data-callout-type=\"note\"] [data-component-part=\"callout-content\"]{color:var(--df-secondary)}.callout[data-callout-type=\"note\"] svg{color:var(--df-link)}.df-token{display:inline-block;background:var(--df-orange);color:#FFFFFF;border-radius:999px;padding:0 .55em;font:.85em/1.6 'Geist Mono', monospace}"}],"page":{"pagePath":"reference/private-keys","slug":"/reference/private-keys","pageMetadata":{"title":"Private keys","description":"Detect and transform complete PEM private-key blocks across all runtimes.","href":"/reference/private-keys"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Detect and transform complete PEM private-key blocks across all runtimes.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);return _jsxs(_Fragment,{children:[_jsxs(Note,{children:[_jsx(_components.code,{children:`PRIVATE_KEY`}),` is available in Core 0.4.0 or newer.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`PRIVATE_KEY`}),` is enabled by default in Rust, Python, Node.js, and browser WASM.\nIt recognizes complete PEM blocks using these case-sensitive labels:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`PRIVATE KEY`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`RSA PRIVATE KEY`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`EC PRIVATE KEY`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`DSA PRIVATE KEY`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`OPENSSH PRIVATE KEY`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`ENCRYPTED PRIVATE KEY`})}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The matching `,_jsx(_components.code,{children:`-----BEGIN …-----`}),` and `,_jsx(_components.code,{children:`-----END …-----`}),` delimiters must each\noccupy an entire line. LF and CRLF line endings are supported. The body must\ncontain nonempty Base64-shaped lines using ASCII letters, digits, `,_jsx(_components.code,{children:`+`}),`, `,_jsx(_components.code,{children:`/`}),`, and\nat most two trailing `,_jsx(_components.code,{children:`=`}),` characters. Its combined length must be divisible by\nfour. Empty lines, spaces, tabs, and data after padding are rejected.`]}),`\n`,_jsxs(_components.p,{children:[`This is lexical detection: it does not decode, decrypt, or validate the key.\nThe deliberately synthetic body below demonstrates the shape without providing\na usable key. Public keys, certificates, truncated fragments, indented or inline\ndelimiters, and legacy `,_jsx(_components.code,{children:`Proc-Type`}),` / `,_jsx(_components.code,{children:`DEK-Info`}),` header blocks are outside this\ninitial detector’s scope.`]}),`\n`,_jsx(Heading,{level:`2`,id:`scan-and-redact`,children:`Scan and redact`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-dark github-dark`,style:{backgroundColor:`#24292e`,\"--shiki-dark-bg\":`#24292e`,color:`#e1e4e8`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` datafog_core `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`as`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` df`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`pem `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` \"-----BEGIN PRIVATE KEY-----`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`YWJjZA==`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`-----END PRIVATE KEY-----\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`findings `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` df.scan(pem)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`assert`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` findings[`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`0`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`].entity_type `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`==`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` \"PRIVATE_KEY\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`result `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` df.scan_and_transform(pem, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` \"transform\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` \"default\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"strategy\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"redact\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` \"entities\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: [`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"PRIVATE_KEY\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`})`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`assert`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` result.text `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`==`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` \"[PRIVATE_KEY]\"`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Node.js uses the same configuration with `,_jsx(_components.code,{children:`scan`}),` and `,_jsx(_components.code,{children:`scanAndTransform`}),` from\n`,_jsx(_components.code,{children:`@datafog/node`}),`. Browser applications import these functions and initialize\n`,_jsx(_components.code,{children:`@datafog/wasm`}),` first. Rust uses `,_jsx(_components.code,{children:`scan`}),` and `,_jsx(_components.code,{children:`scan_and_transform`}),`. See the\n`,_jsx(_components.a,{href:`/reference/rust`,children:`SDK reference`}),` for each runtime’s return types.`]}),`\n`,_jsx(Heading,{level:`2`,id:`finding-and-transformation-boundaries`,children:`Finding and transformation boundaries`}),`\n`,_jsxs(_components.p,{children:[`Each finding covers the entire block, including both delimiters and every\noriginal internal newline. It excludes the newline following the closing\ndelimiter and any surrounding text. The finding has entity type `,_jsx(_components.code,{children:`PRIVATE_KEY`}),`,\ndetector name `,_jsx(_components.code,{children:`datafog-core/private-key`}),`, the Core detector version, and no\nconfidence score.`]}),`\n`,_jsxs(_components.p,{children:[`Byte, Unicode code-point, and JavaScript UTF-16 offsets retain the standard\n`,_jsx(_components.a,{href:`/concepts/findings-and-ranges`,children:`finding contract`}),`. Structured scans inspect each string\nvalue independently; a header and footer in separate fields never form a key.`]}),`\n`,_jsxs(_components.p,{children:[`Redaction replaces the whole block with `,_jsx(_components.code,{children:`[PRIVATE_KEY]`}),`; masking and removal\nalso operate on its entire span. Existing entity selection, exact allowlists,\nand source-range validation apply. Pseudonymization and reversible tokenization use\nthe existing providers in Rust, Python, and Node.js. Browser WASM rejects these\nprovider-dependent strategies as documented in its `,_jsx(_components.a,{href:`/reference/browser-wasm`,children:`SDK reference`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":"github-dark"},"config":{},"pageMetadata":{"title":"Private keys","description":"Detect and transform complete PEM private-key blocks across all runtimes.","href":"/reference/private-keys"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Scan and redact","slug":"scan-and-redact","depth":2,"children":[]},{"title":"Finding and transformation boundaries","slug":"finding-and-transformation-boundaries","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"data-fog","siteName":"datafog","title":"Private keys - datafog","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-12T22:33:55.391Z","originalFileLocation":"reference/private-keys.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Detect and transform complete PEM private-key blocks across all runtimes.\">\u003cmeta data-mint-head name=\"application-name\" content=\"datafog\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Private keys - datafog\">\u003cmeta data-mint-head property=\"og:description\" content=\"Detect and transform complete PEM private-key blocks across all runtimes.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"datafog documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.datafog.ai/reference/private-keys\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://docs.datafog.ai/images/og-docs.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Private keys - datafog\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Detect and transform complete PEM private-key blocks across all runtimes.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://docs.datafog.ai/images/og-docs.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"datafog\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#A83226\">\u003cmeta data-mint-head name=\"theme-color\" content=\"#0E1316\">\u003cmeta data-mint-head name=\"og:image:type\" content=\"image/png\">\u003cmeta data-mint-head name=\"og:image:alt\" content=\"datafog documentation — Guides for MCP and Core SDK.\">\u003cmeta data-mint-head name=\"twitter:image:alt\" content=\"datafog documentation — Guides for MCP and Core SDK.\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.datafog.ai/reference/private-keys\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/reference/private-keys.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.datafog.ai/#organization\",\"name\":\"datafog\",\"url\":\"https://docs.datafog.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/data-fog/c_gYqIyRG2e6pQHL/images/datafog-wordmark-light.svg?fit=max\u0026auto=format\u0026n=c_gYqIyRG2e6pQHL\u0026q=85\u0026s=42268b386b96762a93277a16809d5060\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.datafog.ai#website\",\"name\":\"datafog\",\"url\":\"https://docs.datafog.ai\",\"publisher\":{\"@id\":\"https://docs.datafog.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.datafog.ai/reference/private-keys#webpage\",\"url\":\"https://docs.datafog.ai/reference/private-keys\",\"name\":\"Private keys\",\"description\":\"Detect and transform complete PEM private-key blocks across all runtimes.\",\"dateModified\":\"2026-10-12T22:33:55.391Z\",\"isPartOf\":{\"@id\":\"https://docs.datafog.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.datafog.ai/reference/private-keys#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.datafog.ai/reference/private-keys#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Reference\",\"item\":\"https://docs.datafog.ai/reference/rust\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Detection coverage\",\"item\":\"https://docs.datafog.ai/reference/german-entities\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Private keys\",\"item\":\"https://docs.datafog.ai/reference/private-keys\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.datafog.ai/reference/private-keys#article\",\"headline\":\"Private keys\",\"name\":\"Private keys\",\"description\":\"Detect and transform complete PEM private-key blocks across all runtimes.\",\"url\":\"https://docs.datafog.ai/reference/private-keys\",\"mainEntityOfPage\":{\"@id\":\"https://docs.datafog.ai/reference/private-keys#webpage\"},\"image\":\"https://docs.datafog.ai/images/og-docs.png\",\"dateModified\":\"2026-10-12T22:33:55.391Z\",\"publisher\":{\"@id\":\"https://docs.datafog.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.datafog.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"datafog\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"datafog\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/reference/private-keys.md","siteName":"datafog","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/DataFog"}]},"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":""}]},{"tab":"MCP","pages":[{"title":"MCP","href":"/mcp/quickstart"}]},{"tab":"Core SDK","groups":[{"group":"Get started","pages":[{"sidebarTitle":"Overview","title":"datafog core","icon":"shield-halved","href":"/core"},{"title":"Installation","icon":"download","href":"/get-started/installation"},{"title":"Quickstart","icon":"play","href":"/get-started/quickstart"}]},{"group":"Core concepts","pages":[{"title":"Findings and text ranges","icon":"location-crosshairs","href":"/concepts/findings-and-ranges"},{"title":"Privacy transformations","icon":"wand-magic-sparkles","href":"/concepts/privacy-transformations"}]},{"group":"Guides","pages":[{"title":"Migrate from datafog Python","icon":"arrow-right-arrow-left","href":"/guides/migrating-from-datafog-python"},{"title":"Configure transformations","icon":"sliders","href":"/guides/configuration"},{"title":"Email boundaries in source files","href":"/guides/email-boundaries"},{"title":"Pseudonymization","icon":"key","href":"/guides/pseudonymization"},{"title":"Tokenization and restoration","icon":"rotate","href":"/guides/tokenization-and-restoration"},{"title":"Discover and protect person fields","icon":"user-shield","href":"/guides/person-discovery"}]},{"group":"Reference","pages":[{"group":"SDK reference","expanded":false,"pages":[{"title":"Rust","icon":"gear","href":"/reference/rust"},{"title":"Python","icon":"python","href":"/reference/python"},{"title":"Node.js","icon":"node-js","href":"/reference/node"},{"title":"Browser / WASM","icon":"globe","href":"/reference/browser-wasm"},{"title":"Errors","icon":"triangle-exclamation","href":"/reference/errors"},{"title":"Runtime capabilities","href":"/reference/capabilities"},{"title":"Compatibility policy","href":"/reference/compatibility"}]},{"group":"Detection coverage","expanded":false,"pages":[{"title":"German entities","icon":"fingerprint","href":"/reference/german-entities"},{"title":"JWT","href":"/reference/jwt"},{"title":"Bearer tokens","description":"Detect explicit Authorization header credentials with precise token spans.","href":"/reference/bearer-token"},{"title":"Private keys","href":"/reference/private-keys"},{"title":"API keys","description":"Provider-prefixed GitHub tokens and Stripe secret or restricted keys.","href":"/reference/api-keys"},{"title":"UUID identifiers","icon":"fingerprint","href":"/reference/uuid"},{"title":"US routing numbers","href":"/reference/us-routing-number"},{"title":"Labelled account numbers","href":"/reference/account-number"},{"title":"Labelled street addresses","href":"/reference/street-address"},{"title":"Embedded name and address detection","href":"/reference/embedded-cnn"},{"title":"National Provider Identifiers","href":"/reference/npi"},{"title":"Credential URIs","href":"/reference/credential-uri"}]}]},{"group":"Project","pages":[{"group":"Releases","expanded":false,"pages":[{"title":"1.0.0","icon":"tag","href":"/releases/1-0-0"},{"title":"0.5.0 beta.3","icon":"tag","href":"/releases/0-5-0-beta-3"},{"title":"0.5.0 beta.2","icon":"tag","href":"/releases/0-5-0-beta-2"},{"title":"0.5.0 beta.1","icon":"tag","href":"/releases/0-5-0-beta-1"},{"title":"0.4.5 beta.4","icon":"tag","href":"/releases/0-4-5-beta-4"},{"title":"0.4.5 beta.3","icon":"tag","href":"/releases/0-4-5-beta-3"},{"title":"0.4.4","icon":"tag","href":"/releases/0-4-4"},{"title":"0.4.3","icon":"tag","href":"/releases/0-4-3"},{"title":"0.4.2","icon":"tag","href":"/releases/0-4-2"},{"title":"0.4.1","icon":"tag","href":"/releases/0-4-1"},{"title":"0.4.0","icon":"tag","href":"/releases/0-4-0"},{"title":"0.3.1","icon":"tag","href":"/releases/0-3-1"},{"title":"0.3.0","icon":"tag","href":"/releases/0-3-0"}]},{"group":"Contributing","expanded":false,"pages":[{"title":"Development","icon":"code","href":"/development"}]}]}]},{"tab":"Research","pages":[{"title":"Research","href":"/research/local-pii-model"}]}]},"basePath":"","title":"Private keys - datafog","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}