Source Code Discovery
Source-code cryptographic discovery is the systematic examination of application source and related development artifacts to identify where cryptographic APIs, algorithms, libraries, protocols, key-handling operations, and security-relevant parameters are declared or used. It is broader than searching for algorithm names or strings: effective discovery combines static analysis with language-aware parsing, dependency and configuration review, infrastructure-as-code and build-file analysis, and targeted pattern matching. The resulting findings should be correlated with repository, build, dependency, and runtime evidence because source analysis can miss embedded or generated cryptography and can report code that is unreachable or not used in a deployed product.12345
- Source-code discovery identifies cryptographic use and context; it is not merely a text search.
- Analyze application code together with dependencies, configuration, build files, infrastructure as code, and relevant pipeline definitions.
- Record APIs, algorithms, libraries, protocols, parameters, key-handling paths, locations, and provenance rather than only a match count.
- Generated code, wrappers, framework abstractions, embedded implementations, and incomplete repository coverage can hide cryptography.
- Validate findings against build artifacts, dependency and SBOM information, and runtime or network evidence; classify false positives and unreachable code explicitly.
What source-code cryptographic discovery means
Source-code cryptographic discovery is an evidence-gathering activity for building a cryptographic inventory. It examines human-readable source and the artifacts that determine how that source becomes a deployed system. The objective is to establish what cryptographic functionality exists, where it is invoked, which component supplies it, what data or communications it protects, and which parameters or key-material paths affect its behavior. This supports migration planning, risk assessment, and comparison with other inventories rather than acting as a standalone security verdict. Evidence on cryptographic migration identifies discovery and documentation of systems, applications, protocols, infrastructure, and usage elements as an initial planning activity. []1
The scope should include direct cryptographic calls and higher-level uses such as TLS, certificates, signatures, key establishment, encryption, hashing, random-number generation, and key storage or distribution. A protocol may expose negotiated algorithms and parameters even when application code does not implement the primitive itself. For example, TLS 1.3 separates a handshake that authenticates parties, negotiates cryptographic modes and parameters, and establishes shared keying material from a record protocol that protects traffic with the resulting keys. Certificate structures likewise identify signature algorithms and optional parameters. []23
A layered discovery method
No single detector is sufficient. Begin with repository-wide collection and coverage recording: identify repositories, branches or revisions, languages, generated directories, vendored code, build products, submodules, configuration stores, pipeline definitions, and infrastructure repositories in scope. Declarative infrastructure, policy, and observability code is managed similarly to application source: it is versioned, documented, and access-controlled, while associated tools convert declarations into runtime artifacts or manifests. Consequently, the inventory boundary should include more than the principal application repository.4
- Use language-aware parsing and static analysis to identify calls, imports, types, data flows, and control-flow context. A discovery report can include cryptographic calls, important parameters, call-line numbers, and metadata; the NIST preliminary-draft example describes configurable rules and source selection for this purpose.
- Review dependencies, package manifests, lock files, module declarations, vendored libraries, frameworks, middleware, and generated dependency metadata. Secure-development guidance specifically emphasizes acquiring and evaluating third-party components and obtaining provenance such as SBOM or source and binary composition information.
- Inspect configuration and build files for cipher suites, protocol versions, certificate settings, key stores, providers, feature flags, compiler options, linking directives, and environment-specific overrides. Build and pipeline definitions matter because they determine which source is compiled, which libraries are linked, and which configuration reaches deployment.
- Analyze infrastructure as code and related declarative artifacts. IaC may use scripting languages or proprietary configuration languages and can provision compute, containers, storage, networks, connections, and load balancers; it may also be ephemeral. []
- Apply targeted pattern matching as a complementary technique for names, identifiers, algorithm labels, provider names, protocol strings, key-file references, and known API families. Treat matches as leads requiring context, not as proof of use or completeness. []
What a useful finding records
A useful record connects a technical observation to an inventory object. At minimum, retain the repository and revision, file and line or symbol, language, component, detector or rule, matched API or construct, inferred algorithm or protocol, parameters, dependency and version, configuration source, and confidence. Where possible, record the purpose and path: encryption of stored data, protection of network traffic, signing, verification, key establishment, certificate processing, random generation, or key storage and distribution. The discovery examples cited above show the practical value of reporting calls, parameters, line numbers, and metadata rather than only reporting that a file contains a cryptographic term.16
Key-handling paths deserve separate treatment. Keying material can include keys, initialization vectors, and domain parameters; before use, assurance is required that the material has the appropriate format and came from an authorized source. Integrity protection can include error-detection codes, message authentication codes, or digital signatures. A source review should therefore trace acquisition, derivation, storage, distribution, loading, use, rotation, and disposal where those paths are visible, while clearly marking steps implemented outside the repository. []7
Protocol and certificate findings should preserve negotiated or encoded parameters instead of collapsing them into a generic label. TLS handshakes produce session keys, cryptographic parameters, and communicating-party identities; certificate AlgorithmIdentifier structures identify an algorithm and may carry parameters. These details can distinguish a protocol configuration issue from an application API use and can help correlate source findings with network or certificate evidence.23
| Field | What to capture | Why it matters | Typical validation |
|---|---|---|---|
| Scope and revision | Repository, branch or revision, language, environment, included and excluded artifacts | Defines what the result does and does not cover | Compare with repository and deployment inventory |
| Location and construct | File, line or symbol, API, import, type, rule, or data-flow path | Makes the observation reproducible and reviewable | Resolve symbols and inspect surrounding control flow |
| Cryptographic context | Algorithm, protocol, library, provider, parameters, purpose, and key-handling stage | Distinguishes a meaningful inventory object from a generic match | Compare with configuration, certificate, or protocol evidence |
| Dependency and provenance | Direct and transitive package, version, native component, SBOM or vendor information | Identifies implementation ownership and embedded or external risk | Compare SBOM, lock files, build graph, and binary analysis |
| Execution status | Observed, inferred, unreachable, disabled, unresolved, or validated; confidence and rationale | Prevents false positives from being treated as active use | Compare feature flags, build outputs, tests, and runtime evidence |
| Validation evidence | Build target, generated output, runtime observation, network or certificate evidence, review date | Shows whether source intent matches deployed behavior | Reconcile source, build, binary, and runtime inventories |
Coverage, false positives, and uncertainty
A source match is not equivalent to an executed operation. Examples include documentation, tests, dead or unreachable branches, disabled features, compatibility code, examples, comments, unused imports, and identifiers that resemble cryptographic names. Conversely, the absence of a match is not proof that cryptography is absent. Wrappers, framework abstractions, generated code, reflection, dynamic loading, macros, foreign-function interfaces, compiler transformations, and provider-selected implementations can hide the operation or move it outside the analyzed source. Findings should therefore be classified as observed, inferred, unresolved, excluded, or validated, with the reason and supporting evidence retained.85
Embedded cryptography is a documented limitation of discovery tooling: tools may not identify cryptography used internally within products, which can hinder discoverability and documentation. Organizations are advised to ask vendors for lists of embedded cryptography. This limitation applies especially to proprietary libraries, appliances, firmware, container base images, managed services, and other components represented in source only by an interface or package reference. [7]5
Repository coverage must be stated explicitly. A result from one branch, service, language, or build target cannot automatically be generalized to the whole organization. Ephemeral infrastructure and environment-specific manifests can also change the effective deployment shape. Record excluded repositories, unavailable generated sources, unsupported languages, inaccessible dependencies, and the date or revision analyzed. This preserves the distinction between ‘not found in the analyzed scope’ and ‘not present.’4
False-positive reduction should be evidence-based: resolve symbols and imports; follow call and data-flow context; inspect whether a dependency is linked or loaded; compare configuration with the selected build target; and verify whether a path is reachable in the deployed feature set. Do not silently delete uncertain results. Retain them with a disposition, rationale, reviewer, and any follow-up needed. Static and dynamic analysis are complementary in software vetting, and human-readable code review, executable-code testing, and third-party component review provide different evidence.89
Validate against build, dependency, and runtime evidence
Validation is the step that turns a source report into a defensible inventory entry. First compare findings with the actual build graph: source files selected, generated files produced, compiler and linker inputs, resolved package versions, native libraries, feature flags, and deployment configuration. CI/CD pipelines should connect repositories, automated builds, security testing, and deployment or runtime tools; the build process generates executables, while static and dynamic testing provide different views of the result.410
Next correlate dependency and provenance evidence. SBOM data can be checked for source, alteration, accuracy, coverage, and completeness; binary analysis may detect components absent from an SBOM. This is particularly important when source code uses a wrapper or framework while the cryptographic implementation is cited by a transitive, native, generated, container, or externally managed component. Record discrepancies rather than choosing the most convenient inventory.106
Finally compare source-derived expectations with runtime and network evidence. Runtime observations can show which services, algorithms, keys, certificates, and protocols are active, while source and build analysis can explain how those choices arise. The NIST preliminary-draft material describes separate facilities for static source analysis, environment snapshots, and reporting cryptographic attributes of TLS/SSL, SSH, and IPsec connections. A mismatch may indicate conditional configuration, an inactive path, a missing artifact, an embedded implementation, or incomplete observation; it should trigger investigation, not automatic correction. []1
Using the results in a cryptographic inventory
A mature inventory links each source finding to an owner, application or asset, component, data or communication purpose, algorithm and parameter set, key-management path, dependency provenance, deployment environment, criticality, confidence, and evidence date. It should also identify where the cryptography protects sensitive or critical datasets and estimate the required protection period when migration risk is being assessed. Inventory correlation with asset, identity, credential, access-management, endpoint, and continuous-diagnostics programs can expose systems and protocols that source analysis alone cannot connect.51
Repeat discovery as code and dependencies change. Changes to libraries, operating systems, hardware acceleration, protocols, configuration, and administrative procedures can all affect an algorithm replacement or migration effort. The inventory should preserve historical revisions and show whether a finding was removed, replaced, reclassified, or merely no longer visible in the analyzed source. This makes discovery useful for crypto-agility and migration planning without implying that source analysis alone determines the correct replacement algorithm or implementation.51
Conclusion
Source-code discovery is a layered investigation of cryptographic use across source, dependencies, configuration, build definitions, and infrastructure as code. Static analysis, parsing, targeted patterns, provenance review, and dependency analysis reveal different parts of the picture. Because wrappers, generated and unreachable code, embedded implementations, dynamic behavior, and incomplete repository coverage create both false positives and false negatives, every result should carry scope, confidence, provenance, and validation status. Correlating findings with build, SBOM, binary, network, and runtime evidence produces a more reliable cryptographic inventory for security assessment and migration planning.485101
Frequently asked questions
Is source-code discovery the same as searching for algorithm names?
No. Targeted pattern matching is useful for finding known names and identifiers, but complete discovery requires language-aware analysis, dependency and configuration review, infrastructure-as-code and build analysis, and validation. A string can be unused or misleading, while an abstraction or embedded implementation can conceal active cryptography.158
Should generated code and build files be included?
Yes. Generated code can contain the effective implementation, and build files determine which source, generated artifacts, libraries, and configuration are compiled or linked. Record whether generated inputs were available and compare the source report with the actual build graph.410
How should an uncertain finding be handled?
Keep it with an explicit status and rationale. Resolve symbols and data flow, check reachability and configuration, inspect dependency and build evidence, and compare with runtime or network observations. Classify the result as observed, inferred, unresolved, excluded, or validated rather than silently discarding it.891
Can source analysis find cryptography inside a commercial product or embedded component?
Not reliably. Discovery tools may not identify embedded cryptography used internally within products. Organizations should request vendor-provided information and correlate it with binary, dependency, runtime, and network evidence. 75106
Sources
- 1Migration to Post-Quantum Cryptography: Quantum Readiness: Cryptographic Discovery
National Institute of Standards and Technology · preliminary draft · NIST SP 1800-38B Preliminary Draft
Accessed July 24, 2026 - 2The Transport Layer Security (TLS) Protocol Version 1.3
Internet Engineering Task Force · proposed standard · RFC 8446
Accessed July 24, 2026 - 3Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile
Internet Engineering Task Force · proposed standard · RFC 5280
Accessed July 24, 2026 - 4Implementation of DevSecOps for a Microservices-based Application with Service Mesh
National Institute of Standards and Technology · final · NIST SP 800-204C
Accessed July 24, 2026 - 5Quantum-Readiness: Migration to Post-Quantum Cryptography
CISA, NSA, and NIST · final · Joint Quantum-Readiness Fact Sheet
Accessed July 24, 2026 - 6Secure Software Development Framework (SSDF) Version 1.1
National Institute of Standards and Technology · final · NIST SP 800-218
Accessed July 24, 2026 - 7Recommendation for Key Management: Part 1 – General
National Institute of Standards and Technology · final · NIST SP 800-57 Part 1 Rev. 5
Accessed July 24, 2026 - 8Vetting the Security of Mobile Applications
National Institute of Standards and Technology · final · NIST SP 800-163 Rev. 1
Accessed July 24, 2026 - 9Foundational Cybersecurity Activities for IoT Product Manufacturers
National Institute of Standards and Technology · final · NIST IR 8259 Rev. 1
Accessed July 24, 2026 - 10Minimum Elements for a Software Bill of Materials (SBOM)
Cybersecurity and Infrastructure Security Agency · final · CISA SBOM Minimum Elements 2025
Accessed July 24, 2026