Skip to content
Detectors

Scanner deep dive

Overview

Private keys are used for securely connecting and authenticating to various systems and services. Exposure of private keys can lead to unauthorized access and data breaches.
TruffleHog’s own description of this detector

How sure this page is

  • 2 details on this page were read from the source with low confidence. The maintainer view shows which.
Provider and detector details

Summary

ProviderNo provider details added yet.

Runs on any connection. Triggered by keywords in the content, after decoding.How TruffleHog works

How detection works

The Private Key detector looks for a single value in text that resembles a credential. It uses the word “private key” to narrow its search.

Runs by default

Matching rules and source
Keywords
  • private key

Regex

  • Regex

    (?i)-----\s*?BEGIN[ A-Z0-9_-]*?PRIVATE KEY\s*?-----[\s\S]*?----\s*?END[ A-Z0-9_-]*? PRIVATE KEY\s*?-----

How it works

  1. Skips any text that doesn’t contain “private key”. This keeps scanning fast.
  2. Looks for text matching its pattern.
  3. Values are trimmed before use.
  4. Drops matches that look like known non-secrets (1 rule).
  5. Reports each remaining match as a possible Private Key credential. It isn’t known to work until it’s verified.
Regular expression
One value
Guards against false matches
Not found in source

Known false positives:

  • aaron1234567890123

How it behaves

What this detector does at each step of the TruffleHog pipeline.

Keywords

Any one of these in the decoded text wakes the detector.

  • private key

privatekey.go line 48 (opens TruffleHog source on GitHub)

Behavior

Multi-part
No
Match window
512 bytes before and 4096 after a keyword
privatekey.go line 54 (opens TruffleHog source on GitHub)
Custom endpoints
No
Cloud endpoint
None
Randomness check
None in this detector's own code

Verification. When a scan allows it, TruffleHog tests a match by calling the provider. A scan can turn this off for every detector or for this one. Atlas only describes this; it never tests credentials. How the verify decision works

Analyzer.Privatekey Analyzer

In short

Wakes on “private key”, reads 512 bytes before and 4096 after each hit and tests matches with the provider. A default scan runs it.

How verification works

What it means

The verification code lists keychecker.trufflesecurity.com as a destination. The detector decides whether a match passes using its own rules.

The detection and verification evidence on this page comes from the Open Source implementation. Check the Enterprise coverage guide for product availability.

Does checking a key change anything at the provider?

Not expected to: it’s a GET request, which reads without changing anything, and the source declares no changes.

Verification walkthrough

How it works

  1. Sends a GET to keychecker.trufflesecurity.com.
  2. Puts the found credential in the request: the parsed private key is used as an SSH public-key auth method.
  3. If the request can’t reach the provider, the result is an error, not a rejection.

Evidence from source

Endpoint

https://keychecker.trufflesecurity.com/fingerprint/%s

privatekey.go:225 (opens TruffleHog source on GitHub)

Key is sent as

SSH public key

How responses are judged

Not found in source

Troubleshoot this check

If a result looks wrong, work through these steps. They’re built from the request and status rules above. The Atlas doesn’t send anything.

1. Send the same request yourself

No command for this check. How the key is sent isn't recorded in a form that can be turned into a command.

2. Likely causes

  • The scanner couldn't reach the provider. The scanner needs outbound HTTPS access to keychecker.trufflesecurity.com. A firewall, proxy or DNS problem is reported as an error, not a rejection, and the key can be checked again.

3. Check the provider’s docs

4. Still stuck

Report it to TruffleHog

Include the status code and response you got. Never include the key.

Errors, timeouts and rate limits
Not found in source
Not found in source
If the provider can’t be reached
The result is an error, not a rejection, and the key can be checked again.

All URLs found in source

  • https://crt.sh/?q=%s
  • https://keychecker.trufflesecurity.com/fingerprint/%s
  • https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
  • https://docs.gitlab.com/ee/user/gitlab_com/index.html#ssh-host-keys-fingerprints
Provider response documentation

Verified findings

Open Source · Standard output (stdout)

The CLI prints verified findings to stdout. Use --json for structured output.

Example scan output · credential redacted

✅ Found verified result 🐷🔑
Detector Type: PrivateKey
Decoder Type: PLAIN
Raw result: [redacted]
Terminal printer source
CI formats

With --github-actions, GitHub Actions displays this workflow command as a warning on the indicated file and line.

::warning file=config/example.env,line=8,endLine=8::Found verified PrivateKey result 🐷🔑
GitHub Actions printer source

Legacy compatibility. --json-legacy writes pre-v3 JSON for Git, GitLab, and GitHub sources only.

Enterprise alerts

When Enterprise verifies that a secret is live, a configured notifier can alert your team. The finding is also available through the Enterprise API.

Optional analysis

What the analyzer checks

In Open Source, run trufflehog analyze separately from the scan. Enterprise runs enabled self-discovery analyzers on first discovery of a supported live secret.

Rotation resources

Atlas has no rotation guide for this detector.

Token types

TruffleHog’s source doesn’t name a token type or require a fixed prefix for this detector.

Pages TruffleHog’s source links to (2)

Coverage in other scanners

4 scanners have a confirmed match.

Changes

1 recorded change since Sep 18, 2026; 1 still needs review.

Source

Facts on this page were read from trufflesecurity/trufflehog at commit 2325546.

2325546
2921dcc