To find quantum-vulnerable cryptography in code, search for every use of public-key algorithms that Shor's algorithm breaks (RSA, ECDSA, EdDSA/Ed25519, ECDH/X25519, finite-field Diffie-Hellman and DSA) across five places: source code, dependencies, key and certificate files, configuration (TLS, JWT, SSH), and infrastructure as code. Use precise, language-specific patterns rather than a single keyword grep, separate production code from tests and fixtures, and record each real use as an asset in a CycloneDX 1.6 CBOM. Symmetric crypto with at least 128-bit keys (AES-128/192/256) and SHA-2 hashes are not on the list.
TL;DR
- Quantum-vulnerable means public-key: RSA, ECDSA, EdDSA, ECDH, X25519, DH, DSA. NIST's final IR 8547 (October 2026) deprecates them after 2030 and disallows them after 2035.
- A keyword grep for "RSA" is mostly noise. In our test of four popular open-source repos, 197 of 229 findings (86%) sat in tests and fixtures.
- Crypto hides outside source files: PEM keys, certs, JWKS files, nginx configs, Terraform KMS specs, cert-manager manifests, CI signing keys and lockfiles.
- The ripgrep, Semgrep and OpenSSL commands below were tested on 2026-11-18 (ripgrep 14.1.1, Semgrep 1.136.0, OpenSSL 3.6.1). Cloud and cluster commands are marked where we couldn't run them.
- Record results as CycloneDX 1.6
cryptographic-assetcomponents. We include a minimal example that validates against the official 1.6 schema.
What counts as quantum-vulnerable cryptography?
Anything whose security rests on factoring or discrete logarithms. A large enough quantum computer running Shor's algorithm breaks both, and NIST says so explicitly for ECDSA, EdDSA, RSA and the SP 800-56A/56B key-establishment schemes in IR 8547. The final version, published October 27, 2026, keeps the 2030 and 2035 dates from the 2024 draft but tightens the first one. The draft deprecated only 112-bit parameter sets after 2030. The final deprecates every quantum-vulnerable parameter set after 2030 (RSA-4096 and P-384 included) and disallows them all after 2035. (For the full regulatory picture, see our PQC compliance deadlines guide.)
Symmetric crypto is a different story. IR 8547 says NIST-approved symmetric primitives with at least 128 bits of classical security are believed to meet at least Category 1 post-quantum security, the level of AES-128 itself. So AES-GCM and HMAC-SHA256 do not need to be migrated for quantum reasons. Don't let a scanner bury your RSA findings under them.
Then there's the stuff that's broken already, quantum computer or not. It belongs in the same inventory because you'll touch the same files.
| Bucket | Algorithms | Status | What to do |
|---|---|---|---|
| Quantum-vulnerable | RSA (any size, incl. RSA-PSS, RSA-OAEP), ECDSA, EdDSA (Ed25519, Ed448), ECDH, X25519, X448, finite-field DH, DSA, ECIES | Deprecated after 2030, disallowed after 2035 (IR 8547) | Inventory, prioritize, migrate to ML-KEM (FIPS 203) and ML-DSA / SLH-DSA (FIPS 204/205) |
| Fine for PQ purposes | AES-128/192/256, ChaCha20-Poly1305, SHA-256/384/512, SHA-3, HMAC-SHA2, HKDF, PBKDF2, Argon2 | Symmetric primitives with 128+ bit security meet Category 1 or higher | Record, no quantum action |
| Weak today | MD5, SHA-1, DES, 3DES, RC4, ECB mode, RSA under 2048 bits, curves under 224 bits | MD5: RFC 6151. SHA-1: disallowed in FIPS-validated modules after 2030 (IR 8547). 3DES: NIST withdrew SP 800-67 on January 1, 2024. RC4: prohibited in TLS by RFC 7465 | Fix now, independent of PQC |
Two traps catch people every time:
- Ed25519 and X25519 are elliptic-curve crypto. They're modern and fast and just as broken by Shor as P-256. Teams that "already moved off RSA" to Ed25519 still have a quantum-vulnerable inventory.
- X25519 also shows up in the fix. The hybrid TLS group
X25519MLKEM768contains the string X25519. If your search flags it, that's a good result, not a finding. (Our X25519MLKEM768 guide covers enabling it.)
Where does cryptography hide in a codebase?
Source files are the obvious place and rarely the biggest. An honest inventory covers all of these:
| Location | What you're looking for | Example |
|---|---|---|
| Application code | Key generation, signing, verification, key agreement, encryption calls | KeyPairGenerator.getInstance("RSA"), rsa.GenerateKey |
| JWT / OAuth code and config | alg values RS*, PS*, ES*, EdDSA; JWKS kty | { algorithm: 'RS256' }, "kty":"EC" |
| Dependencies | Libraries that do asymmetric crypto on your behalf, including transitive ones | jsonwebtoken, cryptography, bcprov-jdk18on, golang.org/x/crypto |
| Key and cert files | PEM/DER keys, certs, keystores committed to the repo | test/privateSecure.pem, server.crt, *.jks, *.p12 |
| TLS config | Cipher suites, ECDH groups, cert key types | ssl_ecdh_curve, SSLCipherSuite, jdk.tls.namedGroups |
| SSH | Host keys, deploy keys, authorized_keys entries | ssh-rsa AAAA..., ecdsa-sha2-nistp256 |
| Infrastructure as code | KMS key specs, Key Vault key types, generated keys | customer_master_key_spec = "RSA_2048", tls_private_key |
| Kubernetes | cert-manager privateKey.algorithm, kubernetes.io/tls secrets | algorithm: ECDSA |
| CI and release | Signing keys for containers, packages, binaries, commits | cosign keys, GPG keys, jarsigner, codesign |
The list matters because ownership differs. App code belongs to a product team, the KMS key to platform, the cert to whoever runs ingress. An inventory that only covers src/ gets you a third of the way.
Step 1: Run a broad sweep with ripgrep
Start wide to learn the shape of the repo. This is a recall pass, not your inventory.
rg -n -i -w --hidden -g '!.git' -g '!node_modules' -g '!vendor' \
-e 'rsa|ecdsa|ecdh|ecdhe|eddsa|ed25519|ed448|x25519|x448|dsa' \
-e 'diffie.?hellman|secp256r1|secp384r1|secp521r1|prime256v1|secp256k1' .
Then count how many files with hits sit in each directory, so you know what to exclude (filenames with spaces will confuse xargs; it's a rough count):
rg -c -i -w -e 'rsa|ecdsa|ecdh|ed25519|x25519|dsa|diffie.?hellman' . \
| awk -F: '{print $1}' | xargs -n1 dirname | sort | uniq -c | sort -rn | head -20
On golang-jwt/jwt this sweep returned 155 lines in 18 files, and 106 lines outside test files. The files were right (every RSA/ECDSA/Ed25519 source file showed up), but the line count was inflated by comments, error messages and doc strings. The broad sweep tells you which files to read. It doesn't tell you what to put in the inventory.
Step 2: Search with language-specific patterns
Precise patterns key off the API, not the word. We tested each command below against fixture files with ripgrep 14.1.1, and the Go, Python and JavaScript patterns against the real repos in our study. Add -g '!**/test/**' -g '!**/tests/**' -g '!*_test.go' (or your own layout) to drop tests once you've reviewed them.
Go
rg -n -t go \
-e '"crypto/(rsa|ecdsa|ecdh|ed25519|dsa|elliptic)"' \
-e '"golang\.org/x/crypto/(ed25519|curve25519|ssh)"' \
-e 'elliptic\.P(224|256|384|521)\(' \
-e '\b(rsa|ecdsa|ed25519)\.GenerateKey\(' \
-e 'ecdh\.(P256|P384|P521|X25519)\(\)' .
In Go the import is the best signal. A file that imports crypto/rsa uses RSA. crypto/tls uses ECDH and RSA/ECDSA certificates without your code importing either, which is what the TLS config step is for. Go 1.24 added crypto/mlkem and turned on X25519MLKEM768 by default when Config.CurvePreferences is nil, so grep for CurvePreferences too. An explicit list without tls.X25519MLKEM768 silently keeps the hybrid off.
Java and Kotlin
rg -n -t java -t kotlin \
-e '(KeyPairGenerator|KeyFactory|KeyAgreement|Signature|Cipher)\.getInstance\(\s*"(RSA|RSASSA-PSS|EC|DSA|DH|DiffieHellman|ECDH|XDH|X25519|X448|EdDSA|Ed25519|Ed448)\b' \
-e 'Signature\.getInstance\(\s*"\w*with(RSA|ECDSA|DSA)' \
-e '\bECGenParameterSpec\(' .
This catches KeyPairGenerator.getInstance("RSA"), Signature.getInstance("SHA256withECDSA"), KeyAgreement.getInstance("X25519") and Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding"), and ignores AES/GCM/NoPadding. It will miss algorithm names loaded from properties files or constants. Grep *.properties and application.yml for the same names, and look for Bouncy Castle (org.bouncycastle) imports separately.
Python
rg -n -t py \
-e 'hazmat\.primitives\.asymmetric' \
-e '\b(rsa|ec|dsa|dh)\.generate_private_key\(' \
-e '\b(Ed25519|Ed448|X25519|X448)PrivateKey\.generate\(' \
-e '\bfrom Crypto(dome)?\.PublicKey import\b' \
-e '\b(RSA|ECC|DSA)\.(generate|import_key|construct)\(' \
-e 'paramiko\.(RSAKey|ECDSAKey|Ed25519Key)' .
The first pattern covers pyca/cryptography (from cryptography.hazmat.primitives.asymmetric import rsa, ec), and the Crypto.PublicKey patterns cover PyCryptodome. On PyJWT this returned 9 lines outside tests, in two files. One was a Sphinx docstring that mentions the module path. That's the kind of hit you triage away in seconds once you've seen it.
Node.js and TypeScript
rg -n -t js -t ts \
-e "generateKeyPair(Sync)?\(\s*['\"](rsa|rsa-pss|dsa|ec|ed25519|ed448|x25519|x448|dh)['\"]" \
-e '\bcreate(ECDH|DiffieHellman|DiffieHellmanGroup)\(' \
-e "['\"]((RS|PS|ES)(256|384|512)|EdDSA)['\"]" \
-e "\bname\s*:\s*['\"](RSASSA-PKCS1-v1_5|RSA-PSS|RSA-OAEP|ECDSA|ECDH|Ed25519|X25519)['\"]" .
The four patterns cover node:crypto key generation, ECDH/DH objects, JWT algorithm strings (for jsonwebtoken, jose and friends), and WebCrypto subtle calls. The JWT pattern is deliberately loose: 'RS256' as a string literal is a strong signal in JS. In node-jsonwebtoken itself, all 10 hits outside test/ were algorithm allow-lists in sign.js, verify.js and lib/validateAsymmetricKey.js.
C# and .NET
rg -n -t cs \
-e '\b(RSA|ECDsa|ECDiffieHellman|DSA)\.Create\(' \
-e '\bnew (RSACryptoServiceProvider|DSACryptoServiceProvider|RSACng|ECDsaCng|ECDiffieHellmanCng)\(' \
-e '\bSecurityAlgorithms\.(RsaSha|RsaSsaPssSha|EcdsaSha)\d+' \
-e '\bGet(RSA|ECDsa|DSA|ECDiffieHellman)(Public|Private)Key\(' .
SecurityAlgorithms.RsaSha256 is how JWT signing usually shows up in ASP.NET code via Microsoft.IdentityModel.Tokens. GetRSAPrivateKey() on an X509Certificate2 means the app is signing or decrypting with a cert's key, which is easy to miss.
Rust
rg -n -t rust \
-e '\b(use|extern crate)\s+(rsa|p256|p384|p521|k256|ed25519_dalek|x25519_dalek|ecdsa|dsa)\b' \
-e '\bring::(signature|agreement)\b' \
-e '\b(RSA_PKCS1_\w+|RSA_PSS_\w+|ECDSA_P(256|384)_\w+|ED25519|X25519|ECDH_P(256|384))\b' .
In Rust, Cargo.lock is often a better first stop than the source, because the RustCrypto crates are named after the algorithm (rsa, p256, ed25519-dalek). The ring constants (ECDSA_P256_SHA256_ASN1_SIGNING, agreement::X25519) pin down exactly which algorithm a call site uses.
PHP
rg -n -t php \
-e '\bopenssl_pkey_new\(' -e '\bOPENSSL_KEYTYPE_(RSA|EC|DSA|DH)\b' \
-e 'phpseclib3?\\Crypt\\(RSA|EC|DSA|DH)\b' \
-e "['\"]((RS|PS|ES)(256|384|512)|EdDSA)['\"]" .
openssl_sign() doesn't name the algorithm (the key type decides it), so trace where its key comes from. The last pattern catches firebase/php-jwt calls like JWT::encode($payload, $key, 'RS256') and new Key($publicKey, 'ES256').
Ruby
rg -n -t ruby \
-e 'OpenSSL::PKey::(RSA|EC|DSA|DH)\b' \
-e "OpenSSL::PKey\.generate_(key|parameters)\(\s*['\"](RSA|EC|DSA|DH|ED25519|X25519)" \
-e "['\"]((RS|PS|ES)(256|384|512)|EdDSA)['\"]" .
Covers OpenSSL::PKey::RSA.new(2048), OpenSSL::PKey::EC.generate("prime256v1"), OpenSSL::PKey.generate_key("ED25519"), and ruby-jwt calls like JWT.encode(payload, key, 'RS256').
C and C++ with OpenSSL
rg -n -t c -t cpp \
-e '\b(RSA_new|RSA_generate_key(_ex)?|RSA_(public|private)_(encrypt|decrypt)|RSA_sign|RSA_verify|EC_KEY_new(_by_curve_name)?|EC_KEY_generate_key|ECDSA_(do_)?(sign|verify)|ECDH_compute_key|DSA_new|DH_new|DH_generate_key)\b' \
-e '\bEVP_PKEY_(RSA|RSA_PSS|EC|DSA|DH|DHX|ED25519|ED448|X25519|X448)\b' \
-e '\b(EVP_PKEY_CTX_new_from_name|EVP_PKEY_Q_keygen)\([^;]*"(RSA|RSA-PSS|EC|DSA|DH|X25519|X448|ED25519|ED448)"' .
The first line catches the legacy low-level API (RSA_new, EC_KEY_new_by_curve_name), which OpenSSL 3.0 deprecated but plenty of code still uses. The second and third catch the EVP API, including the 3.x string-named forms like EVP_PKEY_Q_keygen(NULL, NULL, "RSA", (size_t)3072). (That cast isn't pedantry: the RSA variant reads a size_t from varargs, so passing a bare 3072 is undefined behavior on 64-bit platforms. EVP_RSA_gen(3072) avoids the issue.) Generic EVP_DigestSign calls don't reveal the algorithm. Follow the EVP_PKEY back to where it was loaded or generated.
Step 3: Flag the weak-today primitives in the same pass
rg -n -i \
-e '\b(md5|sha-?1)\b' \
-e '\b(des|des3|desede|3des|tripledes|des-ede3|rc4|arcfour|rc2)\b' \
-e '\becb\b' -e 'MODE_ECB' .
Expect a lot of noise from this one. Java's Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding") matches ecb, for example, even though no ECB mode is involved (it's a JCA naming quirk). On Django, md5|sha1 matched 248 lines: 96 in docs, 80 in tests, 72 elsewhere. Narrowing to actual calls (rg 'hashlib\.(md5|sha1)\(') gave 7 lines, two of them outside tests: the legacy MD5PasswordHasher and a SHA-1 cache key in the template loader. A SHA-1 cache key is not a security problem. An MD5 password hash is, which is why Django ships it only as a legacy option. The grep can't tell the difference. You can.
Step 4: Read the key type of every certificate and key in the repo
Keys and certs committed to a repo are usually test fixtures. Sometimes they're not, and those are the ones you most need to know about. Find them by content, not extension:
rg -l -e '-----BEGIN ([A-Z]+ )?(PRIVATE|PUBLIC) KEY-----' -e '-----BEGIN CERTIFICATE-----' .
rg --files -g '*.{pem,crt,cer,der,key,p12,pfx,jks,keystore}'
Then let OpenSSL tell you what each one is. This loop works with OpenSSL 3.x. Keep the -passin pass: and </dev/null, because without them an encrypted key makes openssl wait for a passphrase and swallow the rest of your file list.
rg -l -0 -e '-----BEGIN ([A-Z]+ )?(PRIVATE|PUBLIC) KEY-----' . |
while IFS= read -r -d '' f; do
t=$(openssl pkey -in "$f" -passin pass: -noout -text 2>/dev/null </dev/null ||
openssl pkey -pubin -in "$f" -noout -text 2>/dev/null </dev/null)
t=$(printf '%s\n' "$t" | grep -E 'Private-Key|Public-Key|ASN1 OID' | tr -s ' ' | paste -sd' ' -)
printf '%s\t%s\n' "$f" "${t:-could not parse (encrypted, inline in code, or not PEM)}"
done
For certificates:
openssl x509 -in server.crt -noout -text \
| grep -E 'Signature Algorithm|Public Key Algorithm|Public-Key|ASN1 OID|NIST CURVE'
What the output means:
openssl x509 -text shows | Key type | Quantum-vulnerable? |
|---|---|---|
Public Key Algorithm: rsaEncryption + Public-Key: (3072 bit) | RSA-3072 | Yes |
Public Key Algorithm: id-ecPublicKey + NIST CURVE: P-256 | ECDSA P-256 | Yes |
Public Key Algorithm: ED25519 | Ed25519 | Yes |
Public Key Algorithm: ML-DSA-65 | ML-DSA-65 (FIPS 204) | No |
RSA private keys print Private-Key: (2048 bit, 2 primes) without the word RSA; the "primes" give it away. For OpenSSH-format keys and .pub files, ssh-keygen -l -f <file> prints the size and type, for example 256 SHA256:... (ECDSA).
Running this on the three JWT libraries turned up the usual fixture zoo, plus a few things worth knowing even in test data: node-jsonwebtoken's test certs are signed with sha1WithRSAEncryption and ecdsa-with-SHA1, PyJWT carries a secp192r1 key (96-bit classical security, deliberately weak for a negative test), and golang-jwt's privateSecure.pem is a passphrase-protected RSA key encrypted with DES-EDE3-CBC. All intentional. In your repo, the same output on a non-test path is a finding.
Step 5: Check TLS, JWT and SSH configuration
Your code may never call RSA directly while your service still depends on it in three places: the TLS certificate, the TLS key exchange, and token signing.
# TLS servers and clients
rg -n -i \
-e '^\s*(ssl_ciphers|ssl_ecdh_curve|ssl_conf_command|SSLCipherSuite|SSLOpenSSLConfCmd)\b' \
-e 'jdk\.tls\.(namedGroups|disabledAlgorithms)' -e '\bCurvePreferences\b' .
# JWT algorithms in config files and JWKS documents
rg -n -i -g '!*.{js,ts,py,go,java,rb,php,cs}' \
-e '"kty"\s*:\s*"(RSA|EC|OKP)"' \
-e "\b(alg|algorithm|algorithms)\b['\"]?\s*[:=]\s*\[?\s*['\"]?((RS|PS|ES)(256|384|512)|EdDSA)\b" .
# SSH public keys pasted into files
rg -n --hidden -e '\b(ssh-rsa|ssh-dss|ecdsa-sha2-nistp(256|384|521)|ssh-ed25519)\s+AAAA' .
A JWKS entry with "kty":"RSA" or "kty":"EC" is a signing key your whole auth system trusts. "kty":"OKP" with "crv":"Ed25519" is EdDSA, same bucket. RS256, PS256 (RSA-PSS), ES256 and EdDSA are all quantum-vulnerable; HS256 is HMAC and isn't.
For SSH, check the server side too. OpenSSH 10.0 (April 2025) made the hybrid mlkem768x25519-sha256 the default key exchange and removed DSA entirely. Host keys and user keys are still RSA, ECDSA or Ed25519, so they stay in the inventory.
Static config only tells you what's intended. To see what a live endpoint negotiates, test it from outside; our post-quantum TLS adoption study shows how.
Step 6: Search infrastructure as code, KMS and Kubernetes
Cloud keys are crypto you don't write but do own. These patterns cover Terraform (AWS, Azure, GCP, the tls provider) and CloudFormation:
rg -n -t tf -t yaml -t json \
-e '\bcustomer_master_key_spec\s*=\s*"(RSA|ECC)_' \
-e '\bKeySpec"?\s*:\s*"?(RSA|ECC)_' \
-e '\bkey_type\s*=\s*"(RSA|EC)(-HSM)?"' \
-e '\balgorithm\s*=\s*"(RSA|ECDSA|ED25519)"' \
-e '\balgorithm\s*=\s*"(RSA_SIGN|RSA_DECRYPT|EC_SIGN)_\w+"' .
A note on naming: the Terraform aws_kms_key argument is customer_master_key_spec, not key_spec. Per the provider docs, its valid values include RSA_2048/3072/4096, ECC_NIST_P256/P384/P521, ECC_SECG_P256K1, ECC_NIST_EDWARDS25519 and, now, ML_DSA_44/65/87. The pattern above flags the RSA and ECC specs and skips the ML-DSA ones. CloudFormation's AWS::KMS::Key uses KeySpec.
IaC only covers keys created through IaC. For the rest, ask the cloud. With the AWS CLI (we didn't run this against a live account for this article; KeySpec, KeyUsage and KeyManager are standard KeyMetadata fields):
aws kms list-keys --query 'Keys[].KeyId' --output text | tr '\t' '\n' |
while read -r id; do
aws kms describe-key --key-id "$id" \
--query 'KeyMetadata.[KeyId,KeySpec,KeyUsage,KeyManager]' --output text
done
For Kubernetes, cert-manager's Certificate resource sets the key type in spec.privateKey.algorithm. The API reference lists RSA, ECDSA and Ed25519 as the allowed values, with RSA sizes of 2048, 4096 or 8192 (default 2048) and ECDSA sizes of 256, 384 or 521 (default 256).
rg -n -t yaml -U 'privateKey:\s*\n(?:\s+\w+:.*\n)*?\s+algorithm:\s*(RSA|ECDSA|Ed25519)' .
Manifests that omit algorithm still produce a key, so check what was actually issued. This reads the certificate from every TLS secret in a cluster (it needs kubectl read access to secrets):
kubectl get secrets -A --field-selector type=kubernetes.io/tls \
-o jsonpath='{range .items[*]}{.metadata.namespace}/{.metadata.name}{"\t"}{.data.tls\.crt}{"\n"}{end}' |
while IFS=$'\t' read -r name crt; do
info=$(printf '%s' "$crt" | base64 -d | openssl x509 -noout -text 2>/dev/null |
grep -E 'Public Key Algorithm|Public-Key|ASN1 OID' | tr -s ' ' | paste -sd' ' -)
printf '%s\t%s\n' "$name" "$info"
done
We tested the decode half of that pipeline locally with a generated P-256 certificate; we did not run it against a live cluster for this article.
Step 7: Don't forget CI and release signing
Signing keys are long-lived, which makes them some of the most important entries in the inventory. Look for them in pipeline definitions (--hidden matters, because .github/ is a dot-directory that ripgrep skips by default):
rg -n -i --hidden -g '*.{yml,yaml}' -g 'Jenkinsfile' -g 'Makefile' \
-e '\bcosign (sign|generate-key-pair|verify)\b' \
-e '\bgpg (--import|--batch|--detach-sign|--clearsign)' \
-e '\b(jarsigner|apksigner|signtool|codesign|notation sign)\b' \
-e 'git config .*(gpg\.format|user\.signingkey)' .
Then check the key behind each one: openssl pkey -pubin -in cosign.pub -noout -text for a cosign public key, gpg --list-keys --keyid-format long for GPG (look for rsa4096, ed25519 and so on). Firmware and mobile app signing keys belong here too, even if they live in a vault outside the repo.
Step 8: Scan dependencies, including transitive ones
A dependency is a capability, not a finding. cryptography in requirements.txt tells you the app can do RSA, not that it does. Record it, then check whether any call site actually uses its asymmetric APIs.
| Ecosystem | Libraries that usually mean asymmetric crypto | Find who pulls it in |
|---|---|---|
| npm | jsonwebtoken, jose, node-forge, elliptic, node-rsa, @noble/curves, tweetnacl | npm ls --all jsonwebtoken |
| Python | cryptography, pycryptodome(x), PyJWT[crypto], python-jose, jwcrypto, paramiko, ecdsa, rsa, pynacl | pipdeptree --reverse --packages cryptography |
| Go | golang.org/x/crypto, github.com/golang-jwt/jwt, github.com/go-jose/go-jose, github.com/lestrrat-go/jwx | go mod why -m golang.org/x/crypto |
| Java | bcprov-jdk18on, bcpkix-jdk18on, nimbus-jose-jwt, jjwt, java-jwt | mvn dependency:tree -Dincludes=org.bouncycastle |
| Rust | rsa, p256, p384, k256, ed25519-dalek, x25519-dalek, ring, aws-lc-rs, jsonwebtoken | cargo tree -i rsa |
| Ruby | jwt, net-ssh, ed25519, rbnacl | bundle exec gem dependency jwt --reverse-dependencies |
| PHP | firebase/php-jwt, lcobucci/jwt, phpseclib/phpseclib, web-token/* | composer why phpseclib/phpseclib |
| .NET | System.IdentityModel.Tokens.Jwt, BouncyCastle.Cryptography | dotnet list package --include-transitive |
The quick version is a grep over lockfiles:
rg -n -i -g '{package-lock.json,yarn.lock,pnpm-lock.yaml,poetry.lock,uv.lock,Pipfile.lock,go.sum,Cargo.lock,Gemfile.lock,composer.lock,gradle.lockfile,packages.lock.json}' \
-e '\b(jsonwebtoken|jose|node-forge|elliptic|node-rsa|cryptography|pycryptodomex?|pyjwt|python-jose|jwcrypto|paramiko|golang\.org/x/crypto|go-jose|bcprov|bcpkix|nimbus-jose-jwt|jjwt|ed25519-dalek|x25519-dalek|p256|ring|phpseclib|php-jwt|net-ssh)\b' .
Transitive matters more than people expect. An HTTP client that pulls in an SSH library, or a cloud SDK that verifies signed URLs, puts RSA in your process without anyone on the team choosing it.
How do you write Semgrep rules for crypto discovery?
ripgrep matches text. Semgrep matches syntax, so it skips comments and strings that merely mention an API, follows Python import aliases, and captures the algorithm name as a variable you can report. These rules were tested with Semgrep 1.136.0 on 2026-11-18:
rules:
- id: java-quantum-vulnerable-jca
languages: [java]
severity: WARNING
message: Quantum-vulnerable algorithm "$ALG" requested from the JCA. Add it to the crypto inventory.
patterns:
- pattern-either:
- pattern: KeyPairGenerator.getInstance("$ALG", ...)
- pattern: KeyFactory.getInstance("$ALG", ...)
- pattern: KeyAgreement.getInstance("$ALG", ...)
- pattern: Signature.getInstance("$ALG", ...)
- pattern: Cipher.getInstance("$ALG", ...)
- metavariable-regex:
metavariable: $ALG
regex: (?i)^(RSA|RSASSA-PSS|EC|DSA|DH|DiffieHellman|ECDH|XDH|X25519|X448|EdDSA|Ed25519|Ed448)$|^.*with(RSA|ECDSA|DSA|PLAIN-ECDSA)$|^RSA/
- id: python-quantum-vulnerable-keygen
languages: [python]
severity: WARNING
message: Quantum-vulnerable key generation. Add it to the crypto inventory.
pattern-either:
- pattern: cryptography.hazmat.primitives.asymmetric.rsa.generate_private_key(...)
- pattern: cryptography.hazmat.primitives.asymmetric.ec.generate_private_key(...)
- pattern: cryptography.hazmat.primitives.asymmetric.dsa.generate_private_key(...)
- pattern: cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PrivateKey.generate()
- pattern: cryptography.hazmat.primitives.asymmetric.x25519.X25519PrivateKey.generate()
- pattern: Crypto.PublicKey.RSA.generate(...)
- pattern: Crypto.PublicKey.ECC.generate(...)
- id: go-quantum-vulnerable-keygen
languages: [go]
severity: WARNING
message: Quantum-vulnerable key generation. Add it to the crypto inventory.
pattern-either:
- pattern: rsa.GenerateKey(...)
- pattern: ecdsa.GenerateKey(...)
- pattern: ed25519.GenerateKey(...)
- pattern: ecdh.P256().GenerateKey(...)
- pattern: ecdh.X25519().GenerateKey(...)
- id: js-jwt-asymmetric-alg
languages: [javascript, typescript]
severity: WARNING
message: JWT signed or verified with quantum-vulnerable algorithm "$A".
patterns:
- pattern-either:
- pattern: '$JWT.sign($P, $K, {..., algorithm: "$A", ...}, ...)'
- pattern: '$JWT.verify($T, $K, {..., algorithms: [..., "$A", ...], ...}, ...)'
- metavariable-regex:
metavariable: $A
regex: ^((RS|PS|ES)(256|384|512)|EdDSA)$
Run it with semgrep scan --config crypto-inventory.yaml --metrics=off .
On our fixtures the Java rule flagged "RSA", "SHA256withECDSA", "X25519", "RSASSA-PSS" and "RSA/ECB/OAEP...", and correctly ignored "AES/GCM/NoPadding", "ML-DSA" and a commented-out call. The JWT rule flagged RS256 and ES256 and ignored HS256. Three gotchas we hit:
- Quote patterns that contain
:.algorithm: "$A"inside an unquoted YAML value is a YAML parse error. metavariable-regexis anchored at the start. A pattern likewith(RSA|ECDSA)silently never matchesSHA256withECDSA; you need^.*with(...).- Semgrep skips tests by default. Without a
.semgrepignore, Semgrep applies a default ignore list that includestest/,tests/,testsuite/and*_test.go, and it also honors.gitignore. On golang-jwt it scanned 26 files and missed anrsa.GenerateKeyinrsa_test.gountil we pointed it at the file directly. That default is convenient for triage, but your inventory should still account for test keys. An empty.semgrepignoreat the repo root turns the default list off; we confirmed that on 1.136.0 with a throwaway repo.
One more limitation: the Java rule matches KeyPairGenerator.getInstance(...) after an import, but not the fully qualified java.security.KeyPairGenerator.getInstance(...) form. Add patterns for it if your codebase uses that style.
How do you triage false positives?
"True positive" and "false positive" are too coarse for crypto. Every hit lands in one of four buckets.
| Bucket | What it looks like | Inventory action |
|---|---|---|
| Production use | A call site that generates, signs, verifies, encrypts or agrees keys on a live path | Record as an asset with location, owner and purpose |
| Capability | A dependency, an algorithm allow-list, a library that supports RSA | Record once per component; check whether anything uses it |
| Test / fixture | Code under test/, fixture keys, sample certs | Record in bulk; confirm no fixture key is reused in prod |
| Noise | Comments, docstrings, docs, changelogs, error strings, type-only imports, vendored code you don't ship | Exclude, and add an ignore rule so it stays excluded |
A few patterns worth knowing:
- Constants and allow-lists inflate counts. node-jsonwebtoken's
sign.jshas one line listingRS256throughES512. That's one capability, not nine findings. - Type imports aren't usage. PyJWT imports
cryptography.hazmat.primitives.asymmetric.typesfor type hints. It tells you the module handles keys, nothing more. - Same key, many references. One RSA signing key used in 40 places is one migration with 40 call sites. Group by key or by purpose.
- Test keys leak. Grep production config for the fingerprints of your test keys (
ssh-keygen -l -foropenssl pkey -pubout | sha256sum). It happens more often than anyone likes to admit.
What we found when we scanned four open-source repos
On 2026-11-18 we shallow-cloned four well-known repos and ran our own scanner, the Qunoq CLI (engine 0.1.0), with qunoq scan <dir> --format json, plus the ripgrep and Semgrep commands above. All four are libraries or frameworks, not applications, so they show capability rather than deployed usage. That's still a useful stress test for noise.
| Repo (commit) | Files scanned | Findings | In tests or fixtures | Outside tests | Quantum-vulnerable outside tests |
|---|---|---|---|---|---|
golang-jwt/jwt (f411663) | 72 | 26 | 18 | 8 | 7 |
jpadilla/pyjwt (16231ab) | 77 | 93 | 81 | 12 | 10 (7 code, 3 dependency) |
auth0/node-jsonwebtoken (b924272, v9.0.3) | 82 | 101 | 93 | 8 | 7 (6 code, 1 dependency) |
django/django (9e2e5a3) | 7,091 | 9 | 5 | 4 | 0 |
| Total | 7,322 | 229 | 197 (86%) | 32 | 24 |
By algorithm, across all four:
| Algorithm | Findings | In tests or fixtures |
|---|---|---|
| RSA (incl. RS*/PS* JWT, RSA keys and certs) | 71 | 57 |
| ECDSA (incl. ES* JWT, P-256/384/521 keys) | 42 | 32 |
| Ed25519 | 5 | 5 |
| DSA | 1 | 1 |
| HMAC-SHA2 (not quantum-vulnerable) | 92 | 92 |
JWT alg: none | 5 | 5 |
| SHA-1 | 6 | 5 |
| MD5 | 1 | 0 |
| Crypto dependency, algorithm unclassified | 6 | 0 |
What stood out:
- Tests dominate. 86% of all findings, and 95 of the 119 quantum-vulnerable ones (80%), were in tests or fixture keys. If your scanner can't separate them, your dashboard will lie to you.
- Django's source has no public-key crypto. The broad ripgrep sweep returned zero lines for RSA, ECDSA, ECDH, Ed25519, X25519 or Diffie-Hellman across 7,091 files. Its quantum exposure lives in what you deploy it with (TLS terminator, JWT library, database driver), which is the point of the location table above.
- The libraries parse keys; they don't generate them. Our Semgrep key-generation rules found nothing in production code in any of the three JWT libraries. Key generation happens in your app, your IaC or your ops runbook. That's where to look.
- ripgrep caught something the scanner missed. The Go import pattern found
crypto/ed25519in golang-jwt'sed25519.goanded25519_utils.go. Our scanner reported Ed25519 there only via a test key file, and likewise missed PyJWT's Ed25519/Ed448 imports injwt/algorithms.py. That's a gap in our rules, and a fair argument for running a cheap grep alongside whatever tool you use. - The scanner was quieter than grep where it mattered. For Django's weak hashes, a plain
md5|sha1grep gave 248 lines; the scanner reported the same 7hashlibcalls as the targeted grep. In the opposite direction, it tagged PyJWT'scryptographydependency as RSA three times, once per extras group inpyproject.toml. A human would record that once, as a capability. - Speed isn't the bottleneck. The scanner walked Django's 7,091 files in 0.48 seconds of wall time. Triage is where the hours go.
How do you record findings as a CycloneDX 1.6 CBOM?
CycloneDX 1.6 (April 9, 2024) added the Cryptography Bill of Materials: crypto assets become components of type cryptographic-asset with a cryptoProperties object. The first edition of Ecma standard ECMA-424 (June 2024) is CycloneDX 1.6. CycloneDX 1.7 followed on October 21, 2025, deprecated some CBOM fields in favor of newer structures, and became ECMA-424's second edition. Check what your consumers accept before you pick a version. In our experience 1.6 is still the common denominator.
Here's a minimal 1.6 CBOM for one algorithm asset: RSA-2048 with PKCS#1 v1.5 padding and SHA-256, used to sign JWTs.
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"metadata": {
"timestamp": "2026-11-18T09:00:00Z",
"component": {
"type": "application",
"bom-ref": "app:payments-api",
"name": "payments-api"
}
},
"components": [
{
"type": "cryptographic-asset",
"bom-ref": "crypto:alg:sha256-rsa-2048",
"name": "SHA256withRSA",
"cryptoProperties": {
"assetType": "algorithm",
"algorithmProperties": {
"primitive": "signature",
"parameterSetIdentifier": "2048",
"padding": "pkcs1v15",
"executionEnvironment": "software-plain-ram",
"implementationPlatform": "x86_64",
"certificationLevel": ["none"],
"cryptoFunctions": ["sign", "verify"],
"classicalSecurityLevel": 112,
"nistQuantumSecurityLevel": 0
},
"oid": "1.2.840.113549.1.1.11"
},
"evidence": {
"occurrences": [
{
"location": "internal/auth/token.go",
"line": 57,
"symbol": "jwt.SigningMethodRS256",
"additionalContext": "Signs session JWTs"
}
]
}
}
],
"dependencies": [
{
"ref": "app:payments-api",
"dependsOn": ["crypto:alg:sha256-rsa-2048"]
}
]
}
We validated this document against the official bom-1.6.schema.json with Python jsonschema 4.25.1 (Draft 7), with zero errors. Field notes:
assetTypemust be one ofalgorithm,certificate,protocolorrelated-crypto-material. Keys go underrelated-crypto-materialwith arelatedCryptoMaterialProperties.typesuch asprivate-keyorpublic-key.primitiveis an enum:signature,pke,key-agree,kem,hash,mac,block-cipher,aeand a few more. Free text like "Key exchange" fails validation. RSA signing issignature; RSA-OAEP encryption ispke; ECDH and X25519 arekey-agree; ML-KEM iskem.nistQuantumSecurityLevelruns 0 to 6. Use0for anything quantum-vulnerable. That one field is what makes a CBOM sortable by PQ risk.classicalSecurityLevelis in bits: 112 for RSA-2048, 128 for RSA-3072 or P-256.oidhere issha256WithRSAEncryption. For an ECDSA P-256 key, you'd useid-ecPublicKey(1.2.840.10045.2.1) and setcurve.evidence.occurrenceswithlocationandlineis where your scan results go. Keep one component per algorithm configuration and list every call site as an occurrence, rather than one component per line.
Validate before you hand a CBOM to anyone, including one a tool generated for you. Generators get the enums wrong more often than you'd think, and a consumer that rejects the file is worse than no file.
A CBOM records what crypto exists. To plan migration you also need, per asset: an owner, what data it protects and for how long (harvest-now-decrypt-later risk is about data lifetime), and whether it's exposed externally. Put those in your tracker or as properties on the component. Our post-quantum migration roadmap covers how to turn that into a prioritized plan.
How do you keep the inventory current?
A one-off inventory is stale within a sprint. What keeps it alive:
- Commit the patterns. Put the Semgrep rules and ripgrep commands in the repo and run them in CI. Fail the build on new quantum-vulnerable call sites, not existing ones, or the gate gets disabled within a week.
- Re-run on dependency changes. Most new crypto arrives through a lockfile diff, not a code change.
- Rescan live endpoints and cloud keys on a schedule. Certificates rotate, KMS keys get created by hand, and a load balancer policy change can quietly drop your hybrid key exchange.
If you want a quick first pass before building all of this, the free scan at qunoq.com takes a public GitHub/GitLab repo or a domain and lists the quantum-vulnerable crypto it finds, with file, line, snippet and the NIST replacement, in about 20 seconds. As the Ed25519 misses above show, it won't catch everything, so pair it with the greps in this article.
If you're building a crypto inventory and want to compare notes with people doing the same, join the Qunoq Slack community.
FAQ
What is a cryptographic inventory?
A cryptographic inventory is a list of every place your systems use cryptography: which algorithm, key size and library, where the code or key lives, what it protects, and who owns it. NIST's IR 8547 tells organizations to start the post-quantum migration with cryptographic inventories, then migration planning. In practice it's code findings, keys, certificates, configs and cloud keys combined, usually exported as a CycloneDX CBOM.
How do I find RSA usage in a codebase?
Search for the APIs, not the word: crypto/rsa imports in Go, KeyPairGenerator.getInstance("RSA") in Java, rsa.generate_private_key in Python, generateKeyPairSync('rsa') and 'RS256' in Node, RSA.Create() in .NET, and EVP_PKEY_RSA or RSA_new in C. Then check key files with openssl pkey -text, certificates with openssl x509 -text, JWKS files for "kty":"RSA", and Terraform for RSA_ key specs. The commands in this article cover all of these.
Is AES-256 quantum-safe?
Yes, for practical purposes. NIST's IR 8547 says approved symmetric primitives with at least 128 bits of classical security meet at least Category 1 post-quantum security, and lists AES-256 at Category 5. You don't need to migrate AES, SHA-2 or HMAC-SHA2 for quantum reasons.
Is Ed25519 quantum-resistant?
No. Ed25519 is an elliptic-curve signature scheme (EdDSA), and Shor's algorithm breaks it just as it breaks ECDSA and RSA. NIST IR 8547 lists EdDSA alongside ECDSA and RSA as deprecated after 2030 and disallowed after 2035. The same goes for X25519 key agreement used on its own.
What is the difference between an SBOM and a CBOM?
An SBOM lists software components and their versions; a CBOM lists the cryptographic assets those components use: algorithms, keys, certificates and protocols, with properties like primitive, key size and quantum security level. In CycloneDX 1.6, both live in the same document format, and crypto assets are components with type: cryptographic-asset. A dependency in an SBOM tells you a library is present; the CBOM tells you RSA-2048 signing happens at a specific location.
Should test files be included in a crypto inventory?
Yes, but tracked separately from production. In our scan of four open-source repos, 86% of findings were in tests and fixtures, so mixing them in hides real risk. Keep test assets in the inventory so you can confirm that no test key or certificate is reused in production, and so your tests get updated when the production algorithm changes.