feat(crypto): CBOM model metadata#1016
Open
qkaiser wants to merge 7 commits into
Open
Conversation
Certificate serial numbers are needed to identify issued certificates unambiguously in CycloneDX 1.7 CBOMs. Gate the value to the 1.7 serialization view, place it in schema order for XML, and include it in deterministic comparison and round-trip coverage. Refs: CycloneDX 1.7 `cryptoProperties.certificateProperties.serialNumber`. Signed-off-by: Quentin Kaiser <quentin.kaiser@onekey.com>
Consumers need the preferred CycloneDX 1.7 representation while older documents still rely on the deprecated certificate extension field. Store and serialize both values independently, gate the preferred value to 1.7, and retain the legacy value during downgrade and round-trip operations. Refs: CycloneDX 1.7 `cryptoProperties.certificateProperties.certificateFileExtension`. Signed-off-by: Quentin Kaiser <quentin.kaiser@onekey.com>
CBOM consumers need stable digests for certificates and related cryptographic material without conflating those digests with signatures. Reuse the existing hash model for JSON and XML mappings, gate both properties to 1.7, and include them in deterministic comparison and schema-valid round trips. Refs: CycloneDX 1.7 certificate and related-material `fingerprint` properties. Signed-off-by: Quentin Kaiser <quentin.kaiser@onekey.com>
Certificate inventories need machine-readable lifecycle status while still permitting organization-specific states. Model predefined and custom variants as a discriminated union, store them deterministically, and select the concrete variant from its JSON or XML shape during deserialization. Refs: CycloneDX 1.7 `cryptoProperties.certificateProperties.certificateState`. Signed-off-by: Quentin Kaiser <quentin.kaiser@onekey.com>
Certificate lifecycle analysis depends on distinct issuance, operation, retirement, and destruction events rather than validity bounds alone. Map each timestamp through the existing date-time serializer, gate them to 1.7, preserve schema ordering, and include them in equality, hashing, and round-trip coverage. Refs: CycloneDX 1.7 certificate lifecycle date properties. Signed-off-by: Quentin Kaiser <quentin.kaiser@onekey.com>
X.509 inventories need standardized extension names and vendor-defined extensions without collapsing their distinct shapes into unstructured strings. Model common and custom variants as a discriminated union, derive common names from the 1.7 schema, and preserve concrete variants across deterministic JSON and XML round trips. Refs: CycloneDX 1.7 `cryptoProperties.certificateProperties.certificateExtensions`. Signed-off-by: Quentin Kaiser <quentin.kaiser@onekey.com>
Deprecated direct references cannot describe all relationships between certificates, related material, algorithms, and keys. Use reusable typed references in deterministic collections, gate them to 1.7, and retain every deprecated reference unchanged for compatibility with existing 1.6 and 1.7 consumers. Refs: CycloneDX 1.7 `relatedCryptographicAssets`. Signed-off-by: Quentin Kaiser <quentin.kaiser@onekey.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 123 |
| Duplication | 6 |
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.
Documentation build overview
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This branch expands the cryptographic asset model with CycloneDX 1.7 certificate metadata. Certificates can now include serial numbers, preferred file extensions, fingerprints, lifecycle dates, predefined or custom lifecycle states, and standardized or custom X.509 extensions. Related cryptographic material also gains fingerprints, while both certificates and related material can express typed relationships to other cryptographic assets such as algorithms and public keys.
All new fields are version-gated to CycloneDX 1.7 and support deterministic comparison, hashing, and JSON/XML round-tripping. Existing CycloneDX 1.6 fields (including deprecated certificate extensions and direct asset references) remain intact for backward compatibility, with expanded schema-validation, enum, snapshot, and serialization tests covering the new behavior.
AI Tool Disclosure
codexcodex-5.6-sol xhighLLM prompt
RelatedCryptographicAsset(type, ref)andrelated_cryptographic_assetscollections to certificate, related-material, and protocol properties.CertificatePropertieswith:serial_number,certificate_file_extension, andfingerprint: HashType.certificate_states, usingCertificateLifecycleState,CertificatePredefinedState, andCertificateCustomState.certificate_extensions, using common/custom extension models and a schema-backed common-extension-name enum.RelatedCryptoMaterialPropertieswithfingerprintandrelated_cryptographic_assets.signature_algorithm_ref,subject_public_key_ref,certificate_extension,algorithm_ref, andcrypto_refsoperational for both 1.6 and 1.7.Serialization behavior
SchemaVersion1Dot7, with exact CycloneDX JSON names, XML element names, ordering, nested arrays, and date/hash mappings.Test plan
key-wrap, and protocol types.Assumptions
SortedSetstorage.Affirmation