Skip to content

feat(crypto): support standardized algorithm identifiers#1015

Open
qkaiser wants to merge 1 commit into
CycloneDX:mainfrom
qkaiser:cbom-standardized-crypto-identifiers
Open

feat(crypto): support standardized algorithm identifiers#1015
qkaiser wants to merge 1 commit into
CycloneDX:mainfrom
qkaiser:cbom-standardized-crypto-identifiers

Conversation

@qkaiser

@qkaiser qkaiser commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

CycloneDX 1.7 distinguishes schema-defined families and curves while older consumers still depend on free-form curve metadata.

Derive the accepted cases from the bundled schema and gate standardized serialization to the new view. Preserve the legacy value through comparison and rendering, then exercise strict schema output and downgrade behavior.

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: codex
    • LLMs and versions: gpt-5.6-sol xhigh
    • Prompts: see below
LLM prompt
## Complete CycloneDX 1.7 cryptography models

Summary

Extend cyclonedx.model.crypto to model and round-trip every requested CycloneDX 1.7 CBOM field in JSON and XML. Preserve all existing 1.6 APIs and deprecated reference fields; the already-implemented key-wrap primitive and 1.7 protocol types require verification rather than duplication.

Public API and model changes

  • Add schema-backed CryptoAlgorithmFamily and CryptoEllipticCurve enums. Extend AlgorithmProperties with algorithm_family and elliptic_curve, emitted only for 1.7; retain deprecated curve.

Serialization behavior

  • Gate new fields and structured models to SchemaVersion1Dot7, with exact CycloneDX JSON names, XML element names, ordering, nested arrays, and date/hash mappings.
  • Add union serialization helpers for certificate states and extensions so JSON and XML deserialize into the correct predefined/custom model.
  • Include every new property in comparison, hashing, sorting, and representation behavior where applicable.

Test plan

  • Add enum completeness tests against the bundled 1.7 schemas, including algorithm families, elliptic curves, certificate states/extensions, key-wrap, and protocol types.
  • Add model tests for construction, equality, hashing, sorting, union discrimination, and mixed-IKEv2 rejection.
  • Expand representative crypto BOM fixtures and JSON/XML snapshots with every new field.
  • Validate 1.7 output against strict bundled schemas and test JSON/XML round-trip deserialization.
  • Verify 1.6 output remains schema-valid, retains legacy fields, omits 1.7-only fields, and preserves protocol-type downgrade behavior.
  • Run the full unittest suite plus mypy and flake8.

Assumptions

  • Existing deprecated CycloneDX fields are not removed or automatically translated into preferred 1.7 relationships.
  • Schema arrays follow the library convention of deterministic SortedSet storage.

Affirmation

@qkaiser qkaiser requested a review from a team as a code owner July 14, 2026 09:22
@read-the-docs-community

read-the-docs-community Bot commented Jul 14, 2026

Copy link
Copy Markdown

Documentation build overview

📚 CycloneDX Python Library | 🛠️ Build #33579738 | 📁 Comparing fd0ec25 against latest (cf392e0)

  🔍 Preview build  

2 files changed
± genindex.html
± autoapi/cyclonedx/model/crypto/index.html

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity · 0 duplication

Metric Results
Complexity 5
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

CycloneDX 1.7 distinguishes schema-defined families and curves while
older consumers still depend on free-form curve metadata.

Derive the accepted cases from the bundled schema and gate standardized
serialization to the new view. Preserve the legacy value through
comparison and rendering, then exercise strict schema output and
downgrade behavior.

Signed-off-by: Quentin Kaiser <quentin.kaiser@onekey.com>
@qkaiser qkaiser force-pushed the cbom-standardized-crypto-identifiers branch from 3883f08 to fd0ec25 Compare July 14, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant