Metadata-Version: 2.4
Name: crypto-deprecation-check
Version: 0.1.1
Summary: Read the cryptographic algorithms your repository's own code calls — hashlib, Cipher.getInstance, MODE_ECB, a JWT alg, generate_private_key, an SSH HostKeyAlgorithms setting, an openssl subcommand — and say which of them carry a published deprecation status and by when, with the source sentence quoted under every answer
Author: referencesource.org
License: CC0-1.0
Project-URL: Homepage, https://referencesource.org/nist-cryptographic-algorithm-deprecation-schedule/
Project-URL: Source, https://referencesource.org/nist-cryptographic-algorithm-deprecation-schedule/
Keywords: crypto,cryptography,deprecation,nist,post-quantum,pqc,ml-kem,ml-dsa,fips,sp800-131a,sha1,rsa,ecdsa,inventory,audit,ci,pre-commit,lint,security
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# crypto-deprecation-check

Read the cryptographic algorithms your repository's own code calls, and say for
each one whether it carries a published deprecation status, the date that status
changes, and the replacement — with the sentence behind every answer quoted and
the page it came from linked, so you can check the answer rather than trust it.

The first step NIST IR 8547 names for the post-quantum transition is an
inventory of which algorithms your code actually calls. This is that step, run
from a shell or a pre-commit hook.

```
$ crypto-deprecation-check

crypto-deprecation-check — 34 file(s) read under /work/api

ALREADY DEPRECATED OR DISALLOWED — 2

  SHA-1  (hashing)
      status today: Disallowed for digital signature generation
      planned: retirement scheduled under SP 800-131A Rev 3 draft
      replacement: SHA-2 or SHA-3
      called at src/sign.py:3 (a hashlib call), deploy/ci.yml:7 (an openssl subcommand)
      "Rev. 3 proposes moving the minimum classical security strength from 112
       bits to 128 bits at the end of 2030, retires ECB confidentiality mode and
       DSA signature generation, and schedules the retirement of SHA-1 ..."
      — the status for SP 800-131A Rev 3 draft, from https://www.encryptionconsulting.com/...
        read 2026-11-15

ON THE SCHEDULE, APPROVED TODAY — 3
  ...

$ echo $?
1
```

## Install

```
pip install crypto-deprecation-check
crypto-deprecation-check .
```

Python 3.8 or newer. No dependencies. Nothing is sent anywhere: the statuses
ship inside the package and the scan is local.

As a pre-commit hook, or in CI:

```yaml
- name: algorithm inventory
  run: pipx run crypto-deprecation-check .
```

There is an identical npm package, `crypto-deprecation-check`, for repositories
that would rather install with npm. Both read the same data file, byte for byte,
and a gate in our own repository runs the two over the same trees and fails if
any answer differs.

## What it looks for, and why it is not a grep

Finding the string `sha1` in a file is not finding a call to SHA-1: it is in a
package name, a variable, a comment, a checksum field. So this does not grep for
algorithm names. It matches the places where naming an algorithm is the whole
point of the line:

- `hashlib.sha1()`, `hashlib.new("sha1")`, `createHash` / `createHmac`
- `MessageDigest.getInstance("SHA-1")`, `Cipher.getInstance("AES/ECB/...")`
- `AES.MODE_ECB` and the other PyCryptodome mode constants
- a JWT `alg` / `algorithm` / `algorithms` value — `RS256`, `ES256`, `none`
- `generate_private_key` / `generateKeyPair` / `GenerateKey`
- `createECDH`, `createDiffieHellman`
- an SSH `HostKeyAlgorithms`, `KexAlgorithms` or `PubkeyAcceptedAlgorithms`
  setting, including every entry of a comma-separated list
- `ssh-keygen -t ...`
- `openssl dgst -sha1`, `openssl genrsa`, `openssl dsaparam`, `openssl dhparam`
- an RSA padding or signature-scheme choice
- the post-quantum names, with the parameter set attached as real code writes
  it: `Kyber768`, `ML-KEM-1024`, `Dilithium3`, `SLH-DSA`

Caches, build output, virtualenvs and installed dependencies are not read:
`node_modules`, `.venv`, `site-packages`, `dist` and about fifty more. A crypto
call inside something you installed is not your call, and naming a file you
cannot edit is worse than silence. `.github/workflows` *is* read.

## What it refuses to say

- **Nothing at all about MD5, DES, 3DES or RC4**, in either direction. We hold
  no record for them, and a scanner that filled those in from general knowledge
  would be inventing the one thing this package sells.
- **No verdict on a key length.** Bits named beside a key call are printed as
  context. Our records carry the 112-bit minimum security strength but not the
  table that turns an RSA modulus into a security strength, so no judgement is
  reached on `key_size=1024`.
- **No "NIST says".** Each answer names the NIST document the status belongs to
  and links the published summary the sentence was actually taken from, with the
  day we read it.

## Exit codes

| code | when |
|---|---|
| 0 | nothing found, or every finding is dated 2030 or later |
| 1 | the repository calls an algorithm whose status is **already** Deprecated or Disallowed |
| 2 | the scan could not run |

Only a status that is already Deprecated or Disallowed fails a build — today
that is SHA-1 and DSA signature generation. RSA and ECDSA are approved now and
deprecated after 2030, so they are reported and exit 0: failing CI in 2026 for
calling ECDSA would get this tool uninstalled the same day. `--no-fail` always
exits 0.

## Options

```
crypto-deprecation-check [path] [--json] [--quiet] [--no-fail] [--help]
```

`--json` prints the whole reading, including every call site, every quote and
every source URL.

## Where the answers come from

Every status, date, replacement and quote in this package comes from
[the NIST cryptographic algorithm deprecation
schedule](https://referencesource.org/out/pkg/crypto-deprecation-check/)
on referencesource.org — 21 algorithms, each with the sentence that states its
status quoted verbatim and the page it was read from. That page is re-checked on
a schedule and carries its own last-checked date; this package carries the
oldest reading date of the records inside it, printed at the end of every run.

The quoted sentence is from a published summary of the NIST documents, not from
the NIST text itself, and each answer says which document the status belongs to.

CC0-1.0. The records are facts with their sources attached; use them.
