Cryptography Bill of Materials (CBOM)
Generate a CycloneDX 1.6 Cryptography Bill of Materials — an inventory of the cryptographic assets in your code — with xgrep sbom --include cbom.
xgrep sbom --include cbom .
xgrep sbom --include cbom -o cbom.json .A Cryptography Bill of Materials (CBOM) is a machine-readable inventory of the cryptographic assets your code uses — algorithms, key material, and protocols — and the relationships between them. It answers a question a vulnerability scan does not: "what cryptography do we use, and where?" That inventory is the starting point for post-quantum-cryptography (PQC) migration and for cryptographic compliance and audit.
xgrep emits a CBOM in the CycloneDX 1.6 format, produced with the upstream CycloneDX Go library, so the output conforms to the official CycloneDX 1.6 schema and is consumable by the broader CycloneDX ecosystem (CBOMkit, CBOM viewers, PQC-migration tooling).
Inventory, not findings
A CBOM is fundamentally different from a vulnerability report. It is a complete
inventory: strong, correctly-used cryptography (for example AES-256-GCM) is
listed as an asset, not flagged as a problem. Each asset is enriched so you can
tell the strong from the weak at a glance — see asset fields
below.
Because of that, a CBOM is generated by the sbom command (it is a bill of
materials, like the dependency SBOM), not by xgrep scan. Detection runs as its
own rule category (cbom) that is off in a normal scan, so it never adds
inventory noise to your findings — and your existing weak-crypto security rules
(weak-cipher, weak-hash, insecure-TLS, …) keep reporting vulnerabilities in
xgrep scan exactly as before.
Selecting crypto, alone or combined
--include chooses what a bill of materials contains:
xgrep sbom— a Software BoM: your third-party dependencies (the default).xgrep sbom --include cbom— a Cryptography BoM: the cryptographic assets in your source, and only those. No software dependencies.xgrep sbom --include sca,cbom— both, merged into one CycloneDX 1.6 document (addaibomto fold in the AI inventory as well).
A set containing cbom emits CycloneDX 1.6 JSON. Add --spec-version 1.7 to
stamp the document as CycloneDX 1.7 instead; the crypto content is the same, and
valid under both versions. --ref (build the BOM
for a commit/tag/branch) and --exclude-dir (prune directories) apply to every
content kind, including the crypto scan. Under --ref, the certificate, key,
configuration and script files are read from the ref too, not from the working
tree. --exclude <glob> (repeatable) and --xgrepignore filter the crypto and
AI scan as they filter xgrep scan, source files and the files the CBOM reads
alike; they do not change the dependency parse. The dependency-only filters
(--ecosystem, --direct-only, --include-dev) act on the sca content — so
they require sca to be selected. See
Combined bills of materials.
The older
xgrep sbom --cbomflag has been removed; use--include cbom.
Production crypto and test crypto
Every crypto asset carries an xgrep:cbom:scope property. It says where in the
repository the asset sits: production, example, benchmark, docs,
test, generated or vendored. The scope comes from each ecosystem's path
conventions (_test.go, test_*.py, *.spec.ts, src/test/java, *Test.java,
testdata/, examples/, vendor/, …). A seventh class, dependency, marks
crypto found in a dependency's source with --cbom-deps (see
Crypto in dependency source).
Gradle test source sets (src/testFixtures/, src/integrationTest/,
src/androidTest/, src/jvmTest/), test-named directories (unit_tests/,
functional-tests/, javatests/) and key files named for tests
(test-ca.pem) are tests as well. In a Java, Kotlin, Scala or Groovy file, the
directories below the source root (src/main/java/) are the package name and
do not count: src/main/java/org/test/Foo.java is production. A module named
for its language is not a source root, so java/src/test/... is a test.
A Go package named <x>test, Go's convention for a test helper
(internal/storetest), is a test when only tests use it. Every file in the
project that imports it must be a _test.go file or another such helper, at
least one test must reach it, and its name must say what it serves: x names
a directory above it, or the package imports testing. A package main
named <x>test under an internal/ directory, such as a plugin built for
the tests, is a test when it imports such a helper. A <x>test package that
production code imports, or that nothing in the project imports, stays
production: it may be a published helper library. So does latest, attest
or any other package that merely ends in test.
A CI test run's own files are tests too: under a top-level .github/,
.circleci/ or .gitlab/ directory, a file or directory named with a ci,
test or tests word, such as .github/setup_ci.sh or
.github/workflows/ci.yml. The rest of those directories is production,
because a release workflow signs what the project ships. So are
.gitlab-ci.yml, .circleci/config.yml, and a source directory named
github/.
A language's own test markers count too, for code whose path looks like production:
- a Rust item under
#[cfg(test)]; - a Go file built only for an
integration,e2eor similar build tag; - a Python module that is a
unittestorpytestsuite.
An asset used in production code and in a test is a production asset. Test
crypto is real information — a test CA, a hard-coded test key — so it is marked,
not dropped. To keep only production crypto, pass --cbom-scope production:
xgrep sbom --include cbom --cbom-scope production .An asset whose scope is test also carries the CycloneDX component field
"scope": "excluded", which CycloneDX defines as documenting "component usage
for test and other non-runtime purposes", so any CycloneDX tool can set test
crypto aside without reading xgrep's property. Every other asset leaves the
field unset, which CycloneDX reads as required. That includes example,
benchmark and docs assets: their class comes from directory names, and
marking a runtime asset excluded would hide it from tools that filter on the
field.
Implemented, used, default, allowed, or a reference
An algorithm is often named where it is not run: a list of supported signature
algorithms, a switch with an arm for every JWS alg, a library default, a
table that maps one name to another. Each algorithm asset carries an
xgrep:cbom:role property that says what the code does with it:
| Role | Where the code names it |
|---|---|
implemented | the project's own code computes the primitive, and a call or dispatch in the project reaches it (see below) |
used | a crypto call, or any place not listed below |
default | an instance field's initial value, a DEFAULT_… constant, a member set in a constructor, or a setter that fills in an unset value |
allowed | an array, list or set (List.of(…), algorithms=["RS256"]), an enum constant, a switch case or equality check, or the key of a lookup table |
reference | the value of a lookup table keyed by another name, such as a report table that maps "sha256" to its XML Signature URI |
The asset's role is the strongest one among the places that name it, in the
order of the table. An algorithm that is listed in one place and called in
another is used. The role is read from the syntax tree in Java, Kotlin,
Scala, Python, Go, JavaScript/TypeScript, C#, PHP and Ruby. In other languages, and in any place
the tree does not make clear, the algorithm counts as used. A constant that
only gives an identifier a name, like String AES_128 = "…#aes128-cbc", is
also used: its role is decided where the constant is used.
A primitive is implemented only on two kinds of evidence together: a
definition named for it (a function, method or class such as CMAC,
createTwofish or GenericS2K), and the structure that primitive has in that
definition's body. The structure is either its published constants (eight or
more consecutive values of a table such as Twofish's q0/q1), or the
building blocks it is made of, which may sit one call deep in a helper of the
project: CMAC is a block cipher in CBC mode and the 0x87 subkey doubling;
EAX is CTR mode and the project's CMAC; OCB is a block cipher and the offset
doubling; ConcatKDF is a hash over the 32-bit counter 00000001, the shared
secret and the other info; OpenPGP S2K is a hash in a loop over the salt and
the passphrase; PBKDF2, which SCRAM's Hi() is (a definition named for
pbkdf2 or scram, such as postgres's scram_SaltedPassword), is a loop
that runs an HMAC and XORs its output into the result. PBKDF2 is named with
its hash (PBKDF2-SHA256) only when the HMACs it runs state one. A name
alone, or the constants alone (a test-vector table), is not reported. A
function whose body calls a library's primitive of the same algorithm is a
wrapper and is not an implementation.
A CMAC, EAX or OCB built on a block cipher is named at the key sizes the
project calls that cipher with, where its calls name them: a CMAC whose CBC
runs createCipheriv('aes-' + (key.length * 8) + '-cbc', key, iv) is
AES-128-CMAC, AES-192-CMAC and AES-256-CMAC. Where no call names a size,
it is reported without one (AES-OCB). A WebCrypto length names a key
size only in key-generation, import and derivation parameters: in encrypt
parameters that carry a counter or an iv, it is the counter's length, and
the algorithm is reported without a size.
The asset is reported only where a call in the project reaches it: a direct
call or new that binds to the definition, or a reference to it that a
dispatch selects (a switch arm that returns it, an entry of an object
literal). An implementation nothing in the project calls is not an asset.
It appears at the definition, with the note implemented here; reached from <path>:<line>, and at each reaching call, with the note call to the project's <name> at <path>:<line>. It names no library. An implementation
reached only from tests has test scope. Definitions in vendored, dependency
and generated trees are not read. Implementations are recognized in
JavaScript, TypeScript, C and C++.
The C and C++ rules that match a reference implementation's own function
names (the table below: crypto_kem_sntrup761_*, Curl_hmacit, ...) report
implemented when the function they call is defined in the scanned tree, and
then also appear at that definition, with the scope of the calls that reach
it. A definition whose body calls a library's primitive of the same algorithm
is a wrapper, and its calls stay used. When only its prototype is in the
tree (the project links the implementation), or the name is defined more
than once, the call stays used, with no library. A part of an implemented
asset is used: curl's own HMAC-MD5 runs MD5 without implementing it.
One enum constant or table entry that writes the same algorithm several ways
is one asset. In RSA_SHA256("…#rsa-sha256", "…#sha256", "SHA256withRSA"), the
digest URI names SHA-256, which is part of SHA256withRSA. SHA-256 is therefore
recorded as a component of SHA256withRSA, and the application does not depend
on it directly unless the code uses it somewhere else.
A value can reach a crypto call only as a parameter's default: Python's
def make_key(bits=3072) called as make_key(), an R function's size = 256, or a Common Lisp &key (digest :sha256) that a call omits. The code then
runs that value whenever the caller passes no other. Such an asset carries
xgrep:cbom:valueSource = default, so a reader can tell an RSA-2048 the code
only defaults to from one it fixes. Each occurrence's context says parameter default. A default is named where the function is called without the
argument, or, for a function nothing in the scanned tree calls (a library entry
point), at the function's own crypto call. The property is kept only while
every occurrence of the asset reaches it through a default: one place where
the code fixes the value (a literal at the call, a call that passes the
argument, or a branch that assigns the same value) clears it. It says nothing
about the asset's xgrep:cbom:role, and the two can appear together.
A value can also be one of a set the code states in full. Each member is named
at the call, and the occurrence's context names the construct: a C switch
whose every case assigns a digest selector such as EVP_sha256() and breaks or
leaves, an #if/#else chain that assigns one in each arm, an R switch, an
Elixir guard (when d in [:sha256, :sha384]) on the clause that calls a
helper, a Python parameter annotated with the project's own Enum, and a Perl
if ($alg =~ /^HS(256|384|512)$/) block whose "SHA$1" reaches the call. A
set with a member the code computes at run time names nothing. The names a Perl
anchored regex spells (/^A(128|192|256)GCM$/) are also reported at the regex
with the role allowed, as names the code accepts.
In C and C++, an SSH algorithm name a table holds through an object-like
#define of one string literal ({ KEX_DH14_SHA256, … } with
#define KEX_DH14_SHA256 "diffie-hellman-group14-sha256") is read as that
name, and a literal that lists SSH names separated by commas
("rsa-sha2-512,rsa-sha2-256") names each of them, only when every part is
an SSH name. As for a literal, the name counts only in a file that makes a
crypto call. openssh's dh_new_group1/14/16/18() are the 1024-, 2048-, 4096-
and 8192-bit Diffie-Hellman groups. A C signature made on a PKCS#11 token
names the private key it uses by its mechanism (CKM_EDDSA, CKM_ECDSA,
CKM_RSA_PKCS, …): set on the CK_MECHANISM passed to C_SignInit, or
passed to a function of the same file that sets it from its parameter and
calls C_SignInit — Ed25519 Private Key (PKCS#11) when the caller sizes
the signature with crypto_sign_ed25519_BYTES.
C and C++ code in the arm of a literal #if 0 is compiled by no build, so
nothing written there is inventoried, as a use or as an algorithm the project
implements. The #elif and #else arms of that conditional, and the
branches of every other conditional (#if 1, #ifdef FOO,
#if defined(X)), are all inventoried, since some build can choose them.
What gets detected
The CBOM reads every kind of file in the scanned tree that can state cryptography:
- source code, through a pack of detection rules per language: the libraries and APIs in the table below. Which languages meet the full bar is listed under Supported languages;
- key and certificate files, and keys and certificates written as PEM into source code;
- configuration files: web servers and proxies, SSH, IPsec, Kerberos, WireGuard, framework and JVM settings, Kubernetes, OIDC, SAML, DNSSEC, and the Jinja2 templates and Ansible roles that generate them;
- command-line tools run in shell
and PowerShell scripts, Dockerfiles, Makefiles, CI workflows and
package.jsonscripts; - Terraform: key-management keys, the
tlsprovider's keys and certificates, and the TLS settings of cloud resources (theTerraform (HCL)rows of the table below); - compiled artifacts: Java archives, Python wheels and Go executables;
- key-management services and hardware: AWS KMS, Google Cloud KMS, Azure Key Vault and Managed HSM, Vault Transit, PKCS#11 tokens, TPMs, the Android Keystore, the Apple Keychain and Secure Enclave, and Windows CNG and DPAPI, in the table below (see also where a key-management service runs its crypto);
- dependencies: the algorithms a declared crypto package
provides, and with
--cbom-depsthe crypto in dependency source on disk; - container images and root filesystems: the crypto libraries the operating system installs.
What none of these can see or decide is listed under Limits, and how accurate the result is under How accurate it is.
Detection in code is language- and library-aware. The table below lists the libraries covered and the detected API surface per library:
| Language | Library | Detected API surface |
|---|---|---|
| Java | JCA (javax.crypto / java.security) | Cipher, MessageDigest, Mac, Signature, KeyGenerator, KeyPairGenerator, SecretKeyFactory, SSLContext, CertificateFactory, and AlgorithmParameterGenerator for Diffie-Hellman (sized by its init or a DHGenParameterSpec; a key agreement's DHParameterSpec by its prime). SecretKeySpec and the DH and other key specs are keys of the algorithm they name. A Cipher initialized with the key that a KeyGenerator of the same algorithm generated in the same method is sized by that generator's init (AES-256-CBC); a key passed in or built from raw bytes leaves it unsized. MGF1 is reported where an OAEPParameterSpec or PSSParameterSpec names it. A JCA standard name held by an identifier that says it holds an algorithm (setSignatureAlgorithm("SHA256withRSA"), SIGNATURE_ALGORITHM = "…"), including the values of a lookup table whose map is named that way (sigAlgs.put("RS384", "SHA384withRSA")) |
| Java | BouncyCastle (lightweight API) | Engines & digests (AESEngine, SHA256Digest, …, and the AESEngine.newInstance() factories), HMac. A MAC, mode, key wrap or KDF is named by the objects the code builds it from: new CMac(new AESEngine(), 128) is AES-CMAC, new PaddedBufferedBlockCipher(CBCBlockCipher.newInstance(engine)) the engine in CBC, new HKDFBytesGenerator(new SHA512Digest()) HKDF-SHA512, read through the method's locals and sized by a literal key its init passes (AES-128-CBC-MAC). Key parameters (new RSAKeyParameters(true, …), MLKEMPrivateKeyParameters(MLKEMParameters.ml_kem_512, …)) are private or public keys of their algorithm, in a file that imports the class from BouncyCastle; a run-time isPrivate names no key |
| Java | Nimbus JOSE+JWT | RSASSASigner and RSASSAVerifier are listed as RSA signatures, in a file that imports from com.nimbusds.jose.crypto (the scheme, PKCS#1 v1.5 or PSS, is the one the JWS header names); ECDSASigner as ECDSA |
| Java | BouncyCastle OpenPGP and CMS | the algorithm tags a PGP or CMS builder is given: SymmetricKeyAlgorithmTags.AES_256 (OpenPGP CFB), HashAlgorithmTags.SHA256, PublicKeyAlgorithmTags.RSA_GENERAL, CMSAlgorithm.AES256_GCM. A tag the code compares against or switches on is not reported |
| Java, C# | XML Signature and XML Encryption (and so SAML signing) | code that signs, verifies or encrypts XML is listed as an XML-DSig or XML-Enc protocol (CycloneDX protocol type other): Java XMLSignatureFactory.getInstance/newXMLSignature/unmarshalXMLSignature, Apache Santuario new XMLSignature(…) and XMLCipher.getInstance/getProviderInstance; .NET new SignedXml(…), new EncryptedXml(…) and EncryptedXml.EncryptKey/DecryptKey. The W3C algorithm URIs the code names (http://www.w3.org/2001/04/xmldsig-more#rsa-sha256, …xmlenc11#aes256-gcm) are listed as algorithms. OpenSAML's SignatureConstants (ALGO_ID_SIGNATURE_RSA_SHA256, ALGO_ID_DIGEST_SHA256) are read wherever the code references them, statically imported or qualified, including as an enum constant's arguments. Signing or verifying a signature object already built adds nothing further. An XML Encryption 1.1 key derivation whose parameter object leaves its hash unset is named with the hash it falls back to: Santuario's HKDF runs HKDF-SHA256 and its ConcatKDF ConcatKDF-SHA256 while no PRF or digest is set, marked valueSource = default at the call that instantiates the hash. It is read only when the parameter class passes its KDF's URI to its superclass and its getter falls back to a constant through a private field no subclass overrides; a fallback the getter computes, a public field and a KDF the caller chooses name nothing |
| Java, Kotlin | JSSE default managers | TrustManagerFactory.getDefaultAlgorithm() and KeyManagerFactory.getDefaultAlgorithm(), simple or javax.net.ssl.-qualified, are listed as the trust and key managers the JDK selects by default: PKIX and SunX509 (CycloneDX primitive other). These are the defaults the JDK's java.security ships. A deployment can override them, and the source cannot show it |
| Java | Crypto utility libraries | Apache commons-codec DigestUtils (sha256Hex, md5Hex, getSha512Digest, …), HmacUtils and HmacAlgorithms/MessageDigestAlgorithms constants; Guava Hashing (sha256(), hmacSha256(key), …); Spring DigestUtils.md5DigestAsHex; Hutool SecureUtil/DigestUtil/SmUtil (md5, sha256, hmacSha256, aes, sm3, sm4, …) and DigestAlgorithm/HmacAlgorithm. A non-cryptographic hash (Guava crc32, murmur3_128) is not listed |
| Kotlin | JCA | as Java JCA |
| Swift | Secure Enclave | keys created inside the Secure Enclave: CryptoKit SecureEnclave.P256.Signing/KeyAgreement.PrivateKey, SecureEnclave.MLKEM768/MLKEM1024/MLDSA65/MLDSA87.PrivateKey, and a Security-framework key whose attributes name kSecAttrTokenIDSecureEnclave (always P-256), reported with securedBy: Secure Enclave — EC-secp256r1 Private Key (Secure Enclave). A software CryptoKit key is not marked |
| Swift | Keychain | Security-framework keys read from their attribute dictionary (inline, or declared before the call): SecKeyCreateRandomKey with kSecAttrKeyType (RSA with its kSecAttrKeySizeInBits, or EC on the P-256/P-384/P-521 curve its size picks). A key whose private-key attributes set kSecAttrIsPermanent: true, and a SecItemAdd of class kSecClassKey, are reported with securedBy: Keychain — RSA-3072 Private Key (Keychain). A key item's kSecAttrKeyClass names its half (RSA-2048 Public Key (Keychain)). A key created without it is a software key, and so is one only whose public-key attributes are permanent. The dictionary must be the one the call receives: a parameter, a dictionary of the same name in another function, a password item, or a dictionary merged or reassigned before the call is no key, and an entry assigned by subscript before the call (attrs[kSecAttrKeySizeInBits as String] = bits) is not read |
| C / C++, C# | Windows CNG key storage providers | keys persisted with NCryptCreatePersistedKey/NCryptOpenKey or .NET CngKey.Create, marked securedBy with the provider the file opens them on — TPM (Microsoft Platform Crypto Provider), Smart Card KSP or Software KSP — as in RSA Private Key (TPM). A file that opens no provider, several kinds, or one chosen at run time leaves its keys unmarked |
| C / C++, C# | Windows DPAPI | data sealed with CryptProtectData/CryptUnprotectData or ProtectedData.Protect/Unprotect, reported as DPAPI with the protection current Windows applies by default, AES-256-CBC and HMAC-SHA-512. A registry policy can change those defaults, and the source cannot show it |
| Java, Kotlin | Android Keystore | keys generated inside the Android Keystore (KeyPairGenerator/KeyGenerator.getInstance(…, "AndroidKeyStore"), by literal or KeyProperties.KEY_ALGORITHM_*), reported as key assets with CycloneDX securedBy: Android Keystore — ECDSA Private Key (Android Keystore). When the file's KeyGenParameterSpec asks for StrongBox (every setIsStrongBoxBacked call passes true), the key is securedBy: Android StrongBox instead. When the file builds one KeyGenParameterSpec for one Keystore generator, the key also carries what the spec states: setKeySize, the ECGenParameterSpec curve, setBlockModes, setEncryptionPaddings/setSignaturePaddings (when exactly one is allowed) and setDigests — AES-256 Secret Key (Android Keystore) referencing AES-256-GCM, EC-secp384r1 Private Key (Android Keystore) depending on SHA-256. A key from any other provider is not marked |
| Go | TPM (go-tpm, go-tpm-tools) | keys created inside a TPM: go-tpm-tools' default attestation, endorsement and storage-root keys (client.AttestationKeyRSA, …ECC), go-tpm's predefined templates (tpm2.RSASRKTemplate, tpm2.ECCEKTemplate), and custom templates (tpm2.TPMTPublic with TPMSRSAParms{KeyBits: …} or TPMSECCParms{CurveID: …}, and the legacy tpm2.Public with RSAParams/ECCParams), reported as RSA-2048 Private Key (TPM) or EC-secp256r1 Private Key (TPM) with securedBy: TPM. A key loaded from a persistent handle states no algorithm and is not reported |
| C / C++ | TPM (tpm2-tss) | keys created by Esys_CreatePrimary/Esys_Create/Esys_CreateLoaded or Tss2_Sys_CreatePrimary/Tss2_Sys_Create from a TPM2B_PUBLIC template the file builds, by designated initializer or field assignments, passed by address or through a pointer set to it (for Esys_CreateLoaded, the TPMT_PUBLIC the file marshals into its template), and keys Fapi_CreateKey creates under the profile its path starts with (/P_RSA2048SHA256/…, /P_ECCP256SHA256/…): an RSA template with its keyBits, an ECC template with its curveID (TPM2_ECC_NIST_P256, …), each a literal or a single same-file #define, reported with securedBy: TPM. The template is read in the function that makes the call (or at file scope for a file-level template). A template passed in from elsewhere, one returned by a helper, reassigned whole or in part, handed to another function that could fill it (anything but memset(&t, 0, …)), or reached through a pointer that could point at more than one template, is not reported; nor is a keyed-hash or symmetric template. A Fapi_CreateKey path with no profile prefix, or one chosen at run time, is reported as Private Key (TPM), with no algorithm |
| C, Go, Python | PKCS#11 key generation | a key a token generates is reported with securedBy: PKCS#11: C C_GenerateKeyPair/C_GenerateKey, miekg/pkcs11 GenerateKeyPair/GenerateKey, crypto11 GenerateRSAKeyPair/GenerateECDSAKeyPair/GenerateSecretKey, PyKCS11 generateKeyPair/generateKey, and python-pkcs11 generate_keypair/generate_key and the generate_keypair() of domain parameters from create_domain_parameters/generate_domain_parameters (EC, DSA, DH). python-pkcs11's pkcs11.lib(path), the module whose tokens hold the keys, is a Keystore (PKCS11). The algorithm is the key-generation mechanism's (CKM_RSA_PKCS_KEY_PAIR_GEN, CKM_EC_KEY_PAIR_GEN, CKM_AES_KEY_GEN, …), also when it is a CK_MECHANISM built in another statement. The size is CKA_MODULUS_BITS or CKA_VALUE_LEN, and the curve the OID in CKA_EC_PARAMS (or encode_named_curve_parameters), read only from the template the call passes — the public-key template of a key pair — when it states one literal, or a variable or constant holding one. A template passed in, assigned more than once, or changed after it is built leaves the key unsized — RSA-3072 Private Key (PKCS#11), EC-secp256r1 Private Key (PKCS#11) |
| Java | PKCS#11 (SunPKCS11, IAIK wrapper) | the SunPKCS11 provider (Security.getProvider("SunPKCS11").configure(cfg), new SunPKCS11(cfg), "SunPKCS11-<name>"), the token's KeyStore.getInstance("PKCS11"), and keys generated through a "SunPKCS11-<name>" provider or a configured SunPKCS11 provider object (KeyPairGenerator.getInstance("RSA", token)), reported with CycloneDX securedBy: PKCS#11 — Keystore (PKCS#11), ECDSA Private Key (PKCS#11); and the algorithm an IAIK Mechanism.get(PKCS11Constants.CKM_*) / new Mechanism(…) or a CK_MECHANISM performs, as for C. A provider object counts only when the variable the call reads is a local, or a private or final field, and every write to it is a configured SunPKCS11 provider or its name; the unconfigured Security.getProvider("SunPKCS11"), a method parameter, a field another class could write, a provider chosen at run time, and a name the code rebinds as a lambda parameter or pattern variable are not marked. Another provider, a software key store and a run-time or vendor mechanism are not marked either |
| Scala | JCA | as Java JCA |
| Groovy | JCA | Cipher, MessageDigest, Mac, Signature, KeyGenerator, KeyPairGenerator and SecretKeyFactory via getInstance, with a literal or constant algorithm |
| Perl | Digest::SHA, Digest::MD5, Crypt::OpenSSL::RSA | sha256_hex/sha1/md5_hex/hmac_sha256_hex and the rest of the imported functions, Digest::SHA->new(512)/->new("sha384"), Digest::MD5->new, Crypt::OpenSSL::RSA->generate_key(bits). A package-qualified call (Digest::SHA::sha256_hex(…)) is not yet read |
| Lua | OpenResty | ngx.md5/md5_bin/sha1_bin/hmac_sha1, the lua-resty-string hash modules (require "resty.sha256"), and resty.aes cipher(bits, mode) |
| Clojure | buddy-core, buddy-sign, JCA interop | buddy.core.hash's functions (hash/sha256, hash/sha3-256, hash/blake2b-256, …) and hash/digest with its keyword; mac/hash/mac/verify with {:alg :hmac+sha256} (and :poly1305+aes); crypto/block-cipher :aes :gcm/:cbc/:ctr, crypto/stream-cipher :chacha; crypto/encrypt/decrypt with its :alg scheme (:aes256-gcm, :aes128-cbc-hmac-sha256, the latter when none is named); jwt/sign/unsign and jws/sign/unsign with their :alg (:hs256 when none is named); nonce/random-bytes; and (MessageDigest/getInstance "SHA-256"), (Mac/getInstance "HmacSHA256") and (Cipher/getInstance "AES/GCM/NoPadding") for the JCA standard names, imported or fully qualified. A buddy namespace is read under its documented alias (hash/, mac/, crypto/, nonce/, jwt/, jws/) or fully qualified; an algorithm held in a variable, and a JCA transformation outside the standard list, are not reported |
| R | openssl, sodium, digest | openssl md5/sha1/sha256/sha512/blake2b/ripemd160 and the rest of its hash functions (HMAC with a key =), sha3/keccak at their default size, aes_gcm_encrypt/aes_cbc_encrypt/aes_ctr_encrypt, aes_keygen, rsa_keygen/dsa_keygen/ec_keygen (with each one's default size or curve), ed25519_*/x25519_*, signature_create's hash = (SHA-1 when omitted), rsa_encrypt (PKCS#1 v1.5 unless oaep = TRUE), encrypt_envelope (AES-256-CBC), bcrypt_pbkdf, rand_bytes; sodium data_encrypt/auth_encrypt/simple_encrypt (XSalsa20-Poly1305, X25519), data_tag (HMAC-SHA-512-256), hash (BLAKE2b), shorthash, password_store/scrypt/argon2, sig_* (Ed25519), the stream ciphers and random; digest digest(algo =) and hmac (MD5 when omitted) and AES(mode =) (ECB when omitted). Each is read attached or package-qualified (openssl::sha256); another package's function of the same name is not, and sodium's generic names (hash, keygen, random) are read only qualified. A size, curve or algorithm chosen at run time is not reported, nor is sha3/keccak with a size = |
| Cairo | Starknet corelib, OpenZeppelin Cairo | core::poseidon (poseidon_hash_span, PoseidonTrait::new(), hades_permutation), core::pedersen (pedersen, PedersenTrait::new), core::keccak (keccak_u256s_be_inputs/le_inputs, cairo_keccak, compute_keccak_byte_array), core::sha256 (compute_sha256_byte_array, compute_sha256_u32_array); ECDSA on the STARK curve (check_ecdsa_signature, ecdsa::recover_public_key) and on secp256k1 / secp256r1 (is_valid_signature::<Secp256k1Point>, recover_public_key::<…>, verify_eth_signature, is_eth_signature_valid), and Secp256Trait::<…> point operations; OpenZeppelin's is_valid_stark_signature/is_valid_eth_signature/is_valid_p256_signature. A function is read imported or by its module path; another module's function of the same name is not. snforge key pairs built from a secret key the source writes (get_stark_keys_from('…'), StarkCurveKeyPairImpl::from_secret_key(0x…), a u256 { low: …, high: … } passed to the secp256k1 / secp256r1 helper or bound by a let before it) as that curve's hard-coded private key; a key passed in or a computed half is not reported |
| Jsonnet | standard library, configuration fields | std.md5, std.sha1, std.sha256, std.sha512 and std.sha3 (SHA3-512); only the std object's functions are read. importstr of /proc/sys/kernel/random/uuid or /dev/(u)random as the kernel DRBG. Fields that name key material by their name (private_key, APP_PUBLIC_KEY_PATH, *_ENCRYPTION_KEY, JWT_SECRET); a private_key_passphrase set to a string as an encrypted private key (~ and an empty string protect nothing). A compact JWT written as a string as JWT, with the algorithm its header's alg names (HS256 is HMAC-SHA-256); a string that is not three base64url segments with JSON header and claims names nothing. TLS minimum-version fields and NODE_TLS_REJECT_UNAUTHORIZED |
| Common Lisp | Ironclad | make-digest/digest-sequence/digest-file/digest-stream with the digest keyword (:sha256, :sha3/256, :blake2, …; :sha3 and :keccak are 512-bit), make-hmac and make-mac (:hmac, :poly1305, :siphash, :cmac, BLAKE2 MACs), make-cmac, make-cipher (a block cipher in its :mode, or a stream cipher), make-authenticated-encryption-mode :gcm/:eax with its :cipher-name, make-kdf (:pbkdf2 with its :digest, :scrypt-kdf, :argon2id, :bcrypt, :hmac-kdf), pbkdf2-hash-password (SHA-256 when no :digest is given), generate-key-pair (:rsa/:dsa/:elgamal with :num-bits, Ed25519, X25519 and the secp curves) and random-data/make-prng. Each is read as ironclad:, crypto: or imported; an algorithm held in a variable is not reported, nor are Keccak-224/384, RIPEMD-128, Streebog and Tiger |
| Scheme | Guile-Gcrypt | (gcrypt hash): the (hash-algorithm NAME) a bytevector-hash, open-hash-port, port-hash or file-hash call is given (sha256, sha512, sha3-256, rmd160, …), (lookup-hash-algorithm 'NAME), and (sha256 bv). A program's own procedure named sha256 is not it, and CRC24 is not a cryptographic hash. (gcrypt pk-crypto): the canonical s-expressions that state an algorithm, as a string or a format template — (genkey (rsa (nbits 4:4096))) (RSA-4096), (genkey (dsa …)), (genkey (ecdsa …)) (ECDSA, whatever the curve), (genkey (ecc (curve Ed25519) (flags eddsa))) (Ed25519), (sig-val (rsa …)) and (sig-val (dsa …)), and (public-key (rsa …)) / (dsa …) / (ecc (curve Ed25519) …) and (private-key (rsa …)) as keys of that algorithm; an Ed25519 public key formatted from "(public-key (ecc (curve ~a) …" when the curve variable is defined in the same let* or procedure by a match that names 'Ed25519; the 'Ed25519 curve symbol; (flags pkcs1) in a file that signs or verifies (RSASSA-PKCS1-v1_5); (hash-algo sha512) in quoted data; a cond table of quoted hash names in a file that calls lookup-hash-algorithm; and the keys of find-sexp-token … 'public-key / 'private-key, (sign data key) and (verify sig data key). An (sig-val (eddsa …)) names no curve and is not read |
| Scheme | Guile-SSH, Guile-GnuTLS, Guile-Git | Guile-SSH's make-session with #:host (SSH), private-key-from-file (an SSH Private Key, in whatever encoding the file holds) and public-key-from-file, string->public-key and get-server-public-key (OpenSSH public keys). Guile-GnuTLS, imported or loaded with (resolve-interface '(gnutls)): (make-session connection-end/client ...) (TLS), import-x509-certificate, the set-certificate-credentials-x509-trust-file! / -trust-data! trust anchors and the /etc/ssl/certs paths (the system store; a path appended to another directory is not). Guile-Git's set-tls-certificate-locations! and the system store paths in a file that calls it. Guix's (guix openpgp) verify-openpgp-signature is OpenPGP. Every one is read only in a file that imports its module |
| Solidity | EVM builtins, OpenZeppelin | keccak256, sha256, ripemd160, ecrecover (ECDSA on secp256k1); OpenZeppelin ECDSA.recover/tryRecover, SignatureChecker.isValidSignatureNow, MessageHashUtils.toEthSignedMessageHash/toTypedDataHash, _hashTypedDataV4 (Keccak-256), P256.verify (ECDSA on P-256); the precompiles called by fixed address, staticcall(gas(), 0x08, …) in inline assembly or address(0x08).staticcall(…): ecrecover, SHA-256, RIPEMD-160, the BN254 ecAdd/ecMul/ecPairing, blake2f (BLAKE2b), KZG point evaluation and the BLS12-381 operations, and P256VERIFY. A library's own Lib.sha256(…) is not the builtin, and a call to a variable or ordinary contract address is not a precompile |
| Python | stdlib hashlib / hmac | md5/sha1/sha256/sha512, hashlib.new, pbkdf2_hmac, hmac; a constructor handed on uncalled, returned (return hashlib.sha224) or passed as an argument (hmac.new(key, msg, hashlib.sha256)), while one kept in a name, compared or written in a string is not reported |
| Python | Django, Werkzeug password hashing | make_password(…, hasher)/get_hasher(name) (pbkdf2_sha256, argon2, bcrypt_sha256, scrypt, …), generate_password_hash(…, method=…), salted_hmac (SHA-1 by default, or its algorithm=). A call that names no hasher uses a project or release default and is not guessed |
| Python | pyca/cryptography (hazmat) | hashes.*, ciphers.algorithms.*, ciphers.aead.* (AESGCM/AESCCM/AESGCMSIV/AESOCB3/ChaCha20Poly1305) and the secret key their generate_key and Fernet.generate_key return (AES-128 Secret Key, Fernet Secret Key), HMAC, padding.MGF1, RSA/EC/Ed25519/DSA keygen and DH parameters with their size (DSA-1024, DH-2048), the private keys they generate (a DH key from parameters a local holds), RSA, DSA and DH keys built from their Public/PrivateNumbers classes, the public half of a key generated in the same scope (k = Ed25519PrivateKey.generate() then k.public_key(), with the generation's size or curve; a key passed in, or a name written again before the call, is not), a loaded key cast to RSAPrivateKey/RSAPublicKey (named RSA beside the PEM key), PBKDF2HMAC/Scrypt/HKDF, ConcatKDFHash/ConcatKDFHMAC with their hash (ConcatKDF-SHA256, ConcatKDF-HMAC-SHA256), CMAC over AES as AES-CMAC, counter-mode KBKDFHMAC/KBKDFCMAC named as SP 800-108 KDFs (SP800_108_CounterKDF-HMAC-SHA256, and SP800_108_CounterKDF-AES-256-CMAC when the bytes literal its derive() is given states the key size), x509 certificates. Classes imported by name beside their module, or through a star import of the pyca module (the file's only one), are read. A hash object nothing uses (a bare statement, the argument of a constructor whose result is thrown away, or bound to a name nothing reads) is not reported |
| Go | crypto/* (stdlib) | aes, des, rc4, md5, sha1, sha256, sha512, hmac, rsa, ecdsa, ed25519, x509/tls certificates |
| Go | golang.org/x/crypto | sha3, chacha20poly1305, pbkdf2, hkdf, bcrypt, scrypt, argon2, blake2b, blake2s, ripemd160, md4, salsa20, chacha20 (unauthenticated), poly1305, and the legacy block ciphers twofish, blowfish, cast5, tea, xtea |
| Go | OpenPGP (x/crypto/openpgp, ProtonMail go-crypto, gopenpgp) | the cipher and public-key algorithm a packet.Config selects (in the literal or assigned to DefaultCipher), the RFC 9580 AEAD mode a go-crypto packet.AEADConfig selects (DefaultMode: packet.AEADModeGCM, or OCB when unset, as the library defaults; a cipher in a literal that sets AEADConfig encrypts in that mode, so it is not reported as CFB), and gopenpgp GenerateKey's "rsa"/"x25519" key type and RSA size. A constant the code compares against, an AEAD mode or key type chosen at run time, are not reported |
| C# | BouncyCastle OpenPGP and PgpCore | the Org.BouncyCastle.Bcpg tag a PgpEncryptedDataGenerator or PgpSignatureGenerator is given, or PgpCore's SymmetricKeyAlgorithm / HashAlgorithmTag is set to: SymmetricKeyAlgorithmTag.Aes256 (OpenPGP CFB), HashAlgorithmTag.Sha256, PublicKeyAlgorithmTag.RsaGeneral. A tag held in a variable or compared against is not reported, and PgpCore's defaults (no setting at all) are not inferred |
| C# | CMS / PKCS#7 (System.Security.Cryptography.Pkcs) | SignedCms and EnvelopedCms constructed, and ComputeSignature/CheckSignature/Encrypt/Decrypt on a receiver of that type, as a CMS protocol; the content-encryption algorithm an AlgorithmIdentifier names by OID literal (new AlgorithmIdentifier(new Oid("2.16.840.1.101.3.4.1.42")) → AES-256-CBC) and a signer's DigestAlgorithm = new Oid("…"). An OID that names no algorithm (a content type) or one chosen at run time is not reported |
| C / C++ | CMS and PKCS#7 (OpenSSL) | CMS_sign/CMS_sign_ex/CMS_verify/CMS_encrypt/CMS_encrypt_ex/CMS_decrypt as a CMS protocol and PKCS7_sign/PKCS7_verify/PKCS7_encrypt/PKCS7_decrypt as PKCS#7; the cipher handed to CMS_encrypt/PKCS7_encrypt (EVP_aes_256_cbc()) is reported by its EVP selector |
| JavaScript / TypeScript | OpenPGP.js (openpgp) | openpgp.encrypt/decrypt/sign/verify/generateKey as an OpenPGP protocol; generateKey's key: an ecc key on its curve (Ed25519 for the 25519 curves and by default, ECDSA on a NIST, Brainpool or secp256k1 curve), RFC 9580 type: 'curve25519'/'curve448', and type: 'rsa' with rsaBits (4096 when omitted), whether the options object is written in the call or built in its own statement (const options = { type: 'ecc', curve: 'nistP384' } then generateKey(options)); a config's preferredSymmetricAlgorithm (OpenPGP CFB) and preferredHashAlgorithm, and with aeadProtect: true its preferredAEADAlgorithm (AES-GCM, AES-OCB or AES-EAX; GCM when none is named). The same settings assigned one statement at a time count too: openpgp.config.aeadProtect = true names GCM unless the file sets preferredAEADAlgorithm, and openpgp.config.preferredAEADAlgorithm = …, or a call's config: { preferredAEADAlgorithm: … }, names its mode in a file that turns aeadProtect on; there a preferredSymmetricAlgorithm is not reported as CFB, since the message is encrypted in the AEAD mode. A key type, curve or cipher chosen at run time, an options object the call cannot be shown to read (see below), and AEAD settings in a file or object that never turns aeadProtect on, are not reported |
| Go, Python, JavaScript / TypeScript, Rust, Java | COSE messages (go-cose, pycose, python-cwt, cose-js, coset, COSE-JAVA) | a COSE_Sign1, COSE_Sign, COSE_Encrypt0, COSE_Encrypt, COSE_Mac0 or COSE_Mac message built, signed, verified or decoded, as a COSE protocol: go-cose NewSign1Message/Sign1/NewSigner/NewVerifier, pycose Sign1Message(…)/Enc0Message(…)/Mac0Message(…)/CoseMessage.decode, python-cwt cwt.encode/decode and COSE.new, cose-js cose.sign/mac/encrypt create/verify/read, coset's CoseSign1Builder/CoseEncrypt0Builder/CoseMac0Builder (and the multi-recipient forms) and from_slice, COSE-JAVA new Sign1Message()/Encrypt0Message/MAC0Message and Message.DecodeFromBytes. Beside it, the algorithm the message or key names as a literal, COSE id or library constant: go-cose cose.AlgorithmES256 given to NewSigner/NewVerifier/SetAlgorithm, as a cose.ProtectedHeader{cose.HeaderLabelAlgorithm: …} entry assigned or passed, or assigned to h.Protected[cose.HeaderLabelAlgorithm], pycose phdr={Algorithm: Es256} or {'ALG': 'A128GCM'} in the message call, python-cwt COSEKey.generate_symmetric_key/from_symmetric_key/from_pem alg="HS256", cose-js {p: {alg: 'ES256'}} in the call (for pycose and cose-js, also in a headers variable built in its own statement: header = {Algorithm: EdDSA} then Sign1Message(phdr=header), and for cose-js a protected or unprotected map in one, const prot = {alg: 'ES256'} then cose.sign.create({p: prot}, …); a cose-js MAC's 'SHA-512' there is HMAC-SHA-512), coset .algorithm(iana::Algorithm::ES256), COSE-JAVA AlgorithmID.ECDSA_256 as the HeaderKeys.Algorithm attribute or to OneKey.generateKey, written there or held in a variable assigned it (CBORObject alg = AlgorithmID.ECDSA_384.AsCBOR()). Signature (ES256/384/512, ES256K, EdDSA, Ed25519, Ed448, PS*, RS*, ML-DSA), content encryption (AES-GCM, AES-CCM, ChaCha20-Poly1305, AES-CTR/CBC), MAC (HMAC, AES-CBC-MAC) and key distribution (AES key wrap, ECDH with HKDF, RSAES-OAEP) algorithms are named. A variable is read only when the call certainly reads the value it was built with: assigned once, before the call, in a block that holds the call, with no spread or ** unpacking, never written into, aliased, or shadowed by a parameter, loop variable or other binding of the same name in the file. An algorithm held in any other variable, direct, and a Python or Java class named like a COSE message in a file that does not import the library are not reported |
| C# | System.Security.Cryptography (.NET) | hash Create/HashData, Aes/AesGcm/AesCcm/TripleDES/DES/RC2, RSA/ECDsa/ECDiffieHellman/DSA, HMAC*, Rfc2898DeriveBytes (PBKDF2), X509Certificate2; HashAlgorithm.Create, SymmetricAlgorithm.Create and CryptoConfig.CreateFromName by the name they are given |
| JavaScript / TypeScript | Node.js crypto | createHash, createHmac, createCipheriv, generateKeyPair[Sync], pbkdf2, scrypt, hkdf, createSign |
| JavaScript / TypeScript | PEM armor | a regular expression anchored on a PEM private-key armor line (/^-----BEGIN (RSA|DSA|EC) PRIVATE KEY-----/, /^-----BEGIN PRIVATE KEY-----/) parses PEM private keys: Private Key (PEM). OpenSSH's own OPENSSH PRIVATE KEY armor, a public key or certificate armor, and an unanchored search name nothing |
| JavaScript / TypeScript | CryptoJS, bcrypt, argon2 | CryptoJS.AES/SHA256/MD5/HmacSHA256, bcrypt.hash, argon2.hash |
| Ruby | OpenSSL, Digest, bcrypt, RbNaCl | OpenSSL::Cipher/Digest/HMAC/PKey (RSA/EC/DSA)/PKCS5, Digest::*, BCrypt; RbNaCl Signatures::Ed25519 and HMAC::SHA256/SHA512/SHA512256 (the last HMAC-SHA-512-256) |
| PHP | openssl_*, hash, sodium, password_hash | openssl_encrypt/openssl_pkey_new, hash/hash_hmac/hash_pbkdf2, sodium_*, password_hash (bcrypt/Argon2) |
| Hack | HHVM hash, openssl_*, sodium, password_hash, HSL SecureRandom | as PHP, each built-in bare or fully qualified (\hash(…)): hash/hash_file/hash_hmac/hash_pbkdf2 with a literal cryptographic hash name, openssl_encrypt/decrypt, openssl_pkey_new (RSA by default, or the curve_name an EC key states), OPENSSL_KEYTYPE_*/OPENSSL_ALGO_*, PEM keys and X.509, password_hash (bcrypt), sodium_*, random_bytes/random_int and HH\Lib\SecureRandom. A checksum name (crc32b, xxh3) is not listed |
| Hack | simple-web-token | sign/sign_strict/parse/parse_strict of HTL\SimpleWebToken, fully qualified anywhere or unqualified inside that namespace, as an SWT (Simple Web Token) protocol. The functions' own declarations are not reported |
| Apex | System.Crypto | generateDigest, generateMac/verifyHMac, encrypt/decrypt and the managed-IV forms (AES-128/192/256 in CBC mode, as the Apex reference fixes), sign/signWithCertificate/signXML/verify (RSA-SHA256, ECDSA-SHA384, …), generateAesKey(bits), getRandomInteger/getRandomLong. A run-time algorithm and EncodingUtil are not listed |
| Julia | SHA.jl, Nettle.jl, MbedTLS.jl, Random | SHA.jl's sha256/sha2_512_256/sha3_384/shake128, hmac_sha* and the *_CTX types (with HMAC_CTX keyed by its context's hash); Nettle's Hasher/digest/hexdigest, HMACState, Encryptor/Decryptor and one-shot encrypt/decrypt (ECB, or CBC with :CBC), gen_key32_iv16 (MD5); MbedTLS's MD_* and CIPHER_* members, keyed digest (HMAC), gen_key (RSA), parse_keyfile, crt_parse, SSLConfig (TLS), CtrDrbg; RandomDevice. A function declared with a SHA.jl name is not a use |
| PowerShell | .NET System.Security.Cryptography | [System.Security.Cryptography.T]::Create()/::new()/::HashData() (also without System., and with the type name in any case) and New-Object T: hashes, HMAC*, Aes/AesGcm/TripleDES/DES/RC2, RSA with the size it is created with, ECDsa/ECDiffieHellman with an ECCurve+NamedCurves curve, Rfc2898DeriveBytes with its HashAlgorithmName, RandomNumberGenerator, X509Certificate2, Get-PfxCertificate. The cmdlets (Get-FileHash, ConvertTo-SecureString -Key, Protect-CmsMessage, New-SelfSignedCertificate) are read as script commands |
| PowerShell | Posh-ACME, ssh, nsupdate, BouncyCastle | Posh-ACME's ACME commands (Invoke-ACME, New-PACertificate, New-PAOrder, New-PAAccount, Submit-Renewal, Submit-OrderFinalize, Submit-ChallengeValidation, Send-ChallengeAck, Revoke-PACertificate) as an ACME protocol; a typ = 'JWT' header in a file that signs with New-Jws -Compact as JWT; a hand-written TOTP (an HMAC's [-1] -band 0xf dynamic truncation in a file that takes the time step from ToUnixTimeSeconds()) as TOTP; an nsupdate key <algorithm>:<name> <secret> directive as TSIG, and the hmac-* names of a ValidateSet in the same file as its HMACs; & ssh as SSH, and an argument array's -i file in a file that runs it as an SSH Private Key; ExportParameters($true)/($false) in the file that defines ConvertTo-Jwk as a private or public key in JWK form; RSASignaturePadding Pkcs1/Pss; BouncyCastle Pkcs10CertificationRequest (X.509 CSR), the PKCS#12 PBE schemes PbeWithShaAnd3KeyTripleDesCbc/2KeyTripleDesCbc/40BitRC2Cbc/128BitRC2Cbc, and the PBKDF2 PRF a SetKeyAlgorithm call gives a PBES2 key bag. A protocol named in a comment or a string elsewhere is not reported |
| OCaml | Digestif, mirage-crypto, Cryptokit | Digestif hash modules and their hmac_*; mirage-crypto AES.ECB/CBC/CTR/GCM/CCM16, triple DES, Chacha20, Poly1305, Rsa.generate ~bits, Rsa.PKCS1, Dsa, Dh, P256/P384/P521 Dsa/Dh, Ed25519, X25519, Mirage_crypto_rng; Cryptokit Hash, MAC, Cipher (CBC by default, or the ~mode stated: ECB, CBC, CFB n, OFB n, CTR or CTR_N n, qualified or through an opened Cryptokit; a mode only known at run time names the cipher without one), AEAD, RSA.new_key, Random. Otherwise only fully qualified paths are read: a module opened or aliased, and a functor application (Rsa.OAEP (H)), are not |
| Rust | RustCrypto, ring, rsa | sha2/sha1/md-5/sha3, aes-gcm/aes, chacha20poly1305, des, hmac, hkdf, pbkdf2, argon2, bcrypt, rsa, ed25519-dalek, p256 ECDSA, x25519; ring digest/HMAC |
| Swift | CryptoKit, CommonCrypto | SHA256/384/512, Insecure.MD5/SHA1, AES.GCM, ChaChaPoly, HMAC, HKDF, Curve25519, P256/384/521; CC_MD5/CC_SHA256/CCHmac |
| Objective-C | CommonCrypto | CCCrypt/CCCryptorCreate with the kCCAlgorithm* constant in their algorithm argument (AES, DES, 3DES, CAST5, RC2, Blowfish, RC4), in CBC mode, or in ECB when the options argument is kCCOptionECBMode; options set at run time name no mode. CCCryptorCreateWithMode with its kCCMode* mode (ECB, CBC, CFB, CTR, OFB). CC_MD5/CC_SHA1/CC_SHA224/CC_SHA256/CC_SHA384/CC_SHA512 and their _Init; CCHmac/CCHmacInit keyed with their kCCHmacAlg* hash (HMAC-SHA-256), and CCKeyDerivationPBKDF with its kCCPRFHmacAlg* PRF (PBKDF2-SHA256), also when it is called through a local function pointer that every write in the calling function points at it (PBKDF = CCKeyDerivationPBKDF ?: MyPBKDF, or = &CCKeyDerivationPBKDF), declared inline or through the file's own function-pointer typedef, and when its algorithm argument is a settings field the project always sets to kCCPBKDF2; a pointer set by a ternary, written with another function, passed in or passed on names nothing. A hash or PRF chosen at run time is listed as HMAC or PBKDF2 alone. The key each cipher and HMAC call is given is listed as a secret key of the algorithm the call names (AES Secret Key, HMAC-SHA-256 Secret Key). When the code proves that key is a string written in the source, it is also listed as hard-coded (AES-256 Secret Key (hardcoded)). The key may reach the call through the project's own methods (a selector the project implements once, sent to its class, self or super), a dictionary literal read by a constant key, and a decode that only converts strings and bytes (hex, base64 or UTF-8, which give the key's size). A key looked up by name (the Keychain), held in a property, or put in a dictionary at run time is not hard-coded. SecRandomCopyBytes and CCRandomGenerateBytes are listed as DRBG. A constant may also be named through the file's own #define (#define kCipher kCCAlgorithmAES) or a field of a static const structure with a designated initializer (kSettings.algorithm, kSettings.kdf.prf); see below for when these are read. A constant in any other argument, and a method whose selector carries a C function's name, are not read |
| Objective-C | Security framework | SecKeyCreateSignature/SecKeyVerifySignature, SecKeyCreateEncryptedData/SecKeyCreateDecryptedData and SecKeyCopyKeyExchangeResult with the kSecKeyAlgorithm* constant in their algorithm argument, each read only for its own operation: RSA PKCS#1 v1.5 and PSS signatures and ECDSA with their hash, RSA-OAEP, ECIES (with its AES-GCM) and ECDH (with its X9.63 hash). SecKeyIsAlgorithmSupported is a question, and is not read. Keys as in the Swift Keychain and Secure Enclave rows, from an @{...} attribute dictionary at the call or the nearest NSDictionary *attrs = @{...} before it (with (id) casts and boxed @2048/@YES values); a dictionary filled at run time with setObject:forKey: is not read. The algorithm constant and the dictionary's entries may come from the file's own #defines (#define kAlg kSecKeyAlgorithmECIES…, @{ kCommonAttrs (id)kSecAttrKeySizeInBits: @256 }); a dictionary holding a macro that is not read, or a bare name the file does not define where an entry belongs, names no key. A Keychain item whose kSecAttrKeyClass is private or public is listed as that key (EC-secp256r1 Private Key (Keychain)) |
| Dart | crypto, PointyCastle, aws_client, googleapis | sha256/sha512/sha1/md5/Hmac; PointyCastle engines/digests, PBKDF2/scrypt derivators; AWS KMS spec constants; Google Cloud KMS CryptoKeyVersionTemplate(algorithm: …) (in Cloud HSM when the same template sets protectionLevel: 'HSM') and the AsymmetricSignRequest digest |
| Elixir | :crypto, Comeonin | :crypto hash/mac/crypto_one_time/generate_key; Bcrypt/Argon2/Pbkdf2 |
| Erlang | crypto | crypto:hash/mac/crypto_one_time/generate_key |
| Erlang | erlang-libsodium | a call into a libsodium_crypto_<primitive> module names that primitive: stream_xchacha20 (XChaCha20), stream_chacha20 (ChaCha20), aead_xchacha20poly1305 and aead_chacha20poly1305, onetimeauth_poly1305 (Poly1305), sign_ed25519 (Ed25519) and scalarmult_curve25519 (X25519). sign_ed25519ph and the crypto_box keypair name nothing |
| Go, Python, JavaScript / TypeScript, Java, Kotlin, Scala, C#, Ruby, PHP, Rust, C++, Swift, Elixir, Erlang, Terraform | Key-management services | Crypto that AWS KMS, Google Cloud KMS, Azure Key Vault or HashiCorp Vault Transit performs: the algorithm, key spec or key type stated at the SDK call or in the key's Terraform resource (aws_kms_key, google_kms_crypto_key, azurerm_key_vault_key, vault_transit_secret_backend_key), including each service's default when none is stated. Vault Transit operations through the client SDKs are read too: the sign/verify hash_algorithm and signature_algorithm, the hmac algorithm (in the body, or as the path's last segment, transit/sign/<key>/sha2-512), the digest the hash endpoint computes when the path names it (transit/hash/sha2-512; its body algorithm, and a hash request with no literal segment, name nothing), and the type of a key an encrypt creates (Go Logical().Write("transit/sign/…"), hvac, node-vault, vault-ruby, a PHP Vault\Client, vaultrs request builders, VaultSharp SignRequestOptions/HmacRequestOptions, Spring Vault VaultTransitKeyCreationRequest/VaultSignRequest/VaultHmacRequest in Java, Kotlin and Scala, and vault-java-driver in Java, Kotlin and Scala). Google Cloud KMS and Azure Key Vault are read in Kotlin and Scala through the Java SDKs, and in C++ through google-cloud-cpp (CryptoKeyVersion::<ALGORITHM>) and the Azure Key Vault C++ client (SignatureAlgorithm::…, EncryptParameters::RsaOaep256Parameters(…)); an azurerm_key_vault_managed_hardware_security_module_key is an Azure Managed HSM key. These assets carry xgrep:cbom:kms-provider and xgrep:cbom:remote, and CycloneDX executionEnvironment (see below) |
| Go, Python, JavaScript / TypeScript, Java, C#, Ruby, Rust, PHP | Key-management services over raw HTTP | A request to the service's REST API through net/http, requests/httpx, fetch/axios, java.net.http/OkHttp/RestTemplate, HttpClient, Faraday and other post/put clients, reqwest or Guzzle, recognised by its URL: Vault Transit /v1/transit/<op>/<key> (hash_algorithm, signature_algorithm, the hmac algorithm, the key type; a sign, verify or hmac hash may also be the path's last segment, and /v1/transit/hash/<algorithm> names the digest Vault computes), Azure Key Vault <vault>.vault.azure.net/keys/…/<op> (alg; on a <hsm>.managedhsm.azure.net host the provider is azure-managed-hsm), Google Cloud KMS cloudkms.googleapis.com/v1/…:<op> (the asymmetricSign digest), and AWS KMS's kms.<region>.amazonaws.com endpoint (EncryptionAlgorithm, SigningAlgorithm, MacAlgorithm, KeySpec). The algorithm is read only from a body written on the call's own lines; a body built elsewhere names nothing. These assets carry xgrep:cbom:kms-provider and xgrep:cbom:remote |
| Java, Python, JavaScript / TypeScript, Go | Envelope encryption over a KMS | AWS Encryption SDK algorithm suites (Java CryptoAlgorithm, Python Algorithm/AlgorithmSuite, JS AlgorithmSuiteIdentifier), each reported as its AES-GCM cipher, HKDF and ECDSA signature; Tink KmsEnvelopeAead and its KMS envelope key templates (Java, Go, Python), reported as the data-key AEAD. The data is encrypted locally, so a Tink asset is not remote; with a literal aws-kms://, gcp-kms:// or hcvault:// key URI it carries xgrep:cbom:kms-provider and xgrep:cbom:kms-envelope |
| Go, Python, JavaScript / TypeScript, Java, C#, Dart | Key-management service keys | The key a call names, when it names it by a literal: an AWS KMS key ARN, alias ARN, alias/<name> or key id (AWS SDK requests for Go and JavaScript, boto3 KeyId=, Java keyId(…)); a Google Cloud KMS projects/…/cryptoKeys/… path (the request's name, or a key ring and id joined at CreateCryptoKey; in Dart's googleapis cloudkms/v1, the key path an asymmetricSign, asymmetricDecrypt, macSign, macVerify, rawEncrypt, rawDecrypt, encrypt or decrypt call is given, or the key ring and cryptoKeyId of cryptoKeys.create); a Vault Transit key name (the transit/<operation>/<name> path in Go and node-vault, hvac's name=); an Azure Key Vault or Managed HSM key URL (CryptographyClient in Python and JavaScript, new CryptographyClient(new Uri("…"), …) in C#, CryptographyClientBuilder.keyIdentifier in Java, and in Go the vault URL of an azkeys.NewClient joined with the key name an operation such as Sign, WrapKey or CreateKey passes; the client must be a variable of the call's own function written once, so a client passed in as a parameter or held in a package-level variable names no vault). The key type a Go azkeys.CreateKeyParameters request states is the key's algorithm: an RSA key of its literal KeySize (RSA-3072), an EC key on its Curve; a key type or size in a variable states none. Each is a CycloneDX key asset whose id is the key id and whose securedBy mechanism is the service; one key used at several calls is one asset. It is named like other key material, <family> <kind> (<service>) <key id>: Secret Key (AWS KMS) alias/app, RSA-2048 Private Key (AWS KMS) alias/signing. The kind and family come from the one algorithm the key is used with (a symmetric algorithm is a secret key, an asymmetric one a private key, since the service holds the private half); a key used with several algorithms keeps the kind they agree on and no family, and a key whose calls name no algorithm is a Key, unless the operation only accepts one kind: an AWS Encrypt or Decrypt that states no algorithm, GenerateDataKey, GenerateDataKeyPair, GenerateMac and VerifyMac, and a Google Cloud KMS Encrypt, Decrypt, MacSign or MacVerify take only a secret key; an AWS Sign or Verify and a Cloud KMS AsymmetricSign or AsymmetricDecrypt only a private key. When the same call states the algorithm, the key's algorithmRef names it and the key depends on it; a call that states none gives the key alone, and a key used with two algorithms depends on both and references neither. A key id in an upper-case constant the same file binds to a literal (KeyId: SIGNING_KEY) is read as if written at the call, and so is one in a lower-case name that provably holds one literal at the call: a Go const or a Go local written once, a Python local the literal reaches, a JavaScript or TypeScript const the file binds nowhere else (no parameter of that name anywhere in the file). Two calls that read one constant name one key. An Azure CryptographyClient is linked to the algorithm its later encrypt/sign/wrapKey/… calls name, but only calls that provably read that client: through a local of the same function (or block) that is declared and written once there, with no parameter or second declaration of the name in it; through a module-level variable written once (Python, JavaScript); or through a field written once in the file and declared private, readonly or final (a Python self._name, a JavaScript #name), used in its own class (this./self., or the bare name in Java and C# from a method that binds no variable of that name). A call through a parameter, a public field, a same-named variable of another function, or a name written twice, is reported unlinked. In Dart, a CryptoKey or sign request held in a local is linked when that local's one declaration is in scope at the call (final signer = CryptoKey(… CryptoKeyVersionTemplate(algorithm: 'EC_SIGN_P256_SHA256')) then cryptoKeys.create(signer, …) gives EC-secp256r1 Private Key (Google Cloud KMS) projects/…/cryptoKeys/signer); a declaration in a block that has closed, after the call, or under a name a parameter rebinds links nothing, and a key path parameter is never read as another function's local of the same name. The hash a sign request's digest was made with is a dependency of the key, never its algorithmRef, and an EC key is named by the curve its own template states. A Terraform key resource (aws_kms_key, google_kms_crypto_key, azurerm_key_vault_key, a Managed HSM key, vault_transit_secret_backend_key) is a key too, beside the algorithm of its spec: one asset per resource block, named by its kind and service (AES-256 Secret Key (AWS KMS)), whose algorithmRef is the spec's algorithm, whose property xgrep:cbom:kms-resource is the resource's address (aws_kms_key.encryption) and whose property xgrep:cbom:kms-declared-at names the resource. A spec the resource does not write (the provider's default, such as SYMMETRIC_DEFAULT) or takes from a variable's default carries xgrep:cbom:valueSource = default; the other specs a variable's validation allows stay algorithms the key depends on. When a call names a key by a literal and exactly one resource in the scanned tree declares that key, the two are one asset: the resource's key, with the call's occurrences added and the literal as its id; its algorithm is the one the resource declares even where the call names a signature or encryption scheme, which stays a dependency. The key is matched by the name its module gives it: an aws_kms_alias whose target_key_id points at the aws_kms_key (a generated key ARN or id matches nothing), a google_kms_key_ring and google_kms_crypto_key name (with the ring's location and project when they are literals), an azurerm_key_vault or Managed HSM name and its key's name, a vault_transit_secret_backend_key name. The aliases and rings may be in any .tf file of the module directory. A name built from a variable, a for_each or count resource, and a name two modules declare, link nothing. A key id the call does not spell as a literal is still a key: the call proves one exists. It is reported as a key of that service whose id is supplied at run time, in a file that imports the service's SDK, named by its kind and service (Secret Key (AWS KMS)) and identified by where the id comes from, which the property xgrep:cbom:kms-key-source and each occurrence record: a field of the method's receiver or of a typed parameter (MasterKey.Arn; in Python, JavaScript and Java self./this. fields are named after their class), a parameter (Encrypt(keyID)), an environment variable (env SOPS_KMS_ARN), a key of a loaded Python configuration mapping (config kms.key_id), or otherwise the expression as written with its file (keyArn in kms/client.go). Two sources are two keys, even where they share a name. A Python class that subclasses a cryptography private-key interface (rsa.RSAPrivateKey, ec.EllipticCurvePrivateKey, dsa.DSAPrivateKey, ed25519.Ed25519PrivateKey, ed448.Ed448PrivateKey, imported from cryptography.hazmat.primitives.asymmetric) names the family of the key held in its own self. field when no algorithm linked to the key does: RSA Private Key (AWS KMS), from AWSKMSRSAPrivateKey.keyid. Every use of one source is one asset with no CycloneDX id. Such a key is never linked to a Terraform declaration, and two sources are never merged. A literal that is not a key id of the service, a null value, a request with no key id, and a request object passed where a key id goes name nothing, nor do WebCrypto's crypto.subtle calls and a JavaScript CryptographyClient built from a JSON Web Key alone, which runs locally. Huawei Cloud KMS keys are read from the huaweicloud-sdk-go-v3 KMS request bodies in Go (KeyId; a request that states SYMMETRIC_DEFAULT uses a secret key), and a Vault Transit key from a Go path.Join(mount, "encrypt", name) in a file that writes through the Vault API's Logical() client, reported where the path is built |
| Terraform (HCL) | hashicorp tls provider | tls_private_key as a PEM private key of its algorithm: RSA sized by rsa_bits (default 2048), ECDSA on ecdsa_curve (default P-224) or Ed25519, each read from a literal or the module variable's default. tls_self_signed_cert and tls_locally_signed_cert are X.509 certificates, and tls_cert_request is a CSR |
| Terraform (HCL) | TLS settings of cloud resources | A named TLS security policy is the protocol versions and cipher suites that the provider's published definition of the policy fixes, read from a table of those definitions built into xgrep: an Elastic Load Balancing listener's ssl_policy (on an aws_lb_listener or aws_alb_listener, or in a module input, variable or .tfvars value, where the policy's name decides) and a CloudFront viewer certificate's minimum_protocol_version. An HTTPS or TLS listener, or a distribution, that names no policy gets the provider's documented default (ELBSecurityPolicy-2016-08, CloudFront TLSv1). A policy name the table does not hold, or a value the module does not fix, names only TLS. A minimum TLS version (min_tls_version of Azure Storage and of a Google Cloud SSL policy, minimum_tls_version of Azure SQL, Redis and App Service) names that version only, since what the service accepts above it is not stated. Key-management keys declared in Terraform are in the key-management rows above |
| JavaScript / TypeScript, Go, Python, Java, C# | WebAuthn (COSE) | The signature algorithms a relying party accepts: pubKeyCredParams alg ids in navigator.credentials.create, SimpleWebAuthn supportedAlgorithmIDs, go-webauthn webauthncose.Alg*, py_webauthn and webauthn4j/Yubico COSEAlgorithmIdentifier, and Fido2NetLib PubKeyCredParam (new PubKeyCredParam(COSE.Algorithm.ES256), PubKeyCredParam.Ed25519). A comparison against a COSE.Algorithm is not reported |
| Python | py_webauthn helpers | parse_attestation_object, parse_client_data_json and parse_authenticator_data from webauthn.helpers as a WebAuthn protocol; decode_credential_public_key as a COSE protocol (a COSE_Key) and the credential Public Key it returns; the Android SafetyNet verifier (verify_android_safetynet) as a JWS. A helper of the same name from another package is not reported. pyca MLDSA44PublicKey/MLDSA65PublicKey/MLDSA87PublicKey.from_public_bytes name an ML-DSA public key |
| Go, Python | DNSSEC | The algorithm a zone key is generated or signed with: miekg/dns dns.ECDSAP256SHA256 and its siblings, dnspython Algorithm.* |
| C / C++ | OpenSSL | EVP cipher/digest selectors (EVP_aes_256_gcm, EVP_sha256, …) and by-name fetch (EVP_CIPHER_fetch/EVP_MD_fetch/EVP_get_*byname), legacy SHA256/MD5/*_Init, EVP_PKEY key types (RSA/EC/DH/DSA/Ed25519/Ed448/X25519/HKDF/scrypt), RSA_generate_key_ex, OAEP and PSS padding (RSA_PKCS1_PSS_PADDING, set or assigned, and the PSS salt-length setter report RSA-PSS), ECDSA_*/ECDH_compute_key, PKCS5_PBKDF2_HMAC, EVP_PBE_scrypt, HMAC, CMAC_Init, RAND_bytes, SSL_CTX_new, PEM_read_*X509/d2i_X509; TLS configuration — SSL_CTX_set_cipher_list/set_ciphersuites (each enabled suite with its IANA name, code point and algorithms), set_min_proto_version, and the version-specific TLSv1_2_method()-style selectors (also wolfSSL's wolfTLSv1_* methods, wolfSSL_CTX_set_cipher_list/SetMinVersion, and mbedTLS mbedtls_ssl_conf_min_tls_version/min_version) |
| C / C++ | Windows CNG, CryptoAPI, Schannel | BCryptOpenAlgorithmProvider algorithm IDs (hashes, AES, 3DES, RC4/RC2, RSA, DSA, DH, ECDSA/ECDH P-256/384/521, PBKDF2, HKDF, RNG, HMAC flag), CNG pseudo-handles (BCRYPT_SHA256_ALG_HANDLE, BCRYPT_AES_GCM_ALG_HANDLE, …), BCRYPT_PAD_OAEP, BCryptDeriveKeyPBKDF2, BCryptGenRandom; CryptoAPI CALG_* IDs at CryptCreateHash/CryptGenKey/CryptDeriveKey, CryptGenRandom, CertCreateCertificateContext/PFXImportCertStore; Schannel AcquireCredentialsHandle with UNISP_NAME (direct or through the SSPI function table) |
| C / C++ | mbedTLS | mbedtls_sha*/md5/ripemd160 (incl. the SHA-224/384 flag), mbedtls_md_info_from_type/_string, mbedtls_aes_setkey_*/gcm_setkey/ccm_setkey with key size, mbedtls_cipher_info_from_type/_string, ChaCha20-Poly1305, DES/3DES, RSA keygen with size, RSA-OAEP, ECP/ECDSA/ECDH with curve, DHM, PBKDF2, HKDF, HMAC, CMAC, CTR/HMAC-DRBG, mbedtls_ssl_config_defaults, mbedtls_x509_crt_parse* |
| C / C++ | BoringSSL | EVP_aead_* AEAD selectors passed to EVP_AEAD_CTX_new/_init: AES-128/192/256-GCM (incl. the _tls12/_tls13/_randnonce variants), AES-128/256-GCM-SIV, AES-CTR-HMAC-SHA256, AES-128-CCM, ChaCha20-/XChaCha20-Poly1305 (the shared EVP API is covered by the OpenSSL row) |
| C / C++ | BoringSSL key types, Ed25519/X25519 and HPKE | EVP_pkey_ec_p256/p384/p521, EVP_pkey_ed25519, EVP_pkey_x25519; ED25519_keypair/_sign/_verify, X25519_keypair/X25519; the HPKE (RFC 9180) suite selectors EVP_hpke_x25519_hkdf_sha256 / EVP_hpke_p256_hkdf_sha256 (reported as the DHKEM, with its Diffie-Hellman group and HKDF as sub-algorithms), EVP_hpke_hkdf_sha256, and EVP_hpke_aes_128_gcm / aes_256_gcm / chacha20_poly1305 |
| C / C++ | OpenSSL modes and stream cipher | EVP_aes_{128,192,256}_cfb[1/8/128] (AES-CFB), EVP_aes_*_ofb (AES-OFB), EVP_chacha20() (raw ChaCha20) |
| C / C++ | Algorithms a project implements itself | openssh's sntrup761 (crypto_kem_sntrup761_*), ML-DSA-44/65/87 (crypto_sign_mldsa*_*, including the mldsa44_ed25519 composite), UMAC-64/128 (umac_new/umac128_new), Poly1305 (poly1305_auth), its ChaCha20-Poly1305 construction (chachapoly_new) and HMAC (ssh_hmac_start); curl's HMAC-MD5/SHA-256 (Curl_hmacit/Curl_HMAC_init) |
| C / C++ | Linux kernel crypto API (AF_ALG) | the algorithm a program requests through an AF_ALG socket, from struct sockaddr_alg's salg_name — in a designated initializer or copied in with strcpy/strncpy/strlcpy/memcpy — in the kernel's own syntax (cbc(aes) → AES-CBC, hmac(sha256) → HMAC-SHA-256, rfc4106(gcm(aes)) → AES-GCM). A name chosen at run time or one the kernel does not define is not reported |
| C / C++, Go, Python | PKCS#11 (tokens and HSMs) | the algorithm a PKCS#11 mechanism performs: a C CK_MECHANISM (its first initializer, its .mechanism designator, or an assignment to the field), miekg/pkcs11 NewMechanism, PyKCS11.Mechanism, and python-pkcs11's mechanism= keyword (CKM_AES_GCM → AES-GCM, CKM_SHA256_RSA_PKCS → SHA-256withRSA, CKM_ML_DSA → ML-DSA). A PyKCS11.Mechanism of a module constant is read when the module binds the name once (a module-level try or if included) to a PyKCS11.CKM_* constant. PyKCS11's CKM_RSA_PKCS is named by what it is used for in its function: RSAES-PKCS1-v1_5 when every operation it is handed to encrypts or decrypts, RSASSA-PKCS1-v1_5 when every one signs or verifies, RSA otherwise. A mechanism in a switch, a comparison or a mechanism query, one chosen at run time, and a vendor mechanism are not reported |
| C / C++ | libkcapi | the kernel algorithm a libkcapi handle opens (kcapi_cipher_init, kcapi_aead_init, kcapi_md_init, with the name in kernel syntax), the fixed algorithm of a one-shot helper (kcapi_md_sha256 → SHA-256, kcapi_md_sha3_256 → SHA3-256, kcapi_md_hmac_sm3 → HMAC-SM3, kcapi_cipher_enc_aes_cbc → AES-CBC), and the KDFs (kcapi_pbkdf → PBKDF2, kcapi_hkdf → HKDF, plus their PRF when it is a literal kernel name such as "hmac(sha256)"; the SP 800-108 KDFs kcapi_kdf_ctr/_fb/_dpi → SP800_108_CounterKDF/FeedbackKDF/DoublePipelineKDF, named with their PRF, such as SP800_108_CounterKDF-HMAC-SHA256, when the same function opens the handle with a literal kernel name) |
| C / C++ | Algorithms named by a library constant used as a value | PSA algorithm and key-type constants (PSA_ALG_SHA_256, PSA_ALG_ECDH, PSA_KEY_TYPE_ARIA, …) and the PSA algorithm macros that take a hash (PSA_ALG_HMAC(…), PSA_ALG_RSA_PSS(…), PSA_ALG_JPAKE(…), …), OpenSSL selectors aliased by a #define (#define CIPHER EVP_aes_256_gcm), and CNG algorithm IDs, each assigned, passed, returned or aliased. Curve constants (NID_secp384r1, MBEDTLS_ECP_DP_SECP256R1, brainpool) are reported when assigned or returned. A mode on its own (PSA_ALG_GCM), a case label, a comparison and a curve-name table are not uses. Selectors listed in initializer-list tables (openssh cipher.c) are not yet reported. Also: EVP_aes_{128,192,256}_wrap() (AES key wrap) |
| C / C++ | wolfCrypt (wolfSSL) | wc_Init*/wc_*Hash digests (MD5, SHA-1/224/256/384/512, SHA3-256/512, BLAKE2b), wc_AesSetKey (key length in bytes → AES-128/192/256)/wc_AesGcmSetKey/wc_AesCcmSetKey/wc_AesCbcEncrypt, ChaCha20-Poly1305, DES/3DES/ARC4, wc_MakeRsaKey with size, wc_ecc_make_key_ex with curve (ECC_SECP256R1, …), ECDSA/ECDH, Ed25519/Ed448/Curve25519, DH, DSA, wc_PBKDF2, wc_HKDF, wc_HmacSetKey, wc_InitRng/wc_RNG_GenerateBlock |
| C++ | Crypto++ | declarations of algorithm classes (members, locals, with or without constructor arguments, CryptoPP::-qualified or not): SHA1/SHA256/SHA512/SHA3_*/Weak::MD5, GCM/CBC_Mode/CTR_Mode/ECB_Mode/CCM<AES>, ChaCha20Poly1305, DES/3DES/Blowfish/Weak::ARC4, RSA::PrivateKey, RSAES_OAEP_*, RSASS<…, H> and ECDSA<ECP, H> (with their hash; RSASS<PSS, H> is RSA-PSS, any other RSASS the PKCS#1 v1.5 <H>withRSA), ECDH, DSA, ed25519, x25519, PKCS5_PBKDF2_HMAC, HKDF, Scrypt, HMAC, CMAC, AutoSeededRandomPool |
| C / C++ | libsodium, libargon2 | crypto_aead_* (ChaCha20-Poly1305/XChaCha20/AES-256-GCM), crypto_secretbox, crypto_secretstream, crypto_sign (Ed25519), crypto_box/crypto_kx/crypto_scalarmult (X25519), crypto_generichash (BLAKE2b), crypto_hash_sha256/512, crypto_auth_hmacsha*, crypto_pwhash (Argon2/scrypt), randombytes_*; argon2*_hash_* |
| C / C++ | libsodium (newer primitives) | crypto_aead_aegis128l_*/aegis256_* (AEGIS), crypto_aead_xchacha20poly1305_ietf_* and crypto_secretstream_xchacha20poly1305_* (XChaCha20-Poly1305), the raw crypto_stream_chacha20*/xchacha20*/crypto_stream (XSalsa20) stream ciphers, crypto_kdf_hkdf_sha256_*/sha512_*, crypto_kem_mlkem768_* (ML-KEM-768), crypto_kem_*/crypto_kem_xwing_* (X-Wing hybrid KEM), crypto_onetimeauth* (Poly1305), crypto_scalarmult_curve25519[_base] (X25519), crypto_scalarmult_ristretto255*/crypto_core_ristretto255_*, crypto_hash_sha3256/sha3512, crypto_xof_shake128/256, crypto_xof_turboshake128/256, crypto_shorthash* (SipHash) and crypto_ipcrypt_* |
| C / C++ | TLS certificates and trust anchors (OpenSSL, BoringSSL, wolfSSL, mbedTLS) | the certificate or chain a TLS endpoint presents (SSL_CTX_use_certificate[_file/_chain_file/_ASN1], SSL_CTX_use_cert_and_key, SSL_CTX_set_chain_and_key, wolfSSL_CTX_use_certificate_*, mbedtls_ssl_conf_own_cert) as X.509 Certificate; the CA certificates it trusts (SSL_CTX_load_verify_*, X509_STORE_load_*, X509_STORE_add_cert, wolfSSL_CTX_load_verify_*, mbedtls_ssl_conf_ca_chain) as X.509 CA Certificates; and the operating system store (SSL_CTX_set_default_verify_paths, X509_STORE_set_default_paths, wolfSSL_CTX_load_system_CA_certs) as X.509 CA Certificates (system store) |
| C / C++ | Key material (OpenSSL, wolfSSL, mbedTLS, Windows NCrypt/CNG) | private and public keys read or loaded (PEM_read_*PrivateKey/PUBKEY, d2i_*, SSL_CTX_use_PrivateKey[_file], wolfSSL_CTX_use_PrivateKey_file/_buffer, wc_*KeyDecode, mbedtls_pk_parse_key[file]/_public_key[file]), and Windows keys created, opened or imported (NCryptCreatePersistedKey, NCryptOpenKey, NCryptImportKey, BCryptImportKeyPair, BCryptImportKey). An ECC key BCryptImportKeyPair imports is an EC Private Key or EC Public Key; the algorithm handle it is imported under names the operation, reported as an ECDSA (hAlgECDSA) or ECDH algorithm at the import. A handle a helper's parameter picks (keytype == ECDSA ? hAlgECDSA : hAlgECDH) names both, unless the helper is static and every call of it passes the constant the condition compares with: then only the operation those calls select |
| Go | Key material (standard library) | keys a generator makes (rsa.GenerateKey with its size, ecdsa.GenerateKey on its curve, ed25519.GenerateKey/NewKeyFromSeed, ecdh.P256()/X25519() GenerateKey/NewPrivateKey) and keys a parser reads (x509.ParsePKCS1PrivateKey, ParseECPrivateKey, ParsePKCS8PrivateKey, ParsePKIXPublicKey, ParsePKCS1PublicKey as (DER); ssh.ParseAuthorizedKey/ParseKnownHosts as (OpenSSH)), and ecdh public keys decoded with NewPublicKey. A curve held in a local (curve := ecdh.X25519(), then curve.NewPublicKey(b)) names the key when that is the local's only assignment in the function. The public half of a pair the same function generates (&k.PublicKey after rsa/ecdsa/dsa.GenerateKey, kept in a variable or passed to a call) is a public key of the same algorithm, size and curve, and so is the public key ed25519.GenerateKey returns when it is kept. dsa.GenerateKey makes a DSA private key, sized by the dsa.GenerateParameters call whose parameters it is given; mlkem.GenerateKey768/1024 and NewDecapsulationKey768/1024 make an ML-KEM private key; the output of pbkdf2.Key is a Secret Key. A key or seed whose bytes are fixed in the source is (hardcoded) (Secret Key (hardcoded), Ed25519 Private Key (hardcoded)): a []byte("…") literal, or a buffer made by make([]byte, N) or var k [N]byte that nothing in the function names between its definition and the key call, so it is all zeros. A buffer filled from a reader, written through an index or passed to any function first is not. An SSH public key is named by the key types the code accepts: a switch on its Type() ("ssh-rsa", ssh.KeyAlgoED25519) or on its crypto.PublicKey whose default refuses the key (a case that refuses its own type does not count), an assertion to *rsa.PublicKey that returns when it fails, or age's agessh.NewEncryptedSSHIdentity it is passed to. With none of these it is a Public Key (OpenSSH) of no stated type. age's agessh.ParseRecipient, ParseIdentity and NewEncryptedSSHIdentity accept only RSA and Ed25519 keys, and are listed as both |
| JavaScript / TypeScript | WebCrypto key material | the key importKey reads and generateKey makes: pkcs8 a private key, spki a public key, a JWK by the usages asked for (sign/deriveBits/deriveKey private, verify or none public), a raw key with a secret's usages a secret key, and generateKey of AES/HMAC (secret) or an asymmetric algorithm (key pair). A JWK HMAC key and a raw key that only verifies are not stated. An HMAC algorithm object whose imported key is only ever the key wrapKey wraps (arbitrary bytes carried into AES-KW, as OpenPGP.js does) is not an HMAC use and names no HMAC asset; a key that also signs, verifies or goes anywhere else keeps it |
| Lua, Perl | Key material (lua-resty-openssl, CryptX) | the secret key an HMAC is created with (hmac.new(key, "sha256"), CryptX hmac('SHA256', $key, …)), and the private key a CryptX Crypt::PK object signs or agrees with (sign_message, sign_message_rfc7518, shared_secret) and the public key it verifies with |
| Python | Hard-coded keys | a bytes literal that reaches the key parameter of a pyca key wrap (aes_key_wrap and its siblings), cipher (algorithms.AES(key), …) or HMAC, or the stdlib hmac.new, in the call's own function: written as the argument, or held by a local whose only value at the call is the literal. Reported as Secret Key (hardcoded). A key from a parameter, another function, a module-level name, random bytes, a literal reassigned before the call, or one written on only one branch is not |
| C / C++ | Hard-coded keys | key bytes written into the source (a one-dimensional literal array or string) that reach a cipher or MAC key parameter by dataflow: EVP_*Init*, AES_set_*_key, HMAC, CMAC_Init, wc_AesSetKey/wc_HmacSetKey, mbedtls_*_setkey, libsodium crypto_* keys, BCryptGenerateSymmetricKey, and more. Reported as secret-key material named after the algorithm used at the same call (AES-256 Secret Key (hardcoded)), or as a plain Secret Key (hardcoded) when the cipher is chosen at run time. A two-dimensional table with one literal key per row (aes_test_key[3][16]) is a set of self-test vectors and is not reported. Like every CBOM asset, keys in test files are listed too; the evidence path tells a test vector from a production key |
Detected assets span symmetric and asymmetric ciphers, hashes, MACs, signatures,
key-agreement schemes, KDFs, TLS, and X.509 certificates — all four CycloneDX
asset types (algorithm, protocol, related-crypto-material, certificate).
Because a CBOM's value depends on completeness, treat the absence of an asset
as "not yet detected," not "no crypto": Limits lists what is
known not to be detected.
Key and certificate files
Certificate and key files (.pem, .crt, .key, .p12, .jks,
authorized_keys, JWK sets, …) are inventoried from the files themselves:
certificate, signature algorithm, key algorithm, size and curve. Key bytes
never appear in the output. Also read:
- Certificate revocation lists (
X509 CRLPEM, or a DER.crl), listed asX.509 CRLwith the algorithm the issuer signed them with. - OpenPGP keys, armoured (
PGP PUBLIC KEY BLOCK,PGP PRIVATE KEY BLOCK, often.asc) or a binary key ring (.gpg,.pgp): each key and subkey by algorithm and size or curve, such asRSA-4096 Public Key (OpenPGP). Only a key's public part is read, so a passphrase-protected secret key is listed by its algorithm without being decrypted. - How a private key is protected, as the file states it: the cipher a
legacy PEM
DEK-Infoheader names (AES-128-CBC,3DES-168-CBC), the PBKDF2 PRF or scrypt and the encryption scheme of anENCRYPTED PRIVATE KEY(PKCS#8 PBES2), and the cipher and KDF of an OpenSSH key (aes256-ctrwithbcrypt-pbkdf). The key itself staysPrivate Key (encrypted), with its algorithm when the armour names it. - Key formats are part of a key's name:
(PEM),(DER)and(OpenSSH), soEd25519 Private Key (OpenSSH)andEd25519 Private Key (PEM)are two assets. DER files are read for keys (PKCS#8, PKIX, PKCS#1, SEC 1) and CSRs as well as certificates. - Other armour: cosign's
ENCRYPTED COSIGN PRIVATE KEY, listed asPrivate Key (encrypted) (cosign)with the scrypt and XSalsa20-Poly1305 its envelope names (the envelope'snacl/secretboxis listed as the one construction, without separate XSalsa20 and Poly1305 assets); Nebula'sNEBULA X25519 PRIVATE KEYand its Ed25519 and P-256 keys;EC PARAMETERS(the named curve) andDH PARAMETERS(the group, by prime size, such asDH-2048). - DSA keys and explicit EC curves. An unencrypted OpenSSL
DSA PRIVATE KEYand a DSAPUBLIC KEYare listed by their prime's size (DSA-4096 Private Key (PEM)), and so is an unencrypted OpenSSH-formatssh-dssprivate key (DSA-1024 Private Key (OpenSSH)). An EC public key, or a certificate's subject key, whose file spells the curve's parameters out instead of naming the curve is named after the curve those parameters are exactly, such asEC-secp256r1 Public Key (PEM); parameters that are no named curve give anEC Public Keywith no curve, and a file whose key does not check out is not listed. - Files with no extension (
id_rsa,ca-bundle), when their content holds PEM armour of a type listed here or an OpenPGP key block. - PEM written into source code: a certificate or key whose PEM armour
sits in a string literal of a Go, Python, JavaScript, TypeScript, Java,
Kotlin, Scala, Groovy, Ruby, PHP, C#, Rust, Swift, Dart, Elixir, Erlang, C
or C++ file, at the line the armour starts. A key found this way is named
(hardcoded)(see Understanding an asset). A block that does not decode, such as a truncated example or a template with a placeholder, is not listed. - Key store contents. A PKCS#12 file (
.p12,.pfx) is listed as aKeystore (PKCS12), the name code that opens a PKCS12 key store gives it, and a Java key store asKeystore (JKS)(.jks) orKeystore (JCEKS)(.jceks). When the store has no password, or uses the empty password orchangeit(the JDK's documented default), the certificates and keys it holds are listed too. A Java key store's private key is named by its certificate's algorithm; its bytes are never decrypted. A store protected by any other password stays a store asset only: no other password is tried. A PKCS#12 store holding only certificates, asopenssl pkcs12 -export -nokeyswrites it, is read under the same rule, whether its certificates are encrypted with AES (OpenSSL 3), 3DES or RC2 (OpenSSL 1.x and-legacy), or not at all; a store whose integrity MAC does not verify is not read. - BouncyCastle FIPS key stores (
.bcfks, or a BCFKS store given a.p12,.pfx,.jksor.jceksname, recognised by its structure) are listed asKeystore (BCFKS). Everything such a store holds is encrypted under its password, so its entries are never listed. What the file states in the clear is: how the store is encrypted (the key derivation, such as PBKDF2 with HMAC-SHA512 or scrypt, and the cipher, such as AES-256-CCM) and how its integrity is checked (the HMAC and its key derivation, or a signature algorithm), listed as written in the file rather than assumed from BouncyCastle's defaults.
A certificate that states it is a CA's, with cA:TRUE in its basic
constraints and keyCertSign in its key usage, is listed as X.509 CA Certificates, the name the trust-store rules give the CA certificates a
program trusts; any other certificate is X.509 Certificate, whatever its
file is called. A self-signed certificate with cA:TRUE and no key usage,
which openssl req -x509 writes by default, is not a CA certificate; one
another CA issued with cA:TRUE and no key usage (OpenSSL's v3_ca
extensions) is, since an absent key usage restricts nothing. A signature Go
refuses to verify (MD5, a DSA key, an RSA key under 1024 bits) does not make a
certificate issued: with its subject as its issuer it reads as self-signed
unless its key identifiers name another key. In code, a pyca/cryptography
x509.BasicConstraints(ca=True, …) names a CA certificate the program
builds, and a certificate added to a pyOpenSSL X509Store (add_cert) or a
PowerShell script's CA or Root Windows X509Store is a CA certificate
too.
A certificate references its subject public key: the key is listed as an asset
of its own (RSA-2048 Public Key), and the certificate's
certificateProperties.subjectPublicKeyRef points to it.
Key and certificate files, server configuration files and scripts are found
among the same files the source scan reads. In a git repository that is the
tracked files, so a .gitignored or uncommitted key is not read, and
--exclude-dir leaves a directory out of both. Dependency, build-output
(dist/, build/, target/) and hidden directories are not read, except CI
configuration (.github/, .gitlab/, .circleci/). Files under test, fixture
and example directories are read and marked with their scope like any other
asset. A test CA appears as test in the default document, and
--cbom-scope production leaves it out.
Configuration files
Server configuration files are inventoried too, by the directives that set crypto:
-
TLS versions and cipher suites:
- nginx:
ssl_protocols,ssl_ciphers; - Apache httpd:
SSLProtocol,SSLCipherSuite; - HAProxy:
ssl-min-ver,ciphers,ssl-default-bind-*; openssl.cnf:MinProtocol,CipherString,Ciphersuites;- PostgreSQL, MySQL and Redis TLS settings (Redis
tls-protocols,tls-ciphers,tls-ciphersuites); - Envoy:
common_tls_context.tls_paramstls_minimum_protocol_version,tls_maximum_protocol_version,cipher_suitesandecdh_curves, in any YAML file that has acommon_tls_context, and in Envoy configuration embedded in a KubernetesConfigMapas a block-scalar (|) data value; - Traefik:
tls.options.<name>minVersion,maxVersion,cipherSuitesandcurvePreferences, in YAML or TOML, and aTLSOptionresource'sspec; - Caddy: the
protocols,ciphersandcurvessubdirectives of a Caddyfiletlsblock, and a reverse proxy'stransport httptlsandtls_curves; in Caddy's JSON configuration (a.jsonfile named for Caddy), a server'stls_connection_policies(protocol_min,protocol_max,cipher_suites,curves) and areverse_proxytransport'stlsobject and itscurves; - key-exchange groups: nginx and PostgreSQL
ssl_ecdh_curve,openssl.cnfGroups/Curvesin its SSL section, ApacheSSLOpenSSLConfCmd Curves(hybridX25519MLKEM768included). An excluded group (!secp256r1) is not listed; - database password hashing: PostgreSQL
password_encryption(scram-sha-256is PBKDF2 with HMAC-SHA-256,md5is MD5), and MySQL'sdefault_authentication_plugin/authentication_policy(caching_sha2_passwordis SHA-256 crypt,mysql_native_passwordis SHA-1).
Each server's own spellings are read: OpenSSL names (
ECDHE-RSA-AES128-GCM-SHA256,TLSv1_2) for Envoy and Redis, Go names (TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,VersionTLS12,CurveP521,tls1.2) for Traefik and Caddy. Key-exchange groups are listed as algorithms (X25519,EC-secp384r1). A key outside the block its documentation names, such as acipher_suiteskey that is not undertls_params, is ignored. - nginx:
-
Digest and key size:
openssl.cnfdefault_md, anddefault_bitsin[req]. -
SSH algorithms:
sshd_configandssh_configCiphers,KexAlgorithms,MACsand the host-key and public-key algorithm lists. -
IKE/IPsec proposals: strongSwan and libreswan
ike=/esp=, and swanctlproposals/esp_proposals. Each is listed as anIKEorIPSECprotocol with its cipher, integrity, PRF and Diffie-Hellman group (MODP, ECP, X25519, ML-KEM). -
Kerberos:
krb5.conf/kdc.confenctype lists. -
Local account passwords:
login.defsENCRYPT_METHOD, the scheme new/etc/shadowentries are hashed with (SHA512is SHA512-crypt; alsoSHA256,MD5andBCRYPT). -
WireGuard: an
[Interface]with a private key is listed asWireGuard, with its fixed X25519, ChaCha20-Poly1305 and BLAKE2s. The key itself is never read. -
Framework TLS settings:
- Spring Boot
server.ssl.*andspring.ssl.bundle.*.options; - Quarkus
quarkus.http.ssl.*and the TLS registry'squarkus.tls.*(default and named configurations), and Micronautmicronaut.ssl.*andmicronaut.server.ssl.*; - ASP.NET Core Kestrel
SslProtocols. Kestrel's allowed cipher suites are set in code, as aCipherSuitesPolicyofTlsCipherSuitemembers, which the C# rules read.
These are read from
application*.properties/.ymlandappsettings*.json. - Spring Boot
-
JVM security properties (
java.security, or any*.securityfile passed with-Djava.security.properties):keystore.type;- each entry of
securerandom.strongAlgorithms(NativePRNGBlocking,DRBG), listed as a random number generator.securerandom.sourcenames an entropy device, not an algorithm, and is not listed; - the refusal lists
jdk.tls.disabledAlgorithms,jdk.certpath.disabledAlgorithmsandjdk.jar.disabledAlgorithms. Each entry is recorded as anxgrep:cbom:disabled-algorithmproperty, never as an asset. The property goes onTLS, onX.509 Path Validationor onSigned JAR Verification. An entry keeps its constraint (RSA keySize < 1024), andinclude jdk.disabled.namedCurvesis expanded when the same file defines that property. Lines continued with a trailing backslash are joined.
-
Kubernetes:
- ingress-nginx
ssl-protocols/ssl-ciphersannotations and controller ConfigMap; - cert-manager
Certificateprivate-key algorithm and size; - Istio
Gatewayminimum and maximum TLS version and cipher suites; - an Istio
DestinationRule'strafficPolicy.tls.mode(at the rule, a port or a subset):SIMPLE,MUTUALandISTIO_MUTUALare TLS to the upstream, listed asTLS;DISABLEis not listed.
- ingress-nginx
-
OIDC and OAuth: the JOSE algorithms a configuration selects, for signing and for encryption (
RS256,ES384,RSA-OAEP-256,A256GCM):- client metadata (
id_token_signed_response_alg,request_object_encryption_enc,token_endpoint_auth_signing_alg, …) in YAML, or in JSON whose name marks it as OIDC or OAuth configuration; - a provider's discovery document (
.well-known/openid-configuration, and its*_alg_values_supportedlists); - a Keycloak realm export (
defaultSignatureAlgorithm, and client attributes such asid.token.signed.response.alg); - Spring Security
spring.security.oauth2.resourceserver.jwt.jws-algorithmsand the authorization server'sid-token-signature-algorithm; - MicroProfile and SmallRye JWT, and Quarkus OIDC, signature algorithms.
noneis not an algorithm and is not listed. - client metadata (
-
DNSSEC: a BIND
named.confdnssec-policy'sksk/zsk/cskalgorithms, by mnemonic or number. -
SAML and XML security: the XML-DSig and XML-Enc algorithms an
Algorithmattribute names in an XML file (SAML metadataSigningMethod,DigestMethodandEncryptionMethod, Shibboleth and Santuario configuration, a signed document'sSignatureMethod). Also python3-saml'ssecurity.signatureAlgorithmanddigestAlgorithmin a*saml*.json, or in asettings.jsonoradvanced_settings.jsonunder asamldirectory. An XML Schema (.xsd) is read too: the algorithm URIs itfixedes,defaults or lists as anxs:enumeration value. A namespace declaration, a transform and a canonicalization name no algorithm and are not listed. In source code, an algorithm URI is read from any string literal form, including Java text blocks, Kotlin raw strings, Scala triple-quoted strings, C# verbatim, interpolated and raw strings, and Ruby%q()/%Q{}literals,%w[]word arrays and heredocs. Each URI is reported at its own line of a literal that spans several. Only the literal is read: a URI in a comment, including one after the literal on its closing line, is not listed.
Only what a directive enables is listed. A commented-out line is ignored, and so
is an exclusion (!RC4, -SSLv3, Ciphers -aes128-cbc). A group keyword such
as HIGH or DEFAULT is ignored too, because the library expands it at run
time. Configuration under test and example directories is read and marked with
its scope (see Production crypto and test crypto). What a
cipher list refuses with ! (HIGH:!aNULL:!MD5) is recorded on the TLS
protocol as one xgrep:cbom:disabled-algorithm property per entry, spelled as
in the list, and is never listed as an asset.
Configuration that a deployment tool generates is read from its source:
- Jinja2 templates (
.j2,.jinja2,.jinja) are read as the file they render:nginx.conf.j2as nginx,sshd_config.j2as sshd_config, a template under annginxdirectory as nginx, and a template whose name or directory mentions ssh (opensshd.conf.j2) as OpenSSH when its directives are OpenSSH's. The template is not evaluated. A directive whose value is a{{ … }}expression names nothing, and a literal value reads as it would in the rendered file. A directive inside an{% if %}branch is still read, and its occurrence names the branch (ssl_ciphers (template branch: if legacy)). An asset that only such branches name carriesxgrep:cbom:conditional=template-branch, because whether it is deployed depends on variables the template does not show. - Ansible variable files (a role's
defaults/andvars/, andgroup_vars/andhost_vars/) are read by key. A top-level variable whose name ends in a directive the reader knows is read as that directive's value:nginx_ssl_ciphers,nginx_ssl_protocols,ssl_ecdh_curve,…_dh_size, andssh_ciphers,ssh_macs,sshd_kex_algorithmsorssh_host_key_algorithms. A cipher list is read as OpenSSH's or as TLS's by the other words in its name (ssh, orssl,tls,nginx,apache,haproxy); a name with neither or both names nothing. A value that is a variable reference ("{{ base_ciphers }}") names what the same role'sdefaults/set that variable to, and nothing otherwise. community.cryptotasks in a role's tasks or handlers, or in a playbook:openssh_keypair,openssl_privatekey,openssl_dhparam,openssl_csr,x509_certificateandx509_crl(and their_pipeforms), read by theirtype,sizeandcurvearguments (EC-secp384r1 Private Keyfortype: ECC,curve: secp384r1). A key type the task leaves out is the module's documented default, RSA. An argument that is a variable is read through the role'sdefaults/as above: a size or curve left out or not fixed there leaves the key unsized, and a type not fixed there names nothing.
When a TLS configuration names a certificate or key file that is in the
scanned tree, the TLS protocols that file sets are linked to that file's asset.
The directives are nginx ssl_certificate/ssl_certificate_key, Apache
SSLCertificateFile/SSLCertificateKeyFile, HAProxy bind … crt (a file or
a directory, under a relative crt-base), Redis tls-cert-file/tls-key-file
and PostgreSQL ssl_cert_file/ssl_key_file. In Spring Boot properties and
YAML they are server.ssl.key-store/trust-store (and
certificate/certificate-private-key/trust-certificate), and an SSL
bundle's spring.ssl.bundle.jks.*.keystore.location/truststore.location or
PEM certificate/private-key. In Quarkus they are
quarkus.http.ssl.certificate.* (key-store-file, trust-store-file,
files, key-files) and the TLS registry's
quarkus.tls[.<name>].key-store/trust-store paths and PEM certificates and
keys; in Micronaut, micronaut[.server].ssl.key-store.path and
trust-store.path. A classpath: location is looked up under
src/main/resources, and a placeholder such as ${KEYSTORE} names no file.
When a key store is opened (see above), the certificates inside it are linked
too.
The protocol depends on the
certificate or key asset, and that asset's xgrep:cbom:used-by property names
the directive as path:line. The path is looked up beside the configuration
file and under the scan root. There is no link when:
- the file is not in the tree, or is in a directory that is not read;
- the path is absolute (
/etc/ssl/…) or uses a variable; - the configuration sets no TLS version or cipher list, so it has no protocol asset to link from.
MySQL and MariaDB read their certificate options differently. The server
changes its working directory to its data directory at start-up, so a relative
ssl_cert, ssl_key, ssl_ca or ssl_capath (also spelled ssl-cert, and
with a loose- prefix) in a group the server reads ([mysqld], [server],
[mariadb], [mariadbd], [client-server], [galera] and their versioned
forms such as [mysqld-8.0]) is a file under datadir, never one beside the
option file. A relative datadir is under basedir. Such an option makes the
server's TLS endpoint a TLS protocol asset when the file sets no TLS version
or cipher, and it is linked when:
- every option file in the scan root (
my.cnf,my.ini,*.cnf, including[mysqld_safe], which passes its owndatadirto the server) that setsdatadirsets the same literal path, and a relative one has a single absolutebasedir; and - the resulting server path, or an absolute
ssl_certas written, is a file in the tree that mirrors the server's file system: under the scan root (var/lib/mysql/server-cert.pem), or under the directory holding the option file'setc/when that file sits at a MySQL location (docker/rootfs/etc/mysql/my.cnfanddocker/rootfs/var/lib/mysql/…).
There is no link when no option file sets datadir (the server's compiled-in
default differs by build and package), when two values differ, when a value is
a template placeholder or a Windows path, for a client group's ([client])
certificate, or when the server turns TLS off (skip-ssl, ssl=OFF, an empty
tls_version).
Command-line tools in scripts and CI
xgrep also reads the crypto that command-line tools perform in shell and
PowerShell scripts (an extensionless file is a shell script by its
#!/bin/sh, bash, zsh, … line), Dockerfiles, Makefiles, CI workflows
(GitHub Actions, GitLab CI, CircleCI) and package.json scripts:
opensslkey, certificate, encryption, digest and TLS commands. What a command writes is listed too: the private key ofgenrsa,genpkey,ecparam -genkeyandgendsa(RSA-2048 Private Key (PEM),(DER)with-outform DER,Private Key (encrypted) (PEM)with a cipher flag); the key ofreq -newkeywhen-nodes/-noencor a cipher says how it is written; anX.509 CSRfromreq -newwithout-x509; anX.509 CRLfromca -gencrlandcrl -out; anX.509 Certificate (PKCS#7)fromcrl2pkcs7; a PKCS#8 key frompkcs8 -topk8(encrypted unless-nocrypt) and an RSA key fromrsa -out((PKCS#1)with-traditional).randis listed asDRBG, andpkcs12 -macalgas the HMAC over that digest;openvpn --genkey, which writes an OpenVPN static key (Secret Key);ssh-keygen -t,ssh -c/-o Ciphers=…;keytool -genkeypair;gpgalgorithm options;dnssec-keygen -aandldns-keygen -azone-signing algorithms, by mnemonic or number (ECDSAP256SHA256,13), with an RSA key's-bsize;age,minisign,signify;cosign generate-key-pair(ECDSA P-256) and an encryptingsops(AES-256-GCM, with X25519 for an--agerecipient);- the
sha*sumtools; certutil -hashfile,Get-FileHashandNew-SelfSignedCertificate;- PowerShell
Protect-CmsMessage/Unprotect-CmsMessage(listed asCMS; the content-encryption algorithm is the .NET runtime's default and is not named), andConvertTo-SecureString/ConvertFrom-SecureString: AES with-Keyor-SecureKey, Windows DPAPI without.-AsPlainTextencrypts nothing and is not listed. - the tpm2-tools key creators (
tpm2_createprimary,tpm2_create,tpm2_createek,tpm2_createak) with-G rsa3072,ecc384, … — keys reported withsecuredBy: TPM.
Each is listed with the parameters its arguments state. A tool counts only where
it runs as a command, not when it is named in an echo or a comment. A command
that only inspects (openssl x509 -noout -text) is not listed. A default that
depends on the tool's version, such as ssh-keygen without -t, is not
guessed. A variable the file sets to a literal (BITS=4096, export,
Dockerfile ARG/ENV, Makefile :=) is expanded where a command uses it,
and so is a default: set_var NAME value, : "${NAME:=value}" or
: ${NAME=value}, which does not replace a literal set before it. A variable
a shell function sets is expanded only in the rest of that function, except a
default: one that applies where it is written is the script's value wherever
nothing else sets the variable, in any function, and one written in an arm of
case "$ALGO" in ed) only inside an ed) arm on $ALGO elsewhere. A value
computed at run time, or supplied by a caller or the environment, is not
expanded; ${NAME:+words} reads as its words only where the file set NAME to
a literal.
A script's branches are followed as far as the text states them. Inside an arm
of case "$ALGO" in rsa) whose pattern is a single word, $ALGO is rsa;
a glob or a|b pattern fixes nothing, and a value one arm sets is not used in
another. A variable a branch unsets (if [ "$nopass" ]; then unset cipher; fi) is read both ways, so a command that encrypts its key only when the
variable is set lists both the encrypted key and the plain one. A key that
openssl genpkey -paramfile F makes is named by the curve or algorithm the
script's openssl ecparam -name … -out F or genpkey -genparam … -out F
writes there, when exactly one is written to that file.
A command that signs with an EC key lists ECDSA: openssl req -newkey ec:…,
and openssl req -key F, ca -keyfile F or x509 -signkey F/-CAkey F
where the same function's openssl commands write an EC key to F, once or in
alternative case arms. A key file written by a command that does not state
its algorithm, or by two commands that can both run, names no signature.
RSA keys are not read this way, because their signature scheme depends on
the command's options; an Ed25519 or Ed448 key is already listed by the
algorithm it signs with.
In a shell script, openssl may also run through a variable or a function:
- a command word that is a variable whose name ends in
OPENSSL("$EASYRSA_OPENSSL" req …,${OPENSSL} genrsa …), or one the same file sets to an openssl binary (OPENSSL=/usr/bin/openssl,OPENSSL="${OPENSSL:-openssl}",OPENSSL=$(command -v openssl)), runs openssl; - a function whose body runs such a command with
"$@", after fixed words or the arguments it took as$1… and shifted off (cmd=$1; shift; "$OPENSSL" "$cmd" "$@"), is a wrapper, and a call to it (ssl_wrapper genpkey -algorithm ed25519 …) is read as the openssl command it runs, at the call's line. Where the function forwards"$@"in more than one branch and one of them also passes an option whose value is only known at run time (-config "$tmp_cnf"), the branch without it is read; where every branch has one, the option is left out. A function that does not forward"$@", or forwards it to another tool, is not a wrapper.
Only the script itself is read: a variable or function another file defines names nothing.
When a command generates a key into a file that is in the scanned tree, the
key or certificate file's asset is linked to the command's algorithm. Examples
are openssl genrsa -out tls.key 2048, openssl req -newkey rsa:4096 -keyout k.pem -out c.pem, ssh-keygen -f id_ed25519 (its id_ed25519.pub) and
keytool -genkeypair -keystore ks.jks. The file's asset depends on the
algorithm, and its xgrep:cbom:generated-by property names the command as
path:line. The output path is looked up beside the script and under the scan
root, from the directory the command runs in:
- a
cd,pushdorSet-Locationearlier on the same line (cd certs && openssl genrsa -out tls.key 2048); - in a shell or PowerShell script, an unindented line that only changes directory, for the lines after it;
- a Dockerfile
WORKDIR(a relative one; an absoluteWORKDIRkeeps the default lookup), until the nextWORKDIRorFROM; - a GitHub Actions step's
working-directory(or the job's or workflow'sdefaults.run.working-directory), and a CircleCIworking_directory.
There is no link when:
- the file is not in the tree, or is in a directory that is not read;
- the path is absolute, a variable, or standard output;
- the command runs after a
cdto an absolute path, a variable,cd -orpopd, whose directory the tree cannot name; - the file holds a different algorithm from the one the command generates.
Compiled artifacts
A Java artifact is inventoried from its compiled classes:
xgrep sbom --include cbom app.jar reads the algorithm each JCA factory is
given. That covers Cipher, MessageDigest, Mac, Signature,
KeyGenerator, KeyPairGenerator, SecretKeyFactory, KeyAgreement and
SSLContext getInstance calls. A constant assigned to a local first is
followed. Each asset is located inside the archive (app.jar!Svc.class) at the
source line when the class carries line numbers. An algorithm the caller passes
in names no asset.
The classes also give:
- Bouncy Castle: an engine, digest, block-cipher mode, generator, MAC or
signer class constructed from
org.bouncycastle, named by its class (AESEngineis AES,SHA256Digestis SHA-256). A class of the same name outside Bouncy Castle's packages is not one; - key specs: the private and public key material that
PKCS8EncodedKeySpec,X509EncodedKeySpecand the RSA, DSA and EC key specs make. ASecretKeySpecin Java is not read from a class, because a class cannot show whether its key bytes were written into the code; - Kotlin and Scala: classes that kotlinc or scalac compiled report under
the Kotlin or Scala pack, with the same JCA factories and key specs, including
SecretKeySpec.
A Python wheel ships its source, so xgrep sbom --include cbom app.whl reads
its modules as source and locates each asset inside the archive
(app.whl!pkg/core.py). The tests a wheel bundles are test scope.
A Go executable in the tree (ELF or Mach-O, stripped or not) is read too.
The crypto entry points its function table holds are listed as assets of the
binary: crypto/aes.NewCipher is AES, crypto/ed25519.GenerateKey is
Ed25519, crypto/tls.(*Conn).Handshake is TLS. Go's linker drops every
function a program cannot reach, so an entry point there is crypto the
shipped binary can run, even when its source is not in the tree. A Windows
(PE) binary is not read.
Values set away from the call
xgrep also resolves constant references: when an algorithm is passed as an
upper-case constant (e.g. Cipher.getInstance(ALGO) where
static final String ALGO = "AES/GCM/NoPadding"), the constant is resolved to its
string literal within the same file so the real algorithm is inventoried. When
the file does not define it, xgrep looks further:
- Go: another non-test file of the same package directory
(
rsa.GenerateKey(r, rsaBits)withconst rsaBits = 3072beside it). - Other languages: an upper-case constant, or the last part of a qualified
one (
settings.JWT_ALGORITHM,cfg.CIPHER), defined anywhere in the project's files of the same language. Dependency and hidden directories are not searched.
Every definition found must bind the same literal. If two files disagree, as
when a test configuration overrides production's, the reference stays
unresolved. A reference that cannot be resolved to a literal is dropped rather
than recorded as an unnamed asset. In Python, a constant passed as a keyword
argument (hmac.new(k, m, digestmod=MAC_HASH)) and a cipher list held by a
constant (ctx.set_ciphers(TLS_CIPHERS)) resolve the same way.
An algorithm read from configuration or the environment is named by the value the project's own configuration files give it:
HASH_ALG=sha384 # .env
crypto.createHash(process.env.HASH_ALG) // SHA-384, reported here
crypto.digest: SHA-512 # application.yml
@Value("${crypto.digest}") String digest; // MessageDigest.getInstance(digest): SHA-512-
Reads followed: JavaScript and TypeScript
process.env.NAME; Pythonos.environ["NAME"],os.environ.get("NAME")andos.getenv("NAME"); Goos.Getenv("NAME")andos.LookupEnv("NAME")(for example injwt.GetSigningMethod); JavaSystem.getenv("NAME")and a field or parameter bound with@Value("${key}"), Quarkus/MicroProfile@ConfigProperty(name = "key", defaultValue = "…")or Micronaut@Property(name = "key"); a field of a Spring@ConfigurationProperties(prefix = "crypto")class that has a setter (keySizereadscrypto.key-size, else the field's initializer); and Quarkus/MicroProfileConfigProvider.getConfig().getValue("key", …)or.getOptionalValue("key", …).orElse("…"). Each key binds by its own framework's rules, read from the annotation's import:- Spring: a key written in canonical form (lower case,
-between words,${crypto.digest-algorithm}) also bindscrypto.digestAlgorithm,crypto.digest_algorithmand the environment variablesCRYPTO_DIGESTALGORITHMandCRYPTO_DIGEST_ALGORITHM. A key in any other form (${crypto.digestAlgorithm}) binds only itself, as Spring does. - Quarkus/MicroProfile: the exact key, its
%prod.-style profile overrides, and the environment variableCRYPTO_DIGEST_ALGORITHM. - Micronaut: a key in kebab form (
crypto.digest-algorithm) also bindscrypto.digestAlgorithm. - An annotation whose import the file does not state binds only the exact key.
When a configuration file spells the key in a way the framework might or might not read, nothing is named. In Python, a read of a mapping loaded from a YAML or JSON file (
cfg["crypto"]["digest"]orcfg["crypto"].get("digest"), where the file assignscfg = yaml.safe_load(open("config.yml"))once, orjson.load(f)insidewith open("config.json") as f:) names the value that file gives the key, and so does a read of an INI file throughconfigparser(cfg["crypto"]["digest"]orcfg.get("crypto", "digest"), where the file assignscfg = configparser.ConfigParser()once and callscfg.read("settings.ini")once, and never writescfg). The read may be at the call, or assigned to a local first (const alg = process.env.HASH_ALG,alg := os.Getenv("JWT_ALG")) when that is the local's only assignment in the file, and the name is not rebound by a loop (for alg in …) or anas algbetween the assignment and the call. In Go a tuple assignment counts as an assignment (alg, err := pick()), and a local given an env read and anything else, such as a fallback (if !ok { alg = "RS256" }), names nothing: its value is decided where the program runs. - Spring: a key written in canonical form (lower case,
-
Files read:
.envand.env.<name>files (not.env.example,.sample,.templateor.dist), andapplicationandbootstrapproperties and YAML (Spring Boot, Quarkus, Micronaut; notMETA-INF/microprofile-config.properties), in the scanned tree. Test, fixture and example directories are not read. A Python loader's file is looked up by its relative name beside the source file and at the project root; when both exist they must agree, and a file outside the tree is not read. -
Only certain values: a literal, the same in every file that defines the name. Two files that disagree (
.env.developmentand.env.production, two profiles, a Quarkus%prod.key and its unprofiled key, two#---documents of one Spring.propertiesfile), a value that interpolates another (${OTHER}, an INI%(other)s), and a name no file defines name nothing. A default in the code (os.getenv("ALG", "sha256"),${crypto.digest:SHA-256},defaultValue,orElse, a@ConfigurationPropertiesfield's initializer) is named when no file defines the name at all; a name defined in a way that names nothing does not fall back to it. A key set only for a profile (application-prod.yml,%prod.crypto.digest) is named only when the code gives no default or the same one, since every other profile uses the default. The active profile, and environment variables, system properties and arguments set where the program is deployed, are not visible to the scan.
A key size is also read from the buffer an AES key is made in, when the
key has exactly one fixed-length initializer: Go make([]byte, 32), Python
os.urandom(32)/secrets.token_bytes/get_random_bytes, Node
randomBytes, and Java and C# new byte[32] or
RandomNumberGenerator.GetBytes(32). This sizes Go aes.NewCipher, pyca
AESGCM and AESCCM, pycryptodome AES.new, .NET AesGcm and AesCcm,
and a Java new SecretKeySpec(key, "AES"). In Java and C# the name must be
declared and assigned exactly once in the file, so a parameter of the same
name, or a later reassignment, states no size.
Random bytes become a secret key only when they reach a key parameter
in the same function. In Go, a buffer (make([]byte, 32),
var k [32]byte) filled from crypto/rand (rand.Read,
io.ReadFull(rand.Reader, …)) by a statement that always runs before the
call, and not overwritten or copied into after, is a key when it is passed
to aes.NewCipher, chacha20poly1305.New/NewX or hmac.New. In Python,
a name whose value at the call is a draw from os.urandom,
secrets.token_bytes or pycryptodome's get_random_bytes, or that draw
written as the argument, is a key when it is passed to pyca
algorithms.AES, AESGCM, AESCCM or ChaCha20Poly1305, pycryptodome
AES.new, or hmac.new. The key is named with the algorithm
the call states and the size the draw states (AES-256 Secret Key,
HMAC-SHA-256 Secret Key). A draw on its own is a random number generator,
not a key: a nonce, IV, salt, token or session id never becomes one, and
neither do bytes that are reassigned, drawn in only one branch or in a loop,
or passed in as a parameter.
In Go, Python and Java, xgrep also follows a project's own helper functions. When the algorithm, size or hash at a crypto call is a parameter of the function the call is in, it is chosen where that function is called:
def make_hash(name, data=b""): # crypto/util.py
return hashlib.new(name, data)
make_hash("sha256", body) # app.py: SHA-256, reported here
make_hash(request.args["alg"]) # decided at run time: nothing-
Which helpers: a Go package-level function, called unqualified from its own package or as
pkg.Name(...)from a file that imports it by its module path; or a Python module-level function without decorators, called from its own module or from one that imports it (or its module) from the project. A Python module name that two files of the project could answer to is not followed. In Java, a static method of a top-level class, called asUtils.digest(...)whereUtilsis that class (the same package, an import of it, or its full name), unqualified from the class's own body, or unqualified from a file that imports it statically (import static com.ex.Utils.digest;orimport static com.ex.Utils.*;) and declares no method of that name itself. Through.*, every other class the file imports statically with.*must be one of the project's own that declares no method of that name: a library class's members are not read, so a call that one of them could answer is not followed. When the class declares another method of the same name that the call's number of arguments could also select (an overload), the call is not followed. -
Which calls: the helper's direct calls, and the calls of a helper that wraps it, up to three levels in all. The argument is read by position or by keyword, or is the parameter's literal default when the call omits it. A call that spreads its arguments (
*args,**kw,xs...) where the parameter would be binds nothing that can be read. -
Which values: a literal, or a constant that resolves as described above (in Java, a constant that holds exactly one value). Anything else, including a local variable of the calling function, names nothing. A parameter of the calling function, passed on whole, is followed to that function's own calls when it is itself a helper of the kinds above that never assigns it:
def digest(alg, data): # pkg/mid.py return make_hash(alg, data) digest("sha384", body) # app.py: SHA-384, reported hereA helper that passes its parameter back to itself (recursion) or to a helper already on the way is not followed again, and neither is a fourth level or a part of the parameter (
alg.lower(),cfg.alg). When more than sixteen helpers pass one parameter on, only the direct calls are reported. A crypto call reading two such parameters is followed one level only. -
Which parameters: a helper that assigns the parameter before the crypto call is not followed, since the call then uses some other value.
The asset is reported at the call, and its occurrence names the helper's own
crypto call it goes through. A parameter of a function whose calls are not
followed (a method, a closure, a lambda) takes its literal default, or a
literal assigned to it in that function, and otherwise names nothing. It is
never resolved to another variable of the same name elsewhere in the file. In
Python, a keyword argument (f(name="md5")) is never read as a definition of
the variable name.
A few helpers transform their parameter before the crypto call, and are followed through that step:
- JavaScript / TypeScript reverse lookups. A helper that binds
const hash = enums.read(enums.webHash, hashAlgo)and passeshashto WebCrypto (OpenPGP.js'scomputeHKDF) is named at each call that passes a member of a project enum table (computeHKDF(enums.hash.sha512, …)is HKDF-SHA512), when the table is a module-level object literal nothing in the scanned tree writes, andreadreturns the key that holds a value. A value no key, or two keys, hold names nothing. A shorthand property ({ name: 'HKDF', hash }) is read only in its own function. - JavaScript / TypeScript forward lookups and switches. The same local may
instead be bound to a forward lookup: a method of the enum object that
returns
table[k](enums.lookup(enums.names, alg)), or a one-parameter function of the file that returns a module-level table indexed by its parameter. It may also be bound to a function of the file that maps its parameter through aswitchwhose arms return literals. Each may first check its argument withif (…) throwguards. A call is named with the value its argument maps to: the first matching case wins, an empty case falls through, an arm that throws names nothing, and the default's literal applies only to a value no case holds. A function that does anything else, a table anything writes, and a function the file reassigns name nothing. - JavaScript / TypeScript AES guards. An unsized AES use (
AES-KW, an implementedAES-OCB) is named once per key size when its function first throws unless the cipher parameter is one of the project's AES enum members and the key's length is that cipher's size (if (!util.isAES(algo) || key.length !== keySize) throw …, withkeySizebound from a call on the same parameter). OpenPGP.js's key wrap is then AES-KW-128, AES-KW-192 and AES-KW-256. A guard without the key-length part, a membership check holding anything but AES sizes, a guard that returns instead of throwing, and a reassigned parameter keep the unsized name. - Java format templates. commons-codec's
Crypt.crypt(key, salt)names the crypt(3) scheme its salt's id selects ($1$MD5-crypt,$5$SHA256-crypt,$6$SHA512-crypt), from a literal or from a"$%s$%s".formatted(…)/String.format(…)template whose id is a record component that a static method's calls pass (new AlgoSalt("6", salt)), reported where the id is written. A stored hash passed back to verify a password names nothing.
HKDF qualified by a hash names the HMAC that is its PRF as a part
(HKDF-SHA256 with HMAC-SHA-256 and SHA-256), as PBKDF2 does.
In Apex, a helper whose whole body is return Crypto.generateAesKey(n); names
no AES key when every call of it in the project, tests included, stores the
bytes in a local used only as the IV of Crypto.encrypt/decrypt or of a
project method that only encrypts with it and hex- or base64-encodes it. Its
random-number generator is still reported. Any other use keeps the key.
In Groovy, keyPair.private / keyPair.public (and getPrivate() /
getPublic()) of a pair the same method generates with
KeyPairGenerator.getInstance("RSA") and a literal initialize(2048) (or an
ECGenParameterSpec curve) is a key of that algorithm and size; a pair
passed in, or a generator chosen at run time, names nothing. A JWE content
encryption held by an encryptionMethod identifier (encryptionMethod = 'A128GCM', the Grails Spring Security REST default) is named as its cipher.
A helper of the same kinds whose body fixes the algorithm is a use of that algorithm wherever it is called:
static byte[] hashSHA256(String s) throws Exception { // Utils.java
return MessageDigest.getInstance("SHA-256").digest(s.getBytes());
}
Utils.hashSHA256(token); // App.java: SHA-256, reported here tooEach direct call of the helper gets an occurrence of the assets of the helper's one crypto call (an HMAC and its hash, say). A helper with crypto calls on more than one line, such as one that hashes with MD5 and then with SHA-256, names nothing at its calls: which algorithm a call reaches depends on the path it takes through the helper. The helper's own occurrence stays where it is written. A call inside the helper itself (recursion) adds nothing, and a helper that fixes its algorithm is followed one level: a helper that calls another helper is a call site of the second, but its own callers are not. A crypto call that reads a parameter of its function is named per call as described above, never copied as fixed.
When the value at a crypto call is a variable whose possible values the function itself states, each of them is inventoried at the call:
def sign(alg, data):
if alg not in ("sha256", "sha512"):
raise ValueError(alg)
return hashlib.new(alg, data) # SHA-256 and SHA-512, reported heretype Gcm = 'aes-128-gcm' | 'aes-256-gcm';
function seal(alg: Gcm, key: Buffer, iv: Buffer) {
return createCipheriv(alg, key, iv); // AES-128-GCM and AES-256-GCM
}def digest(d, x) when d in [:sha256, :sha384] do
:crypto.hash(d, x) # SHA-256 and SHA-384
end- Python: an
if v not in (…)whose body raises, returns, continues or breaks and that has noelif/else; anassert v in (…); or anif v in (…)(or theelseof anif v not in (…)) whose body holds the call. The collection is a tuple, list or set literal,frozenset(…)of one, or a module-level name bound once to one (a list or set only when nothing else in the file uses that name). Inside anand(in) or anor(not in), the membership test still decides. - TypeScript: a parameter or a variable declared with a union of string or
number literal types, written in place or through a
typealias (aliases of aliases are followed). The alias may be the file's own or one a relative named import (import { Mode } from './algs') brings in from a project module that exports it. - Python
Literaltypes: a parameter annotated withtyping.Literal[…]of strings or integers (alg: Literal["sha256", "sha512"]), a|union of such, or an alias of one (Alg = Literal[…],Alg: TypeAlias = …,type Alg = …), in the file or in the project module a relative import (from .types import Alg) names. The module must be exactly one file of the project, the function must never assign the parameter, and a default must itself be one of the members (= Noneis not). A union withstror any other non-literal type names nothing. A PythonEnumread asx.valueis resolved through such an import as well. - Elixir: a
def/defpclause, or a clause of an anonymousfn, guarded byv in [ … ], alone or joined byand, for a parameter of that clause; andv = case … endorv = cond … endbefore the call, every arm of which ends in a literal, when that is the clause's only binding ofv. - Erlang: a function clause's guard, when every
;alternative constrains the parameter with=:=/==(alone, in anorelsechain, or as one,/andalsoconjunct); andV = case … endorV = if … endarms that all end in a literal. An Erlang variable is bound once, so nothing can change it before the call. - JavaScript and TypeScript guards:
if (!C.includes(v)) throw …(orreturn) before the call, the body ofif (C.includes(v)), or theelseof the negated form.Cis an array literal, or a top-levelconstarray that isas const, frozen, or only ever read with.includes. - TypeScript enums and constant arrays: a parameter typed by a string
enumof the file (every member initialized with a string), or bytypeof ALGS[number]over anas constarray. - Python equality:
if v == "a" or v == "b":around the call, orif v != "a" and v != "b": raisebefore it, as membership tests are read. - Python, JavaScript and TypeScript: an
if/elif/elsechain, a Pythonmatchwith a finalcase _:, or aswitchwith adefault, before the call, every branch of which either assigns the variable a literal or leaves (raise, throw, return). - Go, Java and C# switch arms: the call is inside the body of a
switcharm on the variable itself, and every label of the arm is a string or decimal literal: Gocase "RS256", "ES384":, Javacase "SHA-256":(with the emptycasegroups stacked above it) orcase "A", "B" ->, C#case "SHA384":(with the empty sections stacked above it),case "A" or "B":or a switch expression arm"A" or "B" => …. The variable must be a parameter or local of the call's own function, not a field or package variable. Adefault(or_) arm, an arm another arm can reach without matching its labels (a Gofallthroughfrom the arm before, a Java group above it that does not end inbreak,return,throw,continueoryield, a C#goto case), a label that is a name or a pattern, a write to the variable in the arm before the call, and a variable whose address is taken or passed byref/outname nothing. A call in a closure inside the arm names nothing either. For a name looked up in a table of algorithm names (golang-jwt'sjwt.GetSigningMethod(alg)), every label must be a name in that table.
switch alg {
case "RS256", "ES384":
return jwt.GetSigningMethod(alg) // RS256 and ES384
default:
return jwt.GetSigningMethod(alg) // nothing
}A set crosses one function call at a project helper whose calls are followed (see below): when a call of the helper passes a variable of the calling function, the values the caller's own guard, type or branch chain states for that variable are reported at that call, each one noting the helper. A call passing a variable the caller does not constrain names nothing, and the caller's own callers are not read.
def make_hash(name, data):
return hashlib.new(name, data)
def checksum(alg: Literal["blake2b", "blake2s"], data):
return make_hash(alg, data) # BLAKE2b and BLAKE2s, reported hereA set is used only when it is complete and certain. Every member must be a
plain string, a decimal integer or an atom: a single other name, call,
f-string or template in it, a TypeScript string or template type in the
union, or an or guard in Elixir, and nothing is inventoried. The guard, type
or chain must be in the call's own function and on every path to it, so a
guard in a sibling branch or in another function names nothing, and so does a
variable assigned again between the guard and the call. In JavaScript and
TypeScript (createHash, createCipheriv, createDecipheriv), in Elixir
(:crypto.hash, crypto_one_time, generate_key), in Erlang
(crypto:hash, crypto_one_time, generate_key) and in C#
(HashAlgorithm.Create, SymmetricAlgorithm.Create,
CryptoConfig.CreateFromName given a lower-case variable), a variable is named
only this way: it is never resolved by its name elsewhere in the file.
A Node.js cipher name built from the length of the key the call is given,
createCipheriv('aes-' + (key.length * 8) + '-gcm', key, iv) or the template
literal `aes-${key.length * 8}-gcm`, is AES at each of its three key
sizes: node:crypto names aes-<bits>-<mode> only for 128, 192 and 256 bits and
refuses a key of any other length. The length of another value (an IV), a
prefix other than aes-, and a mode OpenSSL does not name at every AES size
are not read, and a cipher name otherwise computed at run time
(name + '-cbc') names nothing.
An algorithm held in a member of a settings object is resolved too, in its own file or in the module it is imported from:
- JavaScript/TypeScript: a property of an object literal, frozen or
not:
const ALG = Object.freeze({ HASH: "sha256" })withcrypto.createHash(ALG.HASH), orexport const cfg = { cipher: "aes-256-gcm" } as constwithcreateCipheriv(cfg.cipher, …). Nested objects are followed up to four members down (cfg.crypto.hash), and aletorvarobject counts when it is never reassigned. A stringenummember (Alg.Fast,const enumtoo) and a class'sstaticfield (Crypto.HASH) are read the same way. The object may come from another module: imported by name or as a default, re-exported (export { cfg } from,export * from), or CommonJS exports (module.exports = { … },exports.HASH = …) read throughrequire('./algs'),require('./algs').HASHorconst { HASH } = require('./algs'). A name twoexport *lines both provide is not resolved. - Python: a class attribute:
class Config: HASH = "sha256"withhashlib.new(Config.HASH), including a class imported from another module and a class nested in one (Settings.Crypto.HASH). AnEnummember is not its value and is not resolved, unless the enum derives fromstr. - Go: a field of a struct literal held in a package-level variable:
var defaults = Settings{Cipher: "aes-256-gcm"}withdefaults.Cipher, from any non-test file of the same package. - TypeScript/JavaScript class fields:
this.algorithmread in a method, when the same class declaresprivate readonly algorithm = "aes-256-gcm"(or a#algorithmprivate field, or areadonlyfield of a named class that nothing in the project extends). The field must be declared once, with a literal, and never written in the class: an assignment, a constructor parameter of the same name, a getter beside it, afunctionin the class body (which rebindsthis) or a public field that any code could change all leave it unresolved, and so does astaticfield read throughthis. - Python dict literals:
hashlib.new(CONFIG["hash"]),CONFIG["crypto"]["digest"]orCONFIG.get("hash"), when the module assignsCONFIG = {"hash": "sha3_256", …}once at its top level, with string keys and no**spread. Any other mention of the name, in the file or in another Python file of the project, leaves it unresolved: a write to a key,del, a method such asupdate, passing the dict to a function, or rebinding it. A key the dict does not hold names nothing;.get's default is not used.
The value is reported at the call, so the asset's role is the call's.
A member is only treated as a constant while nothing changes it. If the member
is assigned anywhere in the project, or the object is reassigned, or it can be
changed in another way (Go's &defaults or a method call on it, JavaScript's
Object.assign, Python's setattr), the reference stays unresolved. For a
nested member that holds for every object on the way to it, and in JavaScript
also for an object given another name (const c = cfg.crypto), a module's
exports written through any require or import of it, and a static field its
class writes through this. The same
goes for a member whose value is not a literal, and for a member of something
that is not such an object, like a function parameter's opts.cipher or
self.algo.
In Objective-C, a CommonCrypto or Security-framework constant named through the preprocessor or a constant structure is read from the file itself:
- A
#defineis read only when the file defines it exactly once, as an object-like macro, outside every#if/#ifdef/#ifndef(the file's include guard aside), before the call, never#undefs it, and imports no header between the definition and the call. A macro of a macro is followed. A macro defined in a header, a prefix header or a-Dbuild flag is not read, with one exception: a key size in a Security-framework attribute dictionary (kSecAttrKeySizeInBits: @kKeyBits) that the file does not define is read from the scanned headers (.h,.pch) when every#defineof that name in them is a plain decimal number outside every conditional, they all give the same value, and none#undefs it. A name defined only outside the scanned files, or defined two ways, leaves the key named by its family (EC). - A structure field is read only from a
static conststructure at file scope with a designated initializer (.algorithm = kCCAlgorithmAES), defined once outside every conditional, that the file only ever reads fields of. Its address taken, a field written, a copy, a parameter or local of the same name, a positional entry, a field given twice, or a pointer (settings->algorithm) leaves it unread, and so does a field of a function or method parameter (settings.algorithm), whose value the caller chooses.
A constant that is not read this way names nothing, as a value chosen at run time does; an HMAC or PBKDF2 call still lists its family.
In C and C++, a crypto call written through a macro is inventoried as the call
it expands to, when the macro is a plain alias: #define CIPHER EVP_aes_256_gcm
followed by CIPHER(), or a function-like macro that only passes its parameters
on, unchanged and in order (#define DIGEST() EVP_sha512(),
#define HASH(d, n, o) SHA256(d, n, o)). A macro whose body adds, drops or
changes an argument is not expanded, so the call it hides is not inventoried.
The #define line itself is never reported.
Where a key-management service runs its crypto
An algorithm asset that a key-management service performs carries CycloneDX
algorithmProperties.executionEnvironment:
| Source | executionEnvironment |
|---|---|
| AWS KMS, Google Cloud KMS, Azure Key Vault (the provider's infrastructure, outside the program) | other |
Azure Managed HSM (provider azure-managed-hsm) | hardware |
| Vault Transit (a Vault server that may run anywhere) | unknown |
A key the source shows inside an HSM: a Cloud KMS protection_level/ProtectionLevel of HSM, an Azure RSA-HSM/EC-HSM key type, an AWS key in a CloudHSM key store (Origin: AWS_CLOUDHSM, or a Terraform custom_key_store_id without xks_key_id) | hardware |
| An algorithm the program runs itself | not stated |
In code, the algorithm and the key's protection are usually written in
different statements, so the file decides: every protection level the file
sets is HSM, every Key Vault host it names is a managedhsm host, or every
AWS key origin it states is AWS_CLOUDHSM. A file that also names another
value, or none, is not claimed. In Terraform the resource block decides.
The field holds one value, so an asset keeps it only while every use agrees:
AES-256-GCM run by a CloudHSM key and by the program itself states none.
Each use's value is kept in the xgrep:cbom:execution-environment property.
implementationPlatform is not stated for these: the source does not show the
CPU a service or HSM runs on.
Crypto computed with CPU instructions
C, C++ and Rust code can compute a hash or run AES's key schedule with the
CPU's own crypto instructions, through compiler intrinsics. Each such call is
inventoried, and where the code can only run on one platform the asset states
it in CycloneDX algorithmProperties.implementationPlatform:
| Source | Asset | implementationPlatform |
|---|---|---|
ARMv8 Cryptographic Extension in C/C++: vsha256hq_u32, vsha1cq_u32, vsha512hq_u64, in a file that includes <arm_neon.h> | SHA-256, SHA-1, SHA-512 | armv8-a |
The same calls in a file without <arm_neon.h> (in angle brackets), with a header that emulates NEON elsewhere (SIMDe, NEON_2_SSE), or that defines the name itself | SHA-256, SHA-1, SHA-512 | not stated |
x86 SHA and AES-NI extensions in C/C++: _mm_sha256rnds2_epu32, _mm_sha1rnds4_epu32, _mm_aeskeygenassist_si128 | SHA-256, SHA-1, AES | not stated: the same code compiles for 32-bit and 64-bit x86 |
Rust core::arch::x86_64::… / std::arch::x86_64::… for those x86 intrinsics | SHA-256, SHA-1, AES | x86_64 |
Rust core::arch::x86::… | SHA-256, SHA-1, AES | not stated: that module is compiled for 32-bit and 64-bit x86 |
Rust core::arch::aarch64::… (and arm::…) for those ARM intrinsics | SHA-256, SHA-1, SHA-512 | armv8-a |
| A Rust intrinsic called by its bare name | as above | the platform of the one arch module the file imports; not stated when it imports several (the usual #[cfg(target_arch)] pair) or none, or defines the name itself |
armv8-a is the architecture that introduced these instructions; later
architectures, such as ARMv9-A, run them too. An intrinsic's name in a comment
or a string is not a call, and an #ifdef __x86_64__ or a
#[cfg(target_arch = …)] on its own names no platform. The AES round
instructions (_mm_aesenc_si128, vaeseq_u8) are not inventoried: fast
non-cryptographic hash functions run them as mixing steps, so a round alone
does not show that AES is computed. Assembly files (.s, .asm) are not
scanned, so a Go or C assembly implementation states nothing.
Portable code never states a platform. As with executionEnvironment, the
field holds one value, so an asset keeps it only while every use agrees:
SHA-256 computed with the ARM instruction in one file and through OpenSSL in
another states none. Each use's value is kept in the
xgrep:cbom:implementation-platform property.
Algorithms named only by a function's name
Some crypto is reached through a function whose body is not in the scanned
tree: a method of a vendored jar, a generated client, an installed package
(Utils.hashSHA256(token), util.md5_hex(data)). Nothing in the source shows
which API it calls, so by default it is not inventoried. In Java, Kotlin,
Python, Go, JavaScript and TypeScript, xgrep sbom --include cbom --cbom-infer-names adds
an asset for such a call when the function's name spells a hash or an HMAC,
or an encryption or signature algorithm together with what it does:
$ xgrep sbom --include cbom --cbom-infer-names .- Which names: MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3-224 to
SHA3-512, SM3, and HMAC with any of them (
md5Hex,hashSHA256,sha3_256,hmac_sha512,HMACSHA1,sm3Digest). The algorithm must be whole words of the name, split at case changes,_,.and between letters and digits:sha256Hexnames SHA-256,mysha256names nothing. A name that spells two different algorithms (md5OrSha1) names nothing. An encryption or signature algorithm (AES with its size and mode, 3DES, DES, SM4, ChaCha20 and ChaCha20-Poly1305, RC4, Blowfish, RSA, ECDSA, Ed25519) counts only beside one operation word,encrypt,decrypt,seal,unseal,signorverify, that the algorithm performs:aesEncrypt,encryptAES256GCM,rsaSignandverifyEcdsaname one, butaesKey,rsaPublicKey,signAesandecdsaEncryptname nothing. Checksums that are not cryptographic, such as CRC-32, are never inferred. - Which names are not computations: a test (
isSha256Valid,hasMd5), a setter or parser (setMd5,withSha256,parseSha1), a getter called without arguments (artifact.getSha256()), a name for data about a digest (md5Column,md5_field,sha1sum_path,md5Match), and a CPU instruction an assembler emits (SHA256RNDS2,SHA1MSG1). - Which calls: only a call whose function is declared nowhere in the
scanned project's files of the same language; Java and Kotlin count as one,
as do JavaScript and TypeScript, since each calls the other's functions.
A project's own helper is
followed through its body as described above instead. A call through a
crypto library (
hashlib.md5,DigestUtils.sha256Hex,CryptoJS.SHA256, an import ofcrypto/…) is left to the detection rules, and a call on a line where an asset is already reported adds nothing. Constructors (new Sha256Digest(), and in Kotlin any call of a capitalised name such asSha256Digest()) and declarations are never read.
Each such occurrence's additionalContext is the call followed by
(inferred from name), for example Utils.hashSHA256 (inferred from name).
An asset that only inferred occurrences name carries the property
xgrep:cbom:confidence: low; an asset also found at a crypto API does not.
A name is weaker evidence than a call, so the option is off by default.
Supported languages
A language is supported when its pack passes the same four checks as every other pack, and is measured on real code:
- a rule test over a fixture of real crypto calls and look-alikes, in which any match not listed fails the test;
- a coverage fixture with one statement for each pattern the pack holds, kept current by a test;
- a check that every pattern matches on the syntax tree, so that no asset rests on a text match alone;
- an end-to-end
xgrep sbom --include cbomrun that checks the asset names, the algorithms they link to, and the cases that must not be reported;
and when at least one open-source project in that language is part of the CBOM benchmark (see How accurate it is), with its crypto labelled by hand from the project's source.
These languages meet that bar: Apex, C, C++, C#, Cairo, Clojure, Common Lisp, Dart, Elixir, Erlang, Go, Groovy, Hack, Java, JavaScript, Jsonnet, Julia, Kotlin, Lua, Objective-C, OCaml, Perl, PHP, PowerShell, Python, R, Ruby, Rust, Scala, Scheme, Solidity, Swift, Terraform (HCL) and TypeScript.
The other files xgrep parses are covered by a reader rather than a pack:
- shell scripts (Bash, sh, zsh), Dockerfiles, Makefiles and CI workflows by the command-line tool reader;
- server configuration files and JSON, YAML, TOML, XML and properties files by the configuration readers, for the settings listed there;
- key and certificate files by their own reader.
Not covered yet:
- JavaScript inside an HTML page's
<script>element. Code in a.jsor.tsfile is read; - Objective-C++ (
.mm), which xgrep does not parse, and Objective-C in a.hheader, which is read as C; - languages xgrep does not parse at all (see Supported languages).
How accurate it is
The CBOM is measured against a benchmark of pinned open-source projects. For each project, every cryptographic asset its code, key files, configuration, scripts and Terraform contain was read by hand from the pinned source and written down as a CycloneDX inventory. No inventory is derived from a scanner's output. Assets that only tests use are labelled too, and count like any other. The CBOM xgrep produces for the project is then scored against its inventory:
- found: the CBOM names the same asset, by the same OID or the same
name once spelling is normalised. A more or a less specific name of the
same family counts too (
RSA-2048for a labelledRSA,AES-GCMforAES-256-GCM), but one unsized asset is credited against at most one sized one; - combined algorithms:
SHA256withRSAorAES-CMACcounts as found when each of its parts is found; - false positive: a reported asset the inventory does not list. A less
specific name for an asset already found (
HMACbesideHMAC-SHA256) is neither found nor false; - recall is the share of labelled assets found, and precision the share of reported assets that the inventory lists.
| Measure | xgrep |
|---|---|
| Recall | 97.1% |
| Precision | 99.9% |
| F1 | 98.5% |
| Projects (corpora) | 77 |
| Labelled assets | 2,622 |
| Measured at | cab23b8ce, 2026-11-07 |
Recall by the kind of file each labelled asset's evidence is in:
| Source | Labelled | Found | Recall |
|---|---|---|---|
| Source code | 2,345 | 2,273 | 96.9% |
| Configuration files | 59 | 58 | 98.3% |
| Terraform | 32 | 31 | 96.9% |
| Key and certificate files | 157 | 157 | 100% |
| Scripts and CI | 29 | 28 | 96.6% |
Recall for keys a key-management service or hardware holds:
| Key backend | Labelled | Found | Recall |
|---|---|---|---|
| AWS KMS | 23 | 22 | 95.7% |
| Google Cloud KMS | 1 | 1 | 100% |
| Azure Key Vault | 2 | 2 | 100% |
| HashiCorp Vault | 1 | 1 | 100% |
| Huawei Cloud KMS | 1 | 1 | 100% |
| PKCS#11 | 38 | 38 | 100% |
| TPM | 16 | 15 | 93.8% |
| Android Keystore | 10 | 10 | 100% |
| Apple Keychain | 2 | 1 | 50% |
Of the algorithms found that have an OID, 98% carry it (1,409 of 1,434), and 86% of all algorithms found carry a NIST quantum security level (1,590 of 1,846). A Java archive built from one of the projects reaches 12% recall against the same inventory (7 of 58 assets), where its source reaches 100%: reading compiled classes recovers far less than reading source does.
These numbers are totals over every project. A single project can sit well below them, and a row with only a few labelled assets says little on its own. Go executables, Python wheels, container images and root filesystems are not measured yet, and crypto found in dependency source is counted but not scored, since the inventories label a project's own code.
Output
The document is a CycloneDX 1.6 BOM whose components are cryptographic-asset
entries. A single detected call becomes a fully-specified asset:
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"metadata": {
"timestamp": "2026-07-01T00:00:00Z",
"component": { "type": "application", "bom-ref": "root:my-project", "name": "my-project" },
"tools": { "components": [{ "type": "application", "name": "xgrep" }] },
},
"components": [
{
"type": "cryptographic-asset",
"bom-ref": "crypto/algorithm/aes-128-gcm@2.16.840.1.101.3.4.1.6",
"name": "AES-128-GCM",
"cryptoProperties": {
"assetType": "algorithm",
"oid": "2.16.840.1.101.3.4.1.6",
"algorithmProperties": {
"primitive": "ae",
"mode": "gcm",
"parameterSetIdentifier": "128",
"cryptoFunctions": ["encrypt", "decrypt", "tag"],
"classicalSecurityLevel": 128,
"nistQuantumSecurityLevel": 1,
},
},
"evidence": {
"occurrences": [
{
"location": "src/Crypto.java",
"line": 12,
"additionalContext": "javax.crypto.Cipher#getInstance",
},
],
},
},
],
"dependencies": [
{
"ref": "root:my-project",
"dependsOn": ["crypto/algorithm/aes-128-gcm@2.16.840.1.101.3.4.1.6"],
},
],
}Understanding an asset
assetType—algorithm,related-crypto-material,protocol, orcertificate.primitive— the algorithm's role:block-cipher,stream-cipher,ae(authenticated encryption),hash,mac,signature,pke,key-agree,kdf, …oid— the algorithm's object identifier, when known.parameterSetIdentifier— key or digest size (e.g.128,256). A key size is reported only when the code states it, directly or through a constant (#define RSA_BITS 4096,KEY_SIZE = 256). When it does not — a JCA"AES/GCM/NoPadding"transformation,aes.NewCipher(key), a key whose length is set at runtime — the size is unknown: the asset is named without it (AES-GCM,RSA), and the size, size-specific OID and size-dependent security levels are omitted rather than filled in with a library default. Names follow the CycloneDX cryptography registry. An algorithm with a single key size is named without it:ChaCha20,ChaCha20-Poly1305andXChaCha20-Poly1305report256here, not in the name. The Salsa20 family (Salsa20,XSalsa20,Salsa20-Poly1305,XSalsa20-Poly1305) is also named without a size. Salsa20 takes a 128- or 256-bit key, so its size is reported here only when the code states it or the API fixes it (Go'ssalsa20.XORKeyStream). XSalsa20 has only the 256-bit key. The reduced-round ciphers areSalsa20/12andSalsa20/8. NIST SP 800-108 key-based KDFs use the registry's names,SP800_108_CounterKDF,SP800_108_FeedbackKDFandSP800_108_DoublePipelineKDF. When the PRF is known, it is appended:SP800_108_CounterKDF-HMAC-SHA256, as withHKDF-SHA256. AES-GCM-SIV puts the size afterAES(AES-256-GCM-SIV), and isAES-GCM-SIVwhen the code does not state it. An RSA operation whose scheme the code states is named by that scheme:RSASSA-PKCS1-v1_5for a PKCS#1 v1.5 signature or a name that selects one (RS256, SSHrsa-sha2-256, Go'srsa.SignPKCS1v15), andRSAES-PKCS1-v1_5for PKCS#1 v1.5 padding the code only encrypts or decrypts with. A JCASHA256withRSAkeeps its name and depends on SHA-256 andRSASSA-PKCS1-v1_5. PSS and OAEP areRSA-PSSandRSA-OAEP. A use that states no scheme — key generation, a JWK key type, a padding object whose operation is not visible, a padding chosen at run time — staysRSA. An HMAC whose tag is cut short is named with the tag length after its hash, as RFC 2404 and RFC 4868 name them: libsodium'scrypto_auth(and RbNaCl'sHMAC::SHA512256, R sodium'sdata_tag) isHMAC-SHA-512-256, HMAC-SHA-512 truncated to 256 bits, which depends onSHA-512and reports256here. A slash names a different hash:HMAC-SHA-512/256is HMAC over SHA-512/256 (PKCS#11CKM_SHA512_256_HMAC) and depends onSHA-512/256.mode/padding— for ciphers (e.g.gcm,cbc;pkcs5,oaep).classicalSecurityLevel— security strength in bits against classical attacks.nistQuantumSecurityLevel— NIST post-quantum category0–5.0means quantum-vulnerable — the field to scan for when planning PQC migration (RSA/ECDSA/DH are0; broken primitives like MD5/SHA-1 are also0).relatedCryptoMaterialProperties— for key material: thetype(private-key,public-key,secret-key, orkeywhen the call does not say), theformatthe key was read in (PEM,DER) when the call states it, and analgorithmRefto the key's algorithm when the call names it. Such a key is named after its algorithm (RSA Private Key (PEM),EC-secp384r1 Private Key); a key whose algorithm is decided at runtime (PEM_read_bio_PrivateKeyreturns any key type) is a plainPrivate Key. The name carries the key's algorithm and size, never the cipher mode it is used in: the key of anAES-256-GCMcipher is anAES-256 Secret Key, and itsalgorithmRefpoints at theAES-256-GCMasset. Keys used in two modes stay two assets, each referencing its own cipher. In Java and Groovy, a key decoded from aPKCS8EncodedKeySpecorX509EncodedKeySpec, or taken from a generatedKeyPair, is named after the algorithm of theKeyFactoryorKeyPairGeneratorthat the code fixes for it (RSA Public Key (DER),EC-secp384r1 Private Key); a factory chosen at run time, a key pair passed in, or a spec two factories decode keeps the generic name. A key written into the source carries(hardcoded)in its name and the propertyxgrep:cbom:material-origin: hardcoded, and is never merged with a key loaded at run time. Its value is never included. When the literal also states its format, the name carries both, origin first: an OpenSSH key written into a C string isEd25519 Private Key (hardcoded) (OpenSSH), apart from anEd25519 Private Key (OpenSSH)key file and from anEd25519 Private Key (hardcoded) (PEM)literal. In Go, a parse of a key the scan already read (x509.ParsePKCS1PrivateKey(block.Bytes)ofpem.Decode([]byte(testKey)), wheretestKeyis a hard-coded PEM constant of the same package, orssh.ParseAuthorizedKeyofos.ReadFile("./testdata/host.pub")in a test) is an occurrence of that key, not a second one. A parse of bytes the caller passes stays its own key.evidence.occurrences— every source location (file, line) and the detected API that produced the asset. When the algorithm, size or curve was not written at the call but taken from a constant, the occurrence'sadditionalContextsays where it was found, e.g.crypto.createHash (resolved via project constant). The sources aresame-file constant,same-file macro(an Objective-C#define, named with its line),C include(a header the file includes),project constant(another file of the same package or project), andsame-file member constantorproject member constant(a member of a settings object, a class attribute or a struct field, defined in the same file or another one). In JavaScript and TypeScript the object may also be a stringenum(Digest.Fast), a class'sstaticfields (Crypto.CIPHER), an object nested one level in another (cfg.crypto.hash), a module's CommonJS exports (module.exports = { … }orexports.NAME = …, bound withrequire), or a name another module re-exports (export { cfg } from './cfg'). An asset named at a helper's call says which helper, and where its crypto call is:hashlib.new (resolved via wrapper make_hash at crypto/util.py:5), followed by, same-file constant(or another source) when the call passed a constant, or, parameter defaultwhen it omitted the argument. A call of a helper that fixes its algorithm reads the same way, naming the helper's crypto call (java.security.MessageDigest#getInstance (resolved via wrapper Utils.hashSHA256 at Utils.java:9); a Java helper is namedClass.method). A value passed through helpers of the helper names each of them after it, innermost first:hashlib.new (resolved via wrapper make_hash at pkg/util.py:5, wrapper digest at pkg/mid.py:4). A parameter named by its own default or assignment saysparameter defaultorassignment in its function. An asset named from a variable's set of values says what states the set and where:crypto.createHash (resolved via union type at src/digest.ts:5), orguard,enum type,const array type,switch arms,match arms,if/else arms,case arms,cond arms,if armsorcase labels. Each member is its own occurrence at the call. A TypeScript union alias or string enum may come from another module of the project through a relative import (import { Mode } from './algs'); the occurrence then names that module's file and line. An Elixir anonymous function's guard (fn alg when alg in [:sha256, :sha384] -> … end) states a set as adefclause's does. A value read from configuration saysresolved via environment variable HASH_ALG at .env:1, ordefault of environment variable HASH_ALG.certificateProperties.subjectPublicKeyRef— for a certificate read from a file, a key store or source, thebom-refof its subject public key's asset. The certificate also depends on that key in the dependency graph.
Property catalogue
CycloneDX 1.6 has no field for some of what xgrep knows about an asset, so it records it as a component property. These are every property name xgrep writes into a CBOM. A property is absent when it does not apply.
| Property | Carried by | Meaning | Values |
|---|---|---|---|
xgrep:cbom:scope | every crypto asset found in the project or its dependencies | the strongest scope among the asset's occurrences (see Production crypto and test crypto) | production, example, benchmark, docs, test, generated, vendored, dependency |
xgrep:cbom:role | algorithm assets | what the code does with the algorithm, the strongest among its occurrences (see Implemented, used, default, allowed, or a reference) | implemented, used, default, allowed, reference |
xgrep:cbom:source | assets not found in the project's own code | where the knowledge of the asset comes from; absent means the project's code, configuration, key files or binaries | package-profile (a declared dependency's known profile), dependency-source (found in a dependency's own source with --cbom-deps) |
xgrep:cbom:valueSource | assets named through a default | every occurrence names the asset through a value that reaches the call only as a default (a parameter default, an unset option, a Terraform variable default) | default |
xgrep:cbom:conditional | assets from configuration templates | every occurrence sits inside a template's {% if %} branch, so whether it is deployed depends on variables the template does not show | template-branch |
xgrep:cbom:confidence | assets found with --cbom-infer-names | every occurrence was inferred from a function's name, not found at a crypto API | low |
xgrep:cbom:material-origin | key assets | the key is written into the source (its value is never included) | hardcoded |
xgrep:cbom:certificate-sha256 | certificates read from files | the certificate's SHA-256 fingerprint | hex |
xgrep:cbom:self-signed | certificates read from files | the certificate signs itself | true |
xgrep:cbom:used-by | key and certificate file assets | a configuration directive that names the file; one property per directive | path:line |
xgrep:cbom:generated-by | key and certificate file assets | a command in the project that writes the file; one property per command | path:line |
xgrep:cbom:disabled-algorithm | protocol assets | one entry a cipher list or restriction list refuses (!MD5), as the list spells it; one property per entry | an algorithm or suite name |
xgrep:cbom:kms-provider | assets of a key-management service | the service that holds the key or performs the crypto | aws-kms, gcp-kms, azure-key-vault, azure-managed-hsm, vault-transit, huaweicloud-kms; an Azure Key Vault algorithm read from its SDK or Terraform resource is spelled azure-kv |
xgrep:cbom:remote | assets of a key-management service | the crypto runs in the service, not in the program | true |
xgrep:cbom:kms-envelope | envelope-encryption assets (Tink) | the program runs the algorithm itself, under a data key the named service wraps; such an asset is not remote | true |
xgrep:cbom:execution-environment | algorithm assets | where one use of the algorithm runs; one property per value, since the CycloneDX executionEnvironment field holds one value only while every use agrees | software-plain-ram, software-encrypted-ram, software-tee, hardware, other, unknown |
xgrep:cbom:implementation-platform | algorithm assets computed with a CPU instruction | the platform one use's code can only run on (see Crypto computed with CPU instructions); one property per value, since the CycloneDX implementationPlatform field holds one value only while every use agrees | x86_64, armv8-a |
xgrep:cbom:kms-declared-at | key-management service keys | the Terraform resource that declares the key | a resource address, such as aws_kms_key.encryption |
xgrep:cbom:kms-key-source | key-management service keys whose id is supplied at run time | where the key id comes from; it identifies the key, and is not part of its name | a field, parameter, environment variable, configuration key or expression, such as MasterKey.Arn or env SOPS_KMS_ARN |
xgrep:cbom:kms-resource | key-management service keys a Terraform resource declares | the address of the declaring resource; it identifies the key, and is not part of its name | a resource address, such as aws_kms_key.encryption |
xgrep:cbom:policy:<id> | assets judged with --cbom-policy <id> | the policy's verdict (see Checking against a policy) | approved, deprecated, disallowed, quantum-vulnerable, unknown |
xgrep:cbom:policy:<id>:until | assets judged with --cbom-policy <id> | the date after which a deprecated or quantum-vulnerable asset is disallowed | a year or date |
xgrep:cbom:policy:<id>:clause | assets judged with --cbom-policy <id> | the clause of the policy the verdict rests on | text |
xgrep:cbom:deps:status | package components, with --cbom-deps | what the dependency-source scan did with the package (see Crypto in dependency source) | scanned, truncated, not-on-disk, version-mismatch, no-source-files, no-sources-jar, not-reached, unsupported-ecosystem |
xgrep:cbom:deps:origin | package components, with --cbom-deps | where the package's source was read from | module-cache, vendor, replace, node_modules, site-packages, maven-sources-jar, nuget-packages, cargo-vendor, cargo-registry |
xgrep:cbom:deps:files | package components, with --cbom-deps | files scanned out of the files the package ships | scanned/shipped, such as 175/175 |
xgrep:cbom:deps:reachability | package components, with --cbom-deps-reachable | the package's reachability class, as xgrep deps reachability names it | a reachability class |
xgrep:cbom:deps:unreached-occurrences | package components of Go modules read from the module cache, with --cbom-deps-reachable | how many crypto occurrences in the package were dropped because the function holding each is proven unreached | a count; 0 when none were |
xgrep:cbom:os-library | installed operating-system packages, for a container image or root filesystem | the crypto library or tool the package is (see Crypto libraries of a container image or root filesystem) | openssl, libressl, boringssl, gnutls, libgcrypt, nettle, nss, libsodium, mbedtls, wolfssl, botan, cryptopp, openssh |
xgrep:cbom:os-library-kind | installed operating-system packages, for a container image or root filesystem | whether the package is the library itself or a program built on it | library, tool |
cbom:library | assets made through a known crypto library's API | the library whose API produced the asset (see Which library provides an asset) | a library name, such as openssl or go-stdlib |
cbom:provenance | algorithm assets chosen by name | how the asset was found when it was not a call | selected-from-table (a name the project picks from a table of protocol names) |
xgrep:cbom:scope is the one property that is also a CycloneDX field: a
test asset carries "scope": "excluded".
The dependency graph
Assets are cross-linked in the CycloneDX dependencies graph. The scanned
application depends on each detected asset, and composite algorithms are
decomposed into their parts — for example HMAC-SHA256 dependsOn SHA-256,
and SHA256withRSA dependsOn both SHA-256 and RSASSA-PKCS1-v1_5, the
PKCS#1 v1.5 signature scheme that JCA name and the XML-DSig rsa-sha256
signature method stand for (SHA256withRSAandMGF1 dependsOn RSASSA-PSS). A MAC or KDF whose name
or call states the primitive it is built on names that primitive as an asset of
its own, at any depth: HMAC-RIPEMD160 dependsOn RIPEMD-160, an AES-256 CMAC
(aes256-cmac) dependsOn AES-256, and PBKDF2-SHA256 dependsOn HMAC-SHA256,
which dependsOn SHA-256. When the code does not state the primitive (a bare
HMAC or CMAC), none is guessed. Identical assets seen at
many call sites collapse to a single component that accumulates all occurrences.
A protocol other than TLS (XML-DSig, XML-Enc) dependsOn the algorithms its
code selects. An algorithm is linked when it is an argument of the call that
names the protocol (XMLCipher.getInstance(XMLCipher.RSA_OAEP)), or when it is
an XML-security constant or algorithm URI within 10 lines of that call in the
same file (signedXml.SignedInfo.SignatureMethod = "…#rsa-sha256" after
new SignedXml(doc)). Other algorithms nearby, such as the AES of a
KeyGenerator, are not linked. If an algorithm could belong to two protocols,
for example a digest URI between a SignedXml and an EncryptedXml, neither
is linked to it.
Which library provides an asset
For C and C++, each asset records the library whose API made it in a
cbom:library property, read from the call that matched: EVP_sha256() is
openssl, crypto_hash_sha256() is libsodium, wc_AesSetKey() is
wolfssl, mbedtls_pk_parse_key() is mbedtls, and Crypto++ classes are
cryptopp. An asset made through several libraries lists each one. Windows CNG
and CryptoAPI calls are part of the operating system and record no library.
With --include sca,cbom, the dependency graph also says which dependency
provides each asset. The library's component (from Conan, vcpkg, or a
CMake, meson or Make build file) gets a provides edge to every asset made
with its API. OpenSSL's API is also implemented by BoringSSL and LibreSSL, so in
a project that links one of those, its component is the provider. If the SBOM
has no component for the library, no edge is added.
A rule for another language can name the package its API belongs to, such as
pyca/cryptography, golang.org/x/crypto, crypto-js or bcrypt. That
library's component carries the package URL of the calling file's ecosystem,
because one name can be a different package in each. bcrypt called from
Python is pkg:pypi/bcrypt, from JavaScript pkg:npm/bcrypt, and from Ruby
pkg:gem/bcrypt. Each is a component of its own and provides only its own
language's assets. A library that is no package in the calling file's
ecosystem gets no package URL. With --include sca,cbom, a declared
dependency with that package URL replaces the component and provides its
assets.
Algorithms a dependency provides
A project also gets crypto through its dependencies. When --include sca,cbom
finds a well-known crypto package among the declared dependencies, the BOM
lists the algorithms that package implements, read from a curated table of
about 40 packages across Go, Maven, PyPI, npm, crates.io and NuGet (for
example golang.org/x/crypto, org.bouncycastle:bcprov-jdk18on,
cryptography, node-forge, jsonwebtoken, ring and
BouncyCastle.Cryptography). Each entry is taken from the package's own
documentation.
Depending on a package does not prove that any of its algorithms is used, so these assets are kept apart from the ones found in your code:
- each carries the property
xgrep:cbom:source=package-profile(an asset found in code has no such property); - its
bom-refbegins withcrypto/provided/, so SHA-256 provided by a dependency and SHA-256 hashed in your code are two components; - it has no evidence occurrences, and the application does not
dependsOnit. The package's component reaches it through aprovidesedge.
An entry can depend on the version the SBOM resolved. What arrived in a given release is credited only from that release on, and a default a release dropped only up to it, each with the release notes it rests on. For example:
- Bouncy Castle's ML-KEM, ML-DSA and SLH-DSA from Java 1.79 and .NET 2.5.0;
cryptography's Argon2id from 44.0.0;- jjwt's JWE algorithms from 0.12.0;
- Django's HMAC-SHA-256 signing from 3.1, and its HMAC-SHA-1 signing before 4.0.
A pre-release (44.0.0rc1) counts as earlier than its release. A version that
cannot be ordered, or none at all, gets only what every release has.
The table also covers frameworks, HTTP clients and database drivers whose crypto is their own:
- Django's signing and password hashing;
- the TLS versions
urllib3negotiates by default: 1.2 and 1.3 from 2.0, and 1.0 to 1.2 before. These are protocol assets; requests' digest authentication;- Express's signed cookies (
cookie-signature,express-session); - the SCRAM-SHA-256 clients of the PostgreSQL drivers: pgjdbc from 42.2.1,
pgfrom 7.9.0,pgconn, andpgxfrom v5.
Without sca in --include, or when no listed package is declared, nothing is
added.
Crypto in dependency source
A profile says what a package can do. To see what your dependencies' code
actually calls, add --cbom-deps:
xgrep sbom --include sca,cbom --cbom-deps .xgrep then also scans the source of every declared dependency that is already on disk. It reads what a build or an install left there and never downloads anything:
- Go: the module cache (
$GOMODCACHE, else$GOPATH/pkg/mod) at the versiongo.modrequires,vendor/, or a localreplacedirectory; - npm:
node_modules/<name>, when itspackage.jsonhas the version the lockfile resolved; - PyPI: the project's virtual environment (
$VIRTUAL_ENV, or.venv,venvorenvin the project holding apyvenv.cfg), when it has the version the manifest resolved. The files are the ones the distribution'sRECORDlists; - Maven: the artifact's
-sources.jarin the local repository (-Dmaven.repo.localinMAVEN_OPTS, else~/.m2/repository).mvn dependency:sourcesdownloads them. The binary jar is not decompiled; - NuGet: the global packages folder (
$NUGET_PACKAGES, else~/.nuget/packages). Most packages ship only assemblies, so only source and content packages have C# to read; - crates.io: a
cargo vendortree in the project (vendor/<name>, whoseCargo.tomlhas the resolved version), else the registry cache ($CARGO_HOME/registry/src).
Only the code a package ships is read: its tests, examples, benchmarks and docs
are not, nor its own nested node_modules or vendor. Besides source, the key,
certificate and configuration files a package ships are read the way the
project's own are: certifi's cacert.pem lists its CA certificates, for
example. Its package manifest is not. A package's files are read in path order,
at most 2000 per package (--cbom-deps-max-files), and a file over 1 MiB is
skipped.
What is found there is kept apart from your own code's crypto:
- its
bom-refbegins withcrypto/dependency/, so SHA-256 in a dependency and SHA-256 in your code are two components; - it carries
xgrep:cbom:source=dependency-sourceandxgrep:cbom:scope=dependency; - each occurrence is a file of the dependency, such as
golang.org/x/crypto@v0.58.0/ssh/common.gofor the module cache ornode_modules/jsonwebtoken/sign.jsinside the project; - the application does not
dependsOnit. The package's component reaches it through aprovidesedge.
Every package component also records what its scan covered:
| Property | Value |
|---|---|
xgrep:cbom:deps:status | scanned, truncated (more files than the limit), not-on-disk, version-mismatch (another version is installed), no-source-files, no-sources-jar (Maven: only the binary jar is there), not-reached (see below), or unsupported-ecosystem |
xgrep:cbom:deps:origin | module-cache, vendor, replace, node_modules, site-packages, maven-sources-jar, nuget-packages, cargo-vendor or cargo-registry |
xgrep:cbom:deps:files | files scanned out of the files the package ships, such as 175/175 |
xgrep:cbom:deps:reachability | with --cbom-deps-reachable, the package's reachability class |
xgrep:cbom:deps:unreached-occurrences | with --cbom-deps-reachable, on a Go module read from the module cache: how many crypto occurrences were dropped because the function holding each is proven unreached (0 when none were) |
A not-on-disk package was not scanned, so it says nothing about the crypto
that package uses. Install or download the dependencies first (go mod download, npm ci, pip install into the project's venv, mvn dependency:sources, dotnet restore, cargo fetch) for a complete answer.
By default every declared package is read, including one your code never
imports. Add --cbom-deps-reachable to read only what your code can reach:
xgrep sbom --include sca,cbom --cbom-deps --cbom-deps-reachable .Each package is classified the way xgrep deps reachability classifies it.
A package that classification demotes is marked not-reached and not read:
- a direct dependency nothing imports;
- a dev dependency;
- a transitive dependency nothing imported requires.
Every other package is read, including one whose reachability cannot be
decided, because a package that may be used is still inventoried. Gems,
Composer and other ecosystems are not scanned; their packages are marked
unsupported-ecosystem.
In a Go module read from the module cache the filter also works per function. xgrep walks the source of your dependencies from every call your code makes into them, and drops a crypto occurrence when that walk proves no path reaches the function it sits in. An occurrence is dropped only on a complete answer: if the walk meets a module whose source is not on disk, a call it cannot follow (a call through a function value), a file it cannot parse, or its size limit, every occurrence is kept. Some occurrences are always kept:
- one in a method, which the standard library can call through an interface;
- one in a function taken as a value, or named by
//go:linkname,//exportor an assembly file, anywhere in your code or your Go dependencies, and anything such a function calls; - one in
init,mainor a package-level variable initializer; - one in a Go module read from
vendor/or a localreplacedirectory, and one in any other ecosystem: these are filtered per package only.
The package's xgrep:cbom:deps:unreached-occurrences property counts what was
dropped, and the summary on standard error says how many occurrences that was.
--cbom-scope dependency keeps only the dependency crypto. --cbom-deps
cannot be combined with --ref, or with a --cbom-scope other than all or
dependency.
Crypto libraries of a container image or root filesystem
Most of a container's crypto is its operating system's: the distro's OpenSSL,
GnuTLS or NSS. --include cbom of a container image (image://…, a
docker save tar or an OCI layout) or of an extracted root filesystem
directory reads the installed packages from the package database — dpkg
(including the per-package status.d of distroless images), apk or rpm — and
lists each crypto library and tool among them as a library component, with
the package's name, its distro version and its package URL
(pkg:deb/debian/libssl3@3.0.15-1~deb12u1?…, pkg:apk/alpine/libcrypto3@…).
Two properties say what it is: xgrep:cbom:os-library names the library
(libssl3 and Alpine's libcrypto3 are openssl) and
xgrep:cbom:os-library-kind is library for the library itself or tool
for a program built on one, such as the openssl command or OpenSSH.
xgrep sbom rootfs/ --include cbom
xgrep sbom app.tar --include sca,cbomA directory is read as a root filesystem when it holds an etc/os-release (or
usr/lib/os-release) and a package database at the path its package manager
writes it; a source tree with a file named status is not one. The scan of a
root filesystem is the same as of any directory, so its configuration files
(etc/ssl/openssl.cnf, etc/ssh/sshd_config), certificate and key files and
Go binaries are read too, and the CBOM has both what is installed and how it
is configured.
What a package lists is all that is reported:
- the package's algorithms are not listed. A distro build's algorithm set depends on its build options and patches, which the package database does not state;
- the version is the distro's own, backports included, and is not compared with the upstream project's releases;
- a package database that cannot be read, or reads as no packages, fails a root filesystem's run rather than reading as "no crypto libraries". For an image the failure is a warning, and the rest of the image's CBOM is kept;
- a symbolic link in a root filesystem that points out of the directory is refused, so the reader cannot be led to a file of the machine it runs on.
With --include sca,cbom the package is one component: the SBOM's, carrying
the two properties. A library package (not a tool) also provides the
assets the code makes with its API (see
Which library provides an asset): in a
root filesystem with Debian's libssl3, an EVP_sha256() call in a C program
is provided by libssl3.
Not covered:
- for a container image, the code scan still reads only the application
files, so the operating system's own configuration files (
/etc/ssl,/etc/ssh) are not read. Extract the image's filesystem and scan the directory to include them; - whether a FIPS provider is installed or enabled.
Checking against a policy
xgrep cbom check judges every algorithm in the inventory against a published
cryptographic policy. For each asset it reports what the policy says and cites
the clause:
xgrep cbom check . # NIST IR 8547 with SP 800-131A
xgrep cbom check --policy cnsa2 . # NSA CNSA 2.0
xgrep cbom check --policy bsi-tr-02102 . # BSI TR-02102
xgrep cbom check --policy etsi-ts-119-312 . # ETSI TS 119 312 (e-signatures)
xgrep cbom check --policy-file standard.yaml . # your own standard
xgrep cbom check --bom cbom.json # an inventory you already have| Policy | --policy | What it judges |
|---|---|---|
| NIST IR 8547 (PQC transition) with SP 800-131A | nist-ir-8547 | Quantum-vulnerable public-key algorithms are deprecated after 2030 at 112-bit security, and every one is disallowed after 2035. Algorithms SP 800-131A no longer approves (MD5, DES, 3DES, RC4, anything below 112 bits) are disallowed. SHA-1 is deprecated until its 2030 retirement; a signature over SHA-1 or MD5 is disallowed, while HMAC-SHA-1 and PBKDF2 with SHA-1 stay approved. |
| NIST SP 800-131A Rev. 2 | sp800-131a | The classical transitions alone, without the quantum timeline. A public-key algorithm of 112 bits or more is approved. |
| NSA CNSA 2.0 | cnsa2 | Approves only AES-256, SHA-384/512, ML-KEM-1024, ML-DSA-87, LMS and XMSS. RSA and DH of 3072 bits or more and ECDH/ECDSA on P-384 are deprecated for the transition, which completes by 2033. Everything else is disallowed. |
| BSI TR-02102-1/-2 | bsi-tr-02102 | Approves AES, SHA-2 of 256 bits or more, SHA-3, and ML-KEM-768/1024, ML-DSA-65/87, SLH-DSA, LMS and XMSS. RSA, DSA and DH of 3000 bits or more and elliptic curves of 250 bits or more are quantum-vulnerable; smaller ones, SHA-1, 3DES and the broken algorithms are disallowed. |
| ANSSI | anssi | Approves AES (128 bits or more), SHA-2 of 256 bits or more and SHA-3, and post-quantum schemes of security category 3 or higher, to be used in a hybrid with a classical scheme. 2048-bit RSA and DH are deprecated until 2030; 3072 bits or more, and curves of 256 bits or more, are quantum-vulnerable. |
| ETSI TS 119 312 V2.1.1 (e-signatures, eIDAS) | etsi-ts-119-312 | Signatures and hashes only. Approves SHA-256/384/512 and SHA3-256/384/512, ML-DSA, the 192- and 256-bit SLH-DSA sets, LMS and XMSS. SHA-224 is deprecated until 2028. RSA and DSA of 1900 to 3000 bits are deprecated until the end of 2026, and smaller ones are disallowed. RSA/DSA of 3000 bits or more, ECDSA on the Table 3 curves (NIST P-256/384/521, Brainpool, FRP256v1) and EdDSA are quantum-vulnerable. Any other curve, SHA-1 and MD5 are disallowed. Ciphers, MACs, KDFs, key agreement and TLS are outside it. |
TLS versions are judged too, when the inventory states one:
- NIST policies (SP 800-52 Rev. 2): TLS 1.2 and 1.3 are approved, and earlier versions are disallowed.
- CNSA 2.0: TLS 1.3 is approved and versions before TLS 1.2 are disallowed. The guidance does not address TLS 1.2, so it gets no verdict.
- BSI and ANSSI: TLS 1.2 and 1.3 are approved, and earlier versions are disallowed.
Certificates read from files are judged by their validity window, under every policy, at the time of the check:
- a certificate past its
notValidAfterisdisallowed; - one that expires within 30 days is
deprecateduntil its expiry date; - one not yet valid is
unknown; - the rest are
approved.
Their signature algorithms and keys are judged as algorithms. A custom policy
can set its own warning window with certificate-warning-days.
To keep the verdicts in the document itself, pass --cbom-policy <id> to
xgrep sbom --include cbom. Each asset then carries
xgrep:cbom:policy:<id>, …:until and …:clause properties.
Each asset gets one verdict:
approved;deprecated, with the year after which it is disallowed;disallowed;quantum-vulnerable, which the policy disallows after a set year;unknown.
An asset is unknown when the policy does not cover it (ChaCha20 under NIST),
or when the policy turns on a size or curve the inventory does not state (RSA
with no key size under CNSA 2.0). Such an asset is never approved.
Your own policy
An organisation's own crypto standard is a YAML file passed with
--policy-file. Rules match asset names with a regular expression; the first
match decides, and every rule cites the clause it rests on:
id: acme
title: ACME crypto standard 4.2
extends: nist-ir-8547 # optional: judges what no rule matches
rules:
- match: '^AES-128'
verdict: disallowed
clause: 'ACME-CS 2.1: AES keys are 256 bits'
- match: '^RSA'
min-strength: 128 # classical security bits
verdict: approved
clause: 'ACME-CS 4.2: RSA of 3072 bits or more'
tls: # optional
TLSv1.2: deprecated
certificate-warning-days: 60 # optional; 30 when unsetA rule with min-strength applies only to an asset of at least that strength,
and never to one whose strength the inventory does not state, so it cannot
approve one. It is a floor for approving, not a ceiling for disallowing: to
disallow weak RSA, approve ^RSA at min-strength: 128 and follow it with a
^RSA rule that disallows, which then catches everything the first did not.
Without extends, an asset no rule matches is unknown.
Migration priority
After the verdicts, cbom check ranks the quantum-vulnerable public-key assets
for migration:
- key establishment (key agreement, KEMs, public-key encryption), since traffic recorded today can be decrypted later;
- signatures;
- other public-key uses.
Within each tier, a long-lived key comes before an ephemeral one. A key is
long-lived when a key-management service holds it, or when it signs a
certificate valid for more than 398 days. 398 days is the longest a publicly
trusted TLS certificate may be valid, so such a certificate is a CA or a
private certificate meant to be trusted for years, and its signature has to
hold for that long. The reason line says until when the certificate is
trusted. A certificate read from a file names its signature algorithm in
signatureAlgorithmRef, which is how the check finds it.
The command exits 1 when an asset reaches the --fail-on verdict, so it can gate
CI:
disallowedis the default;deprecatedalso fails on deprecated assets;quantum-vulnerableandunknownwiden the gate further;neveronly reports.
Limits
A CBOM lists what the scanned files state. These are the things it does not see, or cannot decide, today. Most of them mean an asset is missing, or named less specifically than the code fixes it. Because of them, treat an asset's absence as "not detected", never as "not used".
Values decided outside the scanned files. An algorithm, size or curve
chosen at run time, passed in by a caller, read from the environment or a
deployment's configuration, or defined in a file the reader does not follow
names nothing. The asset is then reported without it (AES rather than
AES-256, HMAC rather than HMAC-SHA256), or not at all. The sections
above say which constants, configuration files, helpers and value sets are
followed. Some cases that look followable and are not:
- a shell variable or function another script defines;
- an Objective-C macro defined in a header, a prefix header or a
-Dbuild flag; - in Ansible, a
{{ variable }}that onlyvars/,group_vars/, a playbook or a caller sets (a role'sdefaults/are followed), a variable nested in a mapping, and a playbook's ownvars:; - the active Spring or Quarkus profile, which the scan cannot see.
Large source files. A source file over --max-target-bytes (1 MB by
default) is not read, so the crypto it calls is missing. A whole crypto library
has several such files: wolfSSL's asn.c and internal.c hold its RSA, ECDSA,
EdDSA, hash and TLS cipher calls. xgrep sbom lists the files it skipped for
their size after the run. Pass --max-target-bytes 0, or a larger limit, to
read them, at the cost of a slower scan.
Configuration templates. Every {% if %} branch of a Jinja2 template is
read, so a legacy setting behind a flag is listed beside the one deployed by
default. Such assets carry xgrep:cbom:conditional = template-branch; filter
on it to set them aside.
Compiled code. Java archives, Python wheels and Go executables (ELF and
Mach-O) are read. .NET assemblies (including those inside a .nupkg),
Android DEX code (.apk, .aar), Windows (PE) executables, and native
binaries built from C, C++ or Rust are not. A Java archive gives fewer assets
than its source: only the factory calls, Bouncy Castle classes and key specs
listed under Compiled artifacts. Scan the source when
you have it.
Code xgrep does not read. JavaScript inside an HTML <script> element,
Objective-C++ (.mm), and languages without a pack (see
Supported languages). A PEM key or certificate
written into a string is read only in the languages listed under
Key and certificate files, so one in a Lua, Perl,
R, Julia or Objective-C string is not listed. A file that the scan cannot
finish within its per-file time limit (60 seconds) is skipped, so its assets
are missing.
Gaps in particular packs:
- Python: in a file that imports a module and also a class from it by name
(
from cryptography.hazmat.primitives.ciphers import algorithmsandfrom cryptography.hazmat.primitives.ciphers.algorithms import ChaCha20), only the qualified calls (algorithms.AES(key)) are read, and the bareChaCha20(key, nonce)is missed. Use one import style per module in a file. - JavaScript and TypeScript: several hash names written in one array on
one line (
['sha256', 'sha512'], including one read with.includes()) list only one of them at that line. When the array guards a crypto call, every member is still reported at the call. - C#: the
SecurityAlgorithmsconstants of Microsoft.IdentityModel (SecurityAlgorithms.RsaSha256) are not read; a JOSE name written as a string is. - Dart: a JWK written as a map literal (
{'kty': 'EC', 'crv': 'P-256'}) is not listed. Only aktycompared with'RSA'is read. - OCaml: an opened module (
open Mirage_crypto,open Cryptokit) or a module alias (module H = Digestif.SHA256) is not followed. Calls written with the full module path are read. - Perl: CryptX's stream ciphers (
Crypt::Stream::*) and its OMAC, PMAC and XCBC MACs are not read. - PowerShell: a .NET type name written in another case than .NET's own
(
[system.security.cryptography.aes]) is not matched, and a key size set as a property ($aes.KeySize = 256) is not read, so the algorithm stays unsized. - Objective-C: a
kCCKeySize*constant does not size the cipher, soCCCryptwithkCCKeySizeAES256isAES-CBC, notAES-256-CBC; a public key thatSecKeyCreateWithDatabuilds is not listed. - WireGuard: a WireGuard configuration file is read, and WireGuard used
from code (Go's
wgtypes, wireguard-go) is not.
Terraform TLS policies. A load balancer policy published after the table
built into xgrep, such as ELBSecurityPolicy-TLS13-1-2-FIPS-2023-04, names
only TLS, without its versions or cipher suites.
Dependencies. --cbom-deps reads only source that is already on disk, and
only for Go, npm, PyPI, Maven (the -sources.jar), NuGet and crates.io: a
gem, a Composer package or another ecosystem is marked unsupported-ecosystem,
and a Maven binary jar is not decompiled. --cbom-deps-reachable drops an
occurrence by function only in a Go module read from the module cache;
everywhere else it keeps or drops whole packages. See
Crypto in dependency source.
Container images. The installed crypto libraries are listed, not the
algorithms each one provides, and an image's own configuration files (/etc/ssl,
/etc/ssh) are read only when the image's filesystem is extracted and scanned
as a directory. Whether a FIPS provider is installed or enabled is not
reported. See
Crypto libraries of a container image or root filesystem.
Policies. The NIST policies follow SP 800-131A Rev. 2. Rev. 3 is still a draft, and is applied once NIST publishes it final.
Consuming the CBOM
Write the document to a file and hand it to any CycloneDX-aware tool:
xgrep sbom --include cbom -o cbom.json .For example, load it into a CBOM viewer, diff it across releases to track crypto
drift, or feed it to PQC-readiness tooling that flags every
nistQuantumSecurityLevel: 0 asset.
Last updated on
Output formats
xgrep emits human-readable text, Semgrep-compatible JSON, SARIF 2.1.0, a GitLab SAST report, or a CycloneDX 1.6 CBOM.
AI risk
xgrep's AI risk rules trace untrusted data into and out of LLM calls — request input reaching a system prompt, model output reaching SQL, HTML, code execution or a deserializer, model-chosen tool arguments reaching a shell, SQL, files or the network, unpinned and pickled models, and risky MCP server configuration — mapped to the OWASP Top 10 for LLM Applications.