From 500f3cf46ffcb730c3b04a0ac5a4cb8f8291559b Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 11:27:38 +0200 Subject: [PATCH 01/41] tests: test all the enums. Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 59 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 1d749d637..2af4efdd6 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -14,13 +14,14 @@ # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) OWASP Foundation. All Rights Reserved. - - +import ast +from os import path +from glob import glob from collections.abc import Generator, Iterable from enum import Enum from itertools import chain from json import load as json_load -from typing import Any +from typing import Any, Optional from unittest import TestCase from warnings import warn from xml.etree.ElementTree import parse as xml_parse # nosec B405 @@ -508,3 +509,55 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, distribution_constraints=DistributionConstraints(tlp=TlpClassification.CLEAR) )) super()._test_cases_render(bom, of, sv) + + +# add new test cases above this line + +@ddt +class TestCaseCompleteness(TestCase): + """ + Test that all defined enum models are covered by a test case in here. + """ + + __TestCasePrefix = 'TestEnum' + + __defined_enumcases: Optional[tuple[str, ...]] = None + + @classmethod + def __get_defined_enumcases(cls) -> tuple[str, ...]: + if cls.__defined_enumcases is None: + cls.__defined_enumcases = tuple( + name for name, obj + in globals().items() + if isinstance(obj, type) + and obj.__module__ + and obj.__module__ == __name__ + and issubclass(obj, _EnumTestCase) + and not obj is _EnumTestCase + ) + return cls.__defined_enumcases + + @staticmethod + def __get_defined_model_enums(): + models_path = path.join(path.dirname(__file__), '..', 'cyclonedx', 'model') + model_files = glob(path.join('**', '*.py'), root_dir=models_path, recursive=True) + for model_file in model_files: + with open(path.join(models_path, model_file), 'r', encoding='utf-8') as f: + tree = ast.parse(f.read(), filename=model_file) + for node in ast.walk(tree): + if isinstance(node, ast.ClassDef): + for base in node.bases: + # Case 1: direct name: "Enum" + if isinstance(base, ast.Name) and base.id == 'Enum': + yield node.name + break + # Case 2: qualified name: "enum.Enum" + if isinstance(base, ast.Attribute) and base.attr == 'Enum': + yield node.name + break + + @idata(__get_defined_model_enums()) + def test_case_exists(self, enum_name) -> None: + self.assertIn(f'{self.__TestCasePrefix}{enum_name}', + self.__get_defined_enumcases(), + f'Missing Test Case for Enum: {enum_name}') From 06f34c5232a86ace204ce6e8a67b2413e98838a3 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 11:30:40 +0200 Subject: [PATCH 02/41] tests: test all the enums. Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_enums.py b/tests/test_enums.py index 2af4efdd6..53006f4d4 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -510,6 +510,23 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, )) super()._test_cases_render(bom, of, sv) +""" +missing: +- LicenseAcknowledgement +- CryptoAssetType +- CryptoPrimitive +- CryptoExecutionEnvironment +- CryptoImplementationPlatform +- CryptoCertificationLevel +- CryptoMode +- CryptoPadding +- CryptoFunction +- RelatedCryptoMaterialType +- RelatedCryptoMaterialState +- ProtocolPropertiesType +- IdentityField +- AnalysisTechnique +""" # add new test cases above this line From 5efa4609c38efdc8be2325e49eb654006b0a2336 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 12:40:16 +0200 Subject: [PATCH 03/41] tests: LicenseAcknowledgement Signed-off-by: Jan Kowalleck --- tests/__init__.py | 2 +- .../enum_LicenseAcknowledgement-1.0.xml.bin | 10 ++++ .../enum_LicenseAcknowledgement-1.1.xml.bin | 17 +++++++ .../enum_LicenseAcknowledgement-1.2.json.bin | 35 ++++++++++++++ .../enum_LicenseAcknowledgement-1.2.xml.bin | 23 ++++++++++ .../enum_LicenseAcknowledgement-1.3.json.bin | 35 ++++++++++++++ .../enum_LicenseAcknowledgement-1.3.xml.bin | 23 ++++++++++ .../enum_LicenseAcknowledgement-1.4.json.bin | 34 ++++++++++++++ .../enum_LicenseAcknowledgement-1.4.xml.bin | 22 +++++++++ .../enum_LicenseAcknowledgement-1.5.json.bin | 44 ++++++++++++++++++ .../enum_LicenseAcknowledgement-1.5.xml.bin | 26 +++++++++++ .../enum_LicenseAcknowledgement-1.6.json.bin | 46 +++++++++++++++++++ .../enum_LicenseAcknowledgement-1.6.xml.bin | 26 +++++++++++ .../enum_LicenseAcknowledgement-1.7.json.bin | 46 +++++++++++++++++++ .../enum_LicenseAcknowledgement-1.7.xml.bin | 26 +++++++++++ tests/test_enums.py | 23 ++++++++++ 16 files changed, 437 insertions(+), 1 deletion(-) create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.0.xml.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.1.xml.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.json.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.xml.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.json.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.xml.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.json.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.xml.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.json.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.xml.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.xml.bin diff --git a/tests/__init__.py b/tests/__init__.py index 772ffcdd7..585b8649f 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -40,7 +40,7 @@ OWN_DATA_DIRECTORY = path.join(_TESTDATA_DIRECTORY, 'own') SNAPSHOTS_DIRECTORY = path.join(_TESTDATA_DIRECTORY, 'snapshots') -RECREATE_SNAPSHOTS = '1' == getenv('CDX_TEST_RECREATE_SNAPSHOTS') +RECREATE_SNAPSHOTS = True or '1' == getenv('CDX_TEST_RECREATE_SNAPSHOTS') if RECREATE_SNAPSHOTS: print('!!! WILL RECREATE ALL SNAPSHOTS !!!') diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.0.xml.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.0.xml.bin new file mode 100644 index 000000000..068b881e8 --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.0.xml.bin @@ -0,0 +1,10 @@ + + + + + dummy + + false + + + diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.1.xml.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.1.xml.bin new file mode 100644 index 000000000..286f4b440 --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.1.xml.bin @@ -0,0 +1,17 @@ + + + + + dummy + + + + LicenseAcknowledgement: CONCLUDED + + + LicenseAcknowledgement: DECLARED + + + + + diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.json.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.json.bin new file mode 100644 index 000000000..ad73237ba --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.json.bin @@ -0,0 +1,35 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "licenses": [ + { + "license": { + "name": "LicenseAcknowledgement: CONCLUDED" + } + }, + { + "license": { + "name": "LicenseAcknowledgement: DECLARED" + } + } + ], + "name": "dummy", + "type": "library", + "version": "" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.2b.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.2" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.xml.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.xml.bin new file mode 100644 index 000000000..a194bbc4e --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.xml.bin @@ -0,0 +1,23 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + + LicenseAcknowledgement: CONCLUDED + + + LicenseAcknowledgement: DECLARED + + + + + + + + diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.json.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.json.bin new file mode 100644 index 000000000..b10b2d7aa --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.json.bin @@ -0,0 +1,35 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "licenses": [ + { + "license": { + "name": "LicenseAcknowledgement: CONCLUDED" + } + }, + { + "license": { + "name": "LicenseAcknowledgement: DECLARED" + } + } + ], + "name": "dummy", + "type": "library", + "version": "" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.3a.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.3" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.xml.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.xml.bin new file mode 100644 index 000000000..5c050d8ad --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.xml.bin @@ -0,0 +1,23 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + + LicenseAcknowledgement: CONCLUDED + + + LicenseAcknowledgement: DECLARED + + + + + + + + diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.json.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.json.bin new file mode 100644 index 000000000..169eaebb5 --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.json.bin @@ -0,0 +1,34 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "licenses": [ + { + "license": { + "name": "LicenseAcknowledgement: CONCLUDED" + } + }, + { + "license": { + "name": "LicenseAcknowledgement: DECLARED" + } + } + ], + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.4" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.xml.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.xml.bin new file mode 100644 index 000000000..41371698a --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.xml.bin @@ -0,0 +1,22 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + LicenseAcknowledgement: CONCLUDED + + + LicenseAcknowledgement: DECLARED + + + + + + + + diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.json.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.json.bin new file mode 100644 index 000000000..b0ff6171e --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.json.bin @@ -0,0 +1,44 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "licenses": [ + { + "license": { + "name": "LicenseAcknowledgement: CONCLUDED" + } + }, + { + "license": { + "name": "LicenseAcknowledgement: DECLARED" + } + } + ], + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.5" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.xml.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.xml.bin new file mode 100644 index 000000000..64bc51065 --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.xml.bin @@ -0,0 +1,26 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + LicenseAcknowledgement: CONCLUDED + + + LicenseAcknowledgement: DECLARED + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.json.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.json.bin new file mode 100644 index 000000000..3fa3c9274 --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.json.bin @@ -0,0 +1,46 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "licenses": [ + { + "license": { + "acknowledgement": "concluded", + "name": "LicenseAcknowledgement: CONCLUDED" + } + }, + { + "license": { + "acknowledgement": "declared", + "name": "LicenseAcknowledgement: DECLARED" + } + } + ], + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.xml.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.xml.bin new file mode 100644 index 000000000..7a92ab4f5 --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.xml.bin @@ -0,0 +1,26 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + LicenseAcknowledgement: CONCLUDED + + + LicenseAcknowledgement: DECLARED + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.json.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.json.bin new file mode 100644 index 000000000..2e9aee738 --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.json.bin @@ -0,0 +1,46 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "licenses": [ + { + "license": { + "acknowledgement": "concluded", + "name": "LicenseAcknowledgement: CONCLUDED" + } + }, + { + "license": { + "acknowledgement": "declared", + "name": "LicenseAcknowledgement: DECLARED" + } + } + ], + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.xml.bin b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.xml.bin new file mode 100644 index 000000000..373ffa7ba --- /dev/null +++ b/tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.xml.bin @@ -0,0 +1,26 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + LicenseAcknowledgement: CONCLUDED + + + LicenseAcknowledgement: DECLARED + + + + + + + + + val1 + val2 + + diff --git a/tests/test_enums.py b/tests/test_enums.py index 53006f4d4..ecb22244d 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -73,6 +73,9 @@ from cyclonedx.model.issue import ( # isort:skip IssueClassification, ) +from cyclonedx.model.license import ( # isort:skip + LicenseAcknowledgement +) from cyclonedx.model.vulnerability import ( # isort:skip VulnerabilityScoreSource, VulnerabilitySeverity, @@ -510,6 +513,26 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, )) super()._test_cases_render(bom, of, sv) + +@ddt +class TestEnumLicenseAcknowledgement(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='licenseAcknowledgementEnumerationType']"), + dp_cases_from_json_schemas('definitions', 'licenseAcknowledgementEnumeration'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(LicenseAcknowledgement, value) + + @named_data(*NAMED_OF_SV) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom(components=[Component(name='dummy', type=ComponentType.LIBRARY, bom_ref='dummy', licenses=( + DisjunctiveLicense(name=f'LicenseAcknowledgement: {la.name}', + acknowledgement=la, + ) for la in LicenseAcknowledgement + ))]) + super()._test_cases_render(bom, of, sv) + """ missing: - LicenseAcknowledgement From 8ddc37f66fe1632ec22e1366200234f25608aec4 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 12:57:15 +0200 Subject: [PATCH 04/41] isort Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index ecb22244d..e51eb87cc 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -14,13 +14,14 @@ # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) OWASP Foundation. All Rights Reserved. + import ast -from os import path -from glob import glob from collections.abc import Generator, Iterable from enum import Enum +from glob import glob from itertools import chain from json import load as json_load +from os import path from typing import Any, Optional from unittest import TestCase from warnings import warn From 1dfe71fd21c1dbf4c991eb94505d357869afe0d5 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 12:57:50 +0200 Subject: [PATCH 05/41] autopep8 Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index e51eb87cc..85597f3f7 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -528,12 +528,13 @@ def test_knows_value(self, value: str) -> None: @named_data(*NAMED_OF_SV) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom(components=[Component(name='dummy', type=ComponentType.LIBRARY, bom_ref='dummy', licenses=( - DisjunctiveLicense(name=f'LicenseAcknowledgement: {la.name}', - acknowledgement=la, - ) for la in LicenseAcknowledgement + DisjunctiveLicense(name=f'LicenseAcknowledgement: {la.name}', + acknowledgement=la, + ) for la in LicenseAcknowledgement ))]) super()._test_cases_render(bom, of, sv) + """ missing: - LicenseAcknowledgement @@ -554,6 +555,7 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, # add new test cases above this line + @ddt class TestCaseCompleteness(TestCase): """ From 20509fe56321d59897921009479fe13af30413b6 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 13:26:42 +0200 Subject: [PATCH 06/41] tests: TestEnumIdentityField & TestEnumAnalysisTechnique Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 68 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 85597f3f7..5025acca9 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -17,6 +17,7 @@ import ast from collections.abc import Generator, Iterable +from decimal import Decimal from enum import Enum from glob import glob from itertools import chain @@ -34,6 +35,7 @@ from cyclonedx.model import AttachedText, ExternalReference, HashType, XsUri from cyclonedx.model.bom import Bom, BomMetaData, DistributionConstraints, TlpClassification from cyclonedx.model.component import Component, Patch, Pedigree +from cyclonedx.model.component_evidence import ComponentEvidence, Identity as CEIdentity, Method as CEMethod from cyclonedx.model.issue import IssueType from cyclonedx.model.license import DisjunctiveLicense from cyclonedx.model.lifecycle import LifecyclePhase, PredefinedLifecycle @@ -65,6 +67,10 @@ ComponentType, PatchClassification, ) +from cyclonedx.model.component_evidence import ( # isort:skip + AnalysisTechnique, + IdentityField, +) from cyclonedx.model.impact_analysis import ( # isort:skip ImpactAnalysisAffectedStatus, ImpactAnalysisJustification, @@ -535,9 +541,67 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) + +@ddt +class TestEnumIdentityField(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='licenseAcknowledgementEnumerationType']"), + dp_cases_from_json_schemas('definitions', 'licenseAcknowledgementEnumeration'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(LicenseAcknowledgement, value) + + @named_data(*NAMED_OF_SV) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom(components=[ + Component( + name='dummy', type=ComponentType.LIBRARY, bom_ref='dummy', + evidence=ComponentEvidence(identity=[ + CEIdentity( + field=ce_if, + concluded_value=f'{ce_if.name}' + ) for ce_if in IdentityField + ])) + ]) + super()._test_cases_render(bom, of, sv) + + +@ddt +class TestEnumAnalysisTechnique(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='licenseAcknowledgementEnumerationType']"), + dp_cases_from_json_schemas('definitions', 'licenseAcknowledgementEnumeration'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(LicenseAcknowledgement, value) + + @named_data(*NAMED_OF_SV) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name='dummy', type=ComponentType.LIBRARY, bom_ref='dummy', + evidence=ComponentEvidence(identity=[ + CEIdentity( + field=IdentityField.NAME, + methods=[ + CEMethod( + confidence=Decimal(1.0), + value=f'AnalysisTechnique: {ce_at.name}', + technique=ce_at, + ) for ce_at in AnalysisTechnique + ]) + ]) + ) + ]) + super()._test_cases_render(bom, of, sv) + + + """ missing: -- LicenseAcknowledgement - CryptoAssetType - CryptoPrimitive - CryptoExecutionEnvironment @@ -549,8 +613,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, - RelatedCryptoMaterialType - RelatedCryptoMaterialState - ProtocolPropertiesType -- IdentityField -- AnalysisTechnique """ # add new test cases above this line From 44a98efb1c3c625b71ba9c2b32a54bd9006965af Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 13:27:07 +0200 Subject: [PATCH 07/41] autopep8 Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 5025acca9..1a66acebd 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -541,7 +541,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) - @ddt class TestEnumIdentityField(_EnumTestCase): @@ -599,7 +598,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) - """ missing: - CryptoAssetType From ec38b2ee9f21c0f02a0ddea0b376035de81be291 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 13:27:24 +0200 Subject: [PATCH 08/41] test data Signed-off-by: Jan Kowalleck --- .../enum_AnalysisTechnique-1.0.xml.bin | 10 ++ .../enum_AnalysisTechnique-1.1.xml.bin | 9 ++ .../enum_AnalysisTechnique-1.2.json.bin | 23 +++++ .../enum_AnalysisTechnique-1.2.xml.bin | 15 +++ .../enum_AnalysisTechnique-1.3.json.bin | 24 +++++ .../enum_AnalysisTechnique-1.3.xml.bin | 16 ++++ .../enum_AnalysisTechnique-1.4.json.bin | 23 +++++ .../enum_AnalysisTechnique-1.4.xml.bin | 15 +++ .../enum_AnalysisTechnique-1.5.json.bin | 89 ++++++++++++++++++ .../enum_AnalysisTechnique-1.5.xml.bin | 75 +++++++++++++++ .../enum_AnalysisTechnique-1.6.json.bin | 91 +++++++++++++++++++ .../enum_AnalysisTechnique-1.6.xml.bin | 75 +++++++++++++++ .../enum_AnalysisTechnique-1.7.json.bin | 91 +++++++++++++++++++ .../enum_AnalysisTechnique-1.7.xml.bin | 75 +++++++++++++++ .../snapshots/enum_IdentityField-1.0.xml.bin | 10 ++ .../snapshots/enum_IdentityField-1.1.xml.bin | 9 ++ .../snapshots/enum_IdentityField-1.2.json.bin | 23 +++++ .../snapshots/enum_IdentityField-1.2.xml.bin | 15 +++ .../snapshots/enum_IdentityField-1.3.json.bin | 24 +++++ .../snapshots/enum_IdentityField-1.3.xml.bin | 16 ++++ .../snapshots/enum_IdentityField-1.4.json.bin | 23 +++++ .../snapshots/enum_IdentityField-1.4.xml.bin | 15 +++ .../snapshots/enum_IdentityField-1.5.json.bin | 37 ++++++++ .../snapshots/enum_IdentityField-1.5.xml.bin | 23 +++++ .../snapshots/enum_IdentityField-1.6.json.bin | 72 +++++++++++++++ .../snapshots/enum_IdentityField-1.6.xml.bin | 56 ++++++++++++ .../snapshots/enum_IdentityField-1.7.json.bin | 72 +++++++++++++++ .../snapshots/enum_IdentityField-1.7.xml.bin | 56 ++++++++++++ 28 files changed, 1082 insertions(+) create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.0.xml.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.1.xml.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.2.json.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.2.xml.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.3.json.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.3.xml.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.4.json.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.4.xml.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.5.json.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.5.xml.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_AnalysisTechnique-1.7.xml.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.0.xml.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.1.xml.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.2.json.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.2.xml.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.3.json.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.3.xml.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.4.json.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.4.xml.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.5.json.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.5.xml.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_IdentityField-1.7.xml.bin diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.0.xml.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.0.xml.bin new file mode 100644 index 000000000..068b881e8 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.0.xml.bin @@ -0,0 +1,10 @@ + + + + + dummy + + false + + + diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.1.xml.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.1.xml.bin new file mode 100644 index 000000000..6212e7a1e --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.1.xml.bin @@ -0,0 +1,9 @@ + + + + + dummy + + + + diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.2.json.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.2.json.bin new file mode 100644 index 000000000..e1304da3c --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.2.json.bin @@ -0,0 +1,23 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "name": "dummy", + "type": "library", + "version": "" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.2b.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.2" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.2.xml.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.2.xml.bin new file mode 100644 index 000000000..d6f32a853 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.2.xml.bin @@ -0,0 +1,15 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + + + + + diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.3.json.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.3.json.bin new file mode 100644 index 000000000..2b110ae7e --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.3.json.bin @@ -0,0 +1,24 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": {}, + "name": "dummy", + "type": "library", + "version": "" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.3a.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.3" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.3.xml.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.3.xml.bin new file mode 100644 index 000000000..98358e5d9 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.3.xml.bin @@ -0,0 +1,16 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + + + + + + diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.4.json.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.4.json.bin new file mode 100644 index 000000000..c063eda5d --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.4.json.bin @@ -0,0 +1,23 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": {}, + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.4" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.4.xml.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.4.xml.bin new file mode 100644 index 000000000..91e492a28 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.4.xml.bin @@ -0,0 +1,15 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + + + + + diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.5.json.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.5.json.bin new file mode 100644 index 000000000..deb143c34 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.5.json.bin @@ -0,0 +1,89 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": { + "identity": { + "field": "name", + "methods": [ + { + "confidence": 1.0, + "technique": "ast-fingerprint", + "value": "AnalysisTechnique: AST_FINGERPRINT" + }, + { + "confidence": 1.0, + "technique": "attestation", + "value": "AnalysisTechnique: ATTESTATION" + }, + { + "confidence": 1.0, + "technique": "binary-analysis", + "value": "AnalysisTechnique: BINARY_ANALYSIS" + }, + { + "confidence": 1.0, + "technique": "dynamic-analysis", + "value": "AnalysisTechnique: DYNAMIC_ANALYSIS" + }, + { + "confidence": 1.0, + "technique": "filename", + "value": "AnalysisTechnique: FILENAME" + }, + { + "confidence": 1.0, + "technique": "hash-comparison", + "value": "AnalysisTechnique: HASH_COMPARISON" + }, + { + "confidence": 1.0, + "technique": "instrumentation", + "value": "AnalysisTechnique: INSTRUMENTATION" + }, + { + "confidence": 1.0, + "technique": "manifest-analysis", + "value": "AnalysisTechnique: MANIFEST_ANALYSIS" + }, + { + "confidence": 1.0, + "technique": "other", + "value": "AnalysisTechnique: OTHER" + }, + { + "confidence": 1.0, + "technique": "source-code-analysis", + "value": "AnalysisTechnique: SOURCE_CODE_ANALYSIS" + } + ] + } + }, + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.5" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.5.xml.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.5.xml.bin new file mode 100644 index 000000000..d64884a07 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.5.xml.bin @@ -0,0 +1,75 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + name + + + ast-fingerprint + 1 + AnalysisTechnique: AST_FINGERPRINT + + + attestation + 1 + AnalysisTechnique: ATTESTATION + + + binary-analysis + 1 + AnalysisTechnique: BINARY_ANALYSIS + + + dynamic-analysis + 1 + AnalysisTechnique: DYNAMIC_ANALYSIS + + + filename + 1 + AnalysisTechnique: FILENAME + + + hash-comparison + 1 + AnalysisTechnique: HASH_COMPARISON + + + instrumentation + 1 + AnalysisTechnique: INSTRUMENTATION + + + manifest-analysis + 1 + AnalysisTechnique: MANIFEST_ANALYSIS + + + other + 1 + AnalysisTechnique: OTHER + + + source-code-analysis + 1 + AnalysisTechnique: SOURCE_CODE_ANALYSIS + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.6.json.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.6.json.bin new file mode 100644 index 000000000..017ab1a24 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.6.json.bin @@ -0,0 +1,91 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": { + "identity": [ + { + "field": "name", + "methods": [ + { + "confidence": 1.0, + "technique": "ast-fingerprint", + "value": "AnalysisTechnique: AST_FINGERPRINT" + }, + { + "confidence": 1.0, + "technique": "attestation", + "value": "AnalysisTechnique: ATTESTATION" + }, + { + "confidence": 1.0, + "technique": "binary-analysis", + "value": "AnalysisTechnique: BINARY_ANALYSIS" + }, + { + "confidence": 1.0, + "technique": "dynamic-analysis", + "value": "AnalysisTechnique: DYNAMIC_ANALYSIS" + }, + { + "confidence": 1.0, + "technique": "filename", + "value": "AnalysisTechnique: FILENAME" + }, + { + "confidence": 1.0, + "technique": "hash-comparison", + "value": "AnalysisTechnique: HASH_COMPARISON" + }, + { + "confidence": 1.0, + "technique": "instrumentation", + "value": "AnalysisTechnique: INSTRUMENTATION" + }, + { + "confidence": 1.0, + "technique": "manifest-analysis", + "value": "AnalysisTechnique: MANIFEST_ANALYSIS" + }, + { + "confidence": 1.0, + "technique": "other", + "value": "AnalysisTechnique: OTHER" + }, + { + "confidence": 1.0, + "technique": "source-code-analysis", + "value": "AnalysisTechnique: SOURCE_CODE_ANALYSIS" + } + ] + } + ] + }, + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.6.xml.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.6.xml.bin new file mode 100644 index 000000000..130e9c2c5 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.6.xml.bin @@ -0,0 +1,75 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + name + + + ast-fingerprint + 1 + AnalysisTechnique: AST_FINGERPRINT + + + attestation + 1 + AnalysisTechnique: ATTESTATION + + + binary-analysis + 1 + AnalysisTechnique: BINARY_ANALYSIS + + + dynamic-analysis + 1 + AnalysisTechnique: DYNAMIC_ANALYSIS + + + filename + 1 + AnalysisTechnique: FILENAME + + + hash-comparison + 1 + AnalysisTechnique: HASH_COMPARISON + + + instrumentation + 1 + AnalysisTechnique: INSTRUMENTATION + + + manifest-analysis + 1 + AnalysisTechnique: MANIFEST_ANALYSIS + + + other + 1 + AnalysisTechnique: OTHER + + + source-code-analysis + 1 + AnalysisTechnique: SOURCE_CODE_ANALYSIS + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.7.json.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.7.json.bin new file mode 100644 index 000000000..40641fc89 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.7.json.bin @@ -0,0 +1,91 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": { + "identity": [ + { + "field": "name", + "methods": [ + { + "confidence": 1.0, + "technique": "ast-fingerprint", + "value": "AnalysisTechnique: AST_FINGERPRINT" + }, + { + "confidence": 1.0, + "technique": "attestation", + "value": "AnalysisTechnique: ATTESTATION" + }, + { + "confidence": 1.0, + "technique": "binary-analysis", + "value": "AnalysisTechnique: BINARY_ANALYSIS" + }, + { + "confidence": 1.0, + "technique": "dynamic-analysis", + "value": "AnalysisTechnique: DYNAMIC_ANALYSIS" + }, + { + "confidence": 1.0, + "technique": "filename", + "value": "AnalysisTechnique: FILENAME" + }, + { + "confidence": 1.0, + "technique": "hash-comparison", + "value": "AnalysisTechnique: HASH_COMPARISON" + }, + { + "confidence": 1.0, + "technique": "instrumentation", + "value": "AnalysisTechnique: INSTRUMENTATION" + }, + { + "confidence": 1.0, + "technique": "manifest-analysis", + "value": "AnalysisTechnique: MANIFEST_ANALYSIS" + }, + { + "confidence": 1.0, + "technique": "other", + "value": "AnalysisTechnique: OTHER" + }, + { + "confidence": 1.0, + "technique": "source-code-analysis", + "value": "AnalysisTechnique: SOURCE_CODE_ANALYSIS" + } + ] + } + ] + }, + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_AnalysisTechnique-1.7.xml.bin b/tests/_data/snapshots/enum_AnalysisTechnique-1.7.xml.bin new file mode 100644 index 000000000..d84acf574 --- /dev/null +++ b/tests/_data/snapshots/enum_AnalysisTechnique-1.7.xml.bin @@ -0,0 +1,75 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + name + + + ast-fingerprint + 1 + AnalysisTechnique: AST_FINGERPRINT + + + attestation + 1 + AnalysisTechnique: ATTESTATION + + + binary-analysis + 1 + AnalysisTechnique: BINARY_ANALYSIS + + + dynamic-analysis + 1 + AnalysisTechnique: DYNAMIC_ANALYSIS + + + filename + 1 + AnalysisTechnique: FILENAME + + + hash-comparison + 1 + AnalysisTechnique: HASH_COMPARISON + + + instrumentation + 1 + AnalysisTechnique: INSTRUMENTATION + + + manifest-analysis + 1 + AnalysisTechnique: MANIFEST_ANALYSIS + + + other + 1 + AnalysisTechnique: OTHER + + + source-code-analysis + 1 + AnalysisTechnique: SOURCE_CODE_ANALYSIS + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_IdentityField-1.0.xml.bin b/tests/_data/snapshots/enum_IdentityField-1.0.xml.bin new file mode 100644 index 000000000..068b881e8 --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.0.xml.bin @@ -0,0 +1,10 @@ + + + + + dummy + + false + + + diff --git a/tests/_data/snapshots/enum_IdentityField-1.1.xml.bin b/tests/_data/snapshots/enum_IdentityField-1.1.xml.bin new file mode 100644 index 000000000..6212e7a1e --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.1.xml.bin @@ -0,0 +1,9 @@ + + + + + dummy + + + + diff --git a/tests/_data/snapshots/enum_IdentityField-1.2.json.bin b/tests/_data/snapshots/enum_IdentityField-1.2.json.bin new file mode 100644 index 000000000..e1304da3c --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.2.json.bin @@ -0,0 +1,23 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "name": "dummy", + "type": "library", + "version": "" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.2b.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.2" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_IdentityField-1.2.xml.bin b/tests/_data/snapshots/enum_IdentityField-1.2.xml.bin new file mode 100644 index 000000000..d6f32a853 --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.2.xml.bin @@ -0,0 +1,15 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + + + + + diff --git a/tests/_data/snapshots/enum_IdentityField-1.3.json.bin b/tests/_data/snapshots/enum_IdentityField-1.3.json.bin new file mode 100644 index 000000000..2b110ae7e --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.3.json.bin @@ -0,0 +1,24 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": {}, + "name": "dummy", + "type": "library", + "version": "" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.3a.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.3" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_IdentityField-1.3.xml.bin b/tests/_data/snapshots/enum_IdentityField-1.3.xml.bin new file mode 100644 index 000000000..98358e5d9 --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.3.xml.bin @@ -0,0 +1,16 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + + + + + + diff --git a/tests/_data/snapshots/enum_IdentityField-1.4.json.bin b/tests/_data/snapshots/enum_IdentityField-1.4.json.bin new file mode 100644 index 000000000..c063eda5d --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.4.json.bin @@ -0,0 +1,23 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": {}, + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.4" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_IdentityField-1.4.xml.bin b/tests/_data/snapshots/enum_IdentityField-1.4.xml.bin new file mode 100644 index 000000000..91e492a28 --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.4.xml.bin @@ -0,0 +1,15 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + + + + + diff --git a/tests/_data/snapshots/enum_IdentityField-1.5.json.bin b/tests/_data/snapshots/enum_IdentityField-1.5.json.bin new file mode 100644 index 000000000..44c3b4ad5 --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.5.json.bin @@ -0,0 +1,37 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": { + "identity": { + "field": "cpe" + } + }, + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.5" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_IdentityField-1.5.xml.bin b/tests/_data/snapshots/enum_IdentityField-1.5.xml.bin new file mode 100644 index 000000000..fde866a5b --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.5.xml.bin @@ -0,0 +1,23 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + cpe + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_IdentityField-1.6.json.bin b/tests/_data/snapshots/enum_IdentityField-1.6.json.bin new file mode 100644 index 000000000..2e3c30deb --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.6.json.bin @@ -0,0 +1,72 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": { + "identity": [ + { + "concludedValue": "CPE", + "field": "cpe" + }, + { + "concludedValue": "GROUP", + "field": "group" + }, + { + "concludedValue": "HASH", + "field": "hash" + }, + { + "concludedValue": "NAME", + "field": "name" + }, + { + "concludedValue": "OMNIBOR_ID", + "field": "omniborId" + }, + { + "concludedValue": "PURL", + "field": "purl" + }, + { + "concludedValue": "SWHID", + "field": "swhid" + }, + { + "concludedValue": "SWID", + "field": "swid" + }, + { + "concludedValue": "VERSION", + "field": "version" + } + ] + }, + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_IdentityField-1.6.xml.bin b/tests/_data/snapshots/enum_IdentityField-1.6.xml.bin new file mode 100644 index 000000000..8a66b5203 --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.6.xml.bin @@ -0,0 +1,56 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + cpe + CPE + + + group + GROUP + + + hash + HASH + + + name + NAME + + + omniborId + OMNIBOR_ID + + + purl + PURL + + + swhid + SWHID + + + swid + SWID + + + version + VERSION + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_IdentityField-1.7.json.bin b/tests/_data/snapshots/enum_IdentityField-1.7.json.bin new file mode 100644 index 000000000..acd988ce2 --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.7.json.bin @@ -0,0 +1,72 @@ +{ + "components": [ + { + "bom-ref": "dummy", + "evidence": { + "identity": [ + { + "concludedValue": "CPE", + "field": "cpe" + }, + { + "concludedValue": "GROUP", + "field": "group" + }, + { + "concludedValue": "HASH", + "field": "hash" + }, + { + "concludedValue": "NAME", + "field": "name" + }, + { + "concludedValue": "OMNIBOR_ID", + "field": "omniborId" + }, + { + "concludedValue": "PURL", + "field": "purl" + }, + { + "concludedValue": "SWHID", + "field": "swhid" + }, + { + "concludedValue": "SWID", + "field": "swid" + }, + { + "concludedValue": "VERSION", + "field": "version" + } + ] + }, + "name": "dummy", + "type": "library" + } + ], + "dependencies": [ + { + "ref": "dummy" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_IdentityField-1.7.xml.bin b/tests/_data/snapshots/enum_IdentityField-1.7.xml.bin new file mode 100644 index 000000000..91144a020 --- /dev/null +++ b/tests/_data/snapshots/enum_IdentityField-1.7.xml.bin @@ -0,0 +1,56 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + dummy + + + cpe + CPE + + + group + GROUP + + + hash + HASH + + + name + NAME + + + omniborId + OMNIBOR_ID + + + purl + PURL + + + swhid + SWHID + + + swid + SWID + + + version + VERSION + + + + + + + + + val1 + val2 + + From f4ae307db933b4ae8c7270139ab30761317ad27a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 13:33:47 +0200 Subject: [PATCH 09/41] tests: TestEnumIdentityField & TestEnumAnalysisTechnique Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 1a66acebd..a463414fa 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -545,11 +545,11 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, class TestEnumIdentityField(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='licenseAcknowledgementEnumerationType']"), - dp_cases_from_json_schemas('definitions', 'licenseAcknowledgementEnumeration'), + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='identityFieldType']"), + dp_cases_from_json_schemas('definitions', 'componentIdentityEvidence', 'properties', 'field'), ))) def test_knows_value(self, value: str) -> None: - super()._test_knows_value(LicenseAcknowledgement, value) + super()._test_knows_value(IdentityField, value) @named_data(*NAMED_OF_SV) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: @@ -570,11 +570,11 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, class TestEnumAnalysisTechnique(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='licenseAcknowledgementEnumerationType']"), - dp_cases_from_json_schemas('definitions', 'licenseAcknowledgementEnumeration'), + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='evidenceTechnique']"), + dp_cases_from_json_schemas('definitions', 'componentIdentityEvidence', 'properties', 'methods', 'items', 'properties', 'technique'), ))) def test_knows_value(self, value: str) -> None: - super()._test_knows_value(LicenseAcknowledgement, value) + super()._test_knows_value(AnalysisTechnique, value) @named_data(*NAMED_OF_SV) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: From 4868e2d6cd8e9a3b962ce4c63dd7e24c1329291a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 8 Jun 2026 13:34:08 +0200 Subject: [PATCH 10/41] autopep8 Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index a463414fa..084177627 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -571,7 +571,8 @@ class TestEnumAnalysisTechnique(_EnumTestCase): @idata(set(chain( dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='evidenceTechnique']"), - dp_cases_from_json_schemas('definitions', 'componentIdentityEvidence', 'properties', 'methods', 'items', 'properties', 'technique'), + dp_cases_from_json_schemas('definitions', 'componentIdentityEvidence', 'properties', + 'methods', 'items', 'properties', 'technique'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(AnalysisTechnique, value) From b29e49c4629f5bae569075467fb8253cabafb71e Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 15 Jun 2026 10:58:33 +0200 Subject: [PATCH 11/41] tests: enum CryptoAssetType Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 78 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 084177627..187c8cd2a 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -36,6 +36,7 @@ from cyclonedx.model.bom import Bom, BomMetaData, DistributionConstraints, TlpClassification from cyclonedx.model.component import Component, Patch, Pedigree from cyclonedx.model.component_evidence import ComponentEvidence, Identity as CEIdentity, Method as CEMethod +from cyclonedx.model.crypto import CryptoProperties from cyclonedx.model.issue import IssueType from cyclonedx.model.license import DisjunctiveLicense from cyclonedx.model.lifecycle import LifecyclePhase, PredefinedLifecycle @@ -87,6 +88,19 @@ VulnerabilityScoreSource, VulnerabilitySeverity, ) +from cyclonedx.model.crypto import ( # isort:skip + CryptoAssetType, + CryptoPrimitive, + CryptoExecutionEnvironment, + CryptoImplementationPlatform, + CryptoCertificationLevel, + CryptoMode, + CryptoPadding, + CryptoFunction, + RelatedCryptoMaterialType, + RelatedCryptoMaterialState, + ProtocolPropertiesType, +) # endregion SUT @@ -97,14 +111,18 @@ def dp_cases_from_xml_schema(sf: str, xpath: str) -> Generator[str, None, None]: for el in xml_parse(sf).iterfind(f'{xpath}/{SCHEMA_NS}restriction/{SCHEMA_NS}enumeration'): # nosec B314 yield el.get('value') + # warn if no such structure -def dp_cases_from_xml_schemas(xpath: str) -> Generator[str, None, None]: +def dp_cases_from_xml_schemas(xpath: str) -> set[str]: + cases: set[str] = set() for sf in SCHEMA_XML.values(): if sf is None: continue - yield from dp_cases_from_xml_schema(sf, xpath) - + cases.update(dp_cases_from_xml_schema(sf, xpath)) + if len(cases) == 0: + raise ValueError(f'no values for xpath: {xpath!r}') + return cases def dp_cases_from_json_schema(sf: str, jsonpointer: Iterable[str]) -> Generator[str, None, None]: with open(sf) as sfh: @@ -113,15 +131,20 @@ def dp_cases_from_json_schema(sf: str, jsonpointer: Iterable[str]) -> Generator[ for pp in jsonpointer: data = data[pp] except KeyError: + # warn if no such structure return yield from data['enum'] -def dp_cases_from_json_schemas(*jsonpointer: str) -> Generator[str, None, None]: +def dp_cases_from_json_schemas(*jsonpointer: str) -> set[str]: + cases: set[str] = set() for sf in SCHEMA_JSON.values(): if sf is None: continue - yield from dp_cases_from_json_schema(sf, jsonpointer) + cases.update(dp_cases_from_json_schema(sf, jsonpointer)) + if len(cases) == 0: + raise ValueError(f'no values for jsonpointer: {jsonpointer!r}') + return cases UNSUPPORTED_OF_SV = frozenset([ @@ -490,7 +513,7 @@ class TestEnumLifecyclePhase(_EnumTestCase): @idata(set(chain( dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='lifecyclePhaseType']"), - dp_cases_from_json_schemas('definitions', 'metadata', 'properties', 'lifecycles', 'items', 'phase'), + dp_cases_from_json_schemas('definitions', 'metadata', 'properties', 'lifecycles', 'items', 'oneOf', 0, 'properties', 'phase'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(LifecyclePhase, value) @@ -598,6 +621,49 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, ]) super()._test_cases_render(bom, of, sv) +@ddt +class TestEnumCryptoAssetType(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='assetType']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'assetType'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(CryptoAssetType, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'CryptoAssetType: {cat.name}', type=ComponentType.CRYPTOGRAPHIC_ASSET, bom_ref=f'dummy-CAT:{cat.name}', + crypto_properties=CryptoProperties( + asset_type=cat + ) + ) for cat in CryptoAssetType + ]) + super()._test_cases_render(bom, of, sv) + +""" +@ddt +class TestEnum...(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='...']"), + dp_cases_from_json_schemas('definitions', '...'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(..., value) + + @named_data(*NAMED_OF_SV) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + ... + ]) + super()._test_cases_render(bom, of, sv) + +""" """ missing: From 4ff6db8471fa4388a624f84a1247a757148474e3 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 15 Jun 2026 10:58:38 +0200 Subject: [PATCH 12/41] tests: enum CryptoAssetType Signed-off-by: Jan Kowalleck --- .../enum_CryptoAssetType-1.6.json.bin | 68 +++++++++++++++++++ .../enum_CryptoAssetType-1.6.xml.bin | 42 ++++++++++++ .../enum_CryptoAssetType-1.7.json.bin | 68 +++++++++++++++++++ .../enum_CryptoAssetType-1.7.xml.bin | 42 ++++++++++++ 4 files changed, 220 insertions(+) create mode 100644 tests/_data/snapshots/enum_CryptoAssetType-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoAssetType-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_CryptoAssetType-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoAssetType-1.7.xml.bin diff --git a/tests/_data/snapshots/enum_CryptoAssetType-1.6.json.bin b/tests/_data/snapshots/enum_CryptoAssetType-1.6.json.bin new file mode 100644 index 000000000..dd554d923 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoAssetType-1.6.json.bin @@ -0,0 +1,68 @@ +{ + "components": [ + { + "bom-ref": "dummy-CAT:ALGORITHM", + "cryptoProperties": { + "assetType": "algorithm" + }, + "name": "CryptoAssetType: ALGORITHM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CAT:CERTIFICATE", + "cryptoProperties": { + "assetType": "certificate" + }, + "name": "CryptoAssetType: CERTIFICATE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CAT:PROTOCOL", + "cryptoProperties": { + "assetType": "protocol" + }, + "name": "CryptoAssetType: PROTOCOL", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CAT:RELATED_CRYPTO_MATERIAL", + "cryptoProperties": { + "assetType": "related-crypto-material" + }, + "name": "CryptoAssetType: RELATED_CRYPTO_MATERIAL", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CAT:ALGORITHM" + }, + { + "ref": "dummy-CAT:CERTIFICATE" + }, + { + "ref": "dummy-CAT:PROTOCOL" + }, + { + "ref": "dummy-CAT:RELATED_CRYPTO_MATERIAL" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoAssetType-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoAssetType-1.6.xml.bin new file mode 100644 index 000000000..adbaa1af2 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoAssetType-1.6.xml.bin @@ -0,0 +1,42 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoAssetType: ALGORITHM + + algorithm + + + + CryptoAssetType: CERTIFICATE + + certificate + + + + CryptoAssetType: PROTOCOL + + protocol + + + + CryptoAssetType: RELATED_CRYPTO_MATERIAL + + related-crypto-material + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_CryptoAssetType-1.7.json.bin b/tests/_data/snapshots/enum_CryptoAssetType-1.7.json.bin new file mode 100644 index 000000000..d337680a2 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoAssetType-1.7.json.bin @@ -0,0 +1,68 @@ +{ + "components": [ + { + "bom-ref": "dummy-CAT:ALGORITHM", + "cryptoProperties": { + "assetType": "algorithm" + }, + "name": "CryptoAssetType: ALGORITHM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CAT:CERTIFICATE", + "cryptoProperties": { + "assetType": "certificate" + }, + "name": "CryptoAssetType: CERTIFICATE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CAT:PROTOCOL", + "cryptoProperties": { + "assetType": "protocol" + }, + "name": "CryptoAssetType: PROTOCOL", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CAT:RELATED_CRYPTO_MATERIAL", + "cryptoProperties": { + "assetType": "related-crypto-material" + }, + "name": "CryptoAssetType: RELATED_CRYPTO_MATERIAL", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CAT:ALGORITHM" + }, + { + "ref": "dummy-CAT:CERTIFICATE" + }, + { + "ref": "dummy-CAT:PROTOCOL" + }, + { + "ref": "dummy-CAT:RELATED_CRYPTO_MATERIAL" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoAssetType-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoAssetType-1.7.xml.bin new file mode 100644 index 000000000..20662c941 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoAssetType-1.7.xml.bin @@ -0,0 +1,42 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoAssetType: ALGORITHM + + algorithm + + + + CryptoAssetType: CERTIFICATE + + certificate + + + + CryptoAssetType: PROTOCOL + + protocol + + + + CryptoAssetType: RELATED_CRYPTO_MATERIAL + + related-crypto-material + + + + + + + + + + + val1 + val2 + + From a3f5eea9fdfbc95725be54008537935f75e51978 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 15 Jun 2026 11:33:57 +0200 Subject: [PATCH 13/41] tests: enum CryptoPrimitive Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 3 +++ tests/test_enums.py | 38 +++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index a3d32d0ea..37122e113 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -59,6 +59,8 @@ class CryptoAssetType(str, Enum): @serializable.serializable_enum class CryptoPrimitive(str, Enum): + # TODO: rename to `CryptoAlgorithmPrimitive` + """ This is our internal representation of the cryptoPropertiesType.algorithmProperties.primitive ENUM type within the CycloneDX standard. @@ -83,6 +85,7 @@ class CryptoPrimitive(str, Enum): SIGNATURE = 'signature' STREAM_CIPHER = 'stream-cipher' XOF = 'xof' + # TODO: add `key-wrap` - since CDX1.7key-wrap OTHER = 'other' UNKNOWN = 'unknown' diff --git a/tests/test_enums.py b/tests/test_enums.py index 187c8cd2a..25aec1e0d 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -36,7 +36,7 @@ from cyclonedx.model.bom import Bom, BomMetaData, DistributionConstraints, TlpClassification from cyclonedx.model.component import Component, Patch, Pedigree from cyclonedx.model.component_evidence import ComponentEvidence, Identity as CEIdentity, Method as CEMethod -from cyclonedx.model.crypto import CryptoProperties +from cyclonedx.model.crypto import CryptoProperties, AlgorithmProperties from cyclonedx.model.issue import IssueType from cyclonedx.model.license import DisjunctiveLicense from cyclonedx.model.lifecycle import LifecyclePhase, PredefinedLifecycle @@ -636,14 +636,44 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, bom = _make_bom( components=[ Component( - name=f'CryptoAssetType: {cat.name}', type=ComponentType.CRYPTOGRAPHIC_ASSET, bom_ref=f'dummy-CAT:{cat.name}', - crypto_properties=CryptoProperties( + name=f'CryptoAssetType: {cat.name}', bom_ref=f'dummy-CAT:{cat.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( asset_type=cat ) ) for cat in CryptoAssetType ]) super()._test_cases_render(bom, of, sv) + +@ddt +class TestEnumCryptoPrimitive(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='primitive']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'primitive'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(CryptoPrimitive, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'CryptoPrimitive: {cp.name}', bom_ref=f'dummy-CP:{cp.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.ALGORITHM, + algorithm_properties=AlgorithmProperties( + primitive=cp + ) + ) + ) for cp in CryptoPrimitive + ]) + super()._test_cases_render(bom, of, sv) + + """ @ddt class TestEnum...(_EnumTestCase): @@ -667,8 +697,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, """ missing: -- CryptoAssetType -- CryptoPrimitive - CryptoExecutionEnvironment - CryptoImplementationPlatform - CryptoCertificationLevel From 9129d389d589b834c8b9f07071a2732ce75a8d89 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 15 Jun 2026 11:34:01 +0200 Subject: [PATCH 14/41] tests: enum CryptoPrimitive Signed-off-by: Jan Kowalleck --- .../enum_CryptoPrimitive-1.6.json.bin | 234 ++++++++++++++++++ .../enum_CryptoPrimitive-1.6.xml.bin | 164 ++++++++++++ .../enum_CryptoPrimitive-1.7.json.bin | 234 ++++++++++++++++++ .../enum_CryptoPrimitive-1.7.xml.bin | 164 ++++++++++++ 4 files changed, 796 insertions(+) create mode 100644 tests/_data/snapshots/enum_CryptoPrimitive-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoPrimitive-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_CryptoPrimitive-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoPrimitive-1.7.xml.bin diff --git a/tests/_data/snapshots/enum_CryptoPrimitive-1.6.json.bin b/tests/_data/snapshots/enum_CryptoPrimitive-1.6.json.bin new file mode 100644 index 000000000..656f8677c --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoPrimitive-1.6.json.bin @@ -0,0 +1,234 @@ +{ + "components": [ + { + "bom-ref": "dummy-CP:AE", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "ae" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: AE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:BLOCK_CIPHER", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "block-cipher" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: BLOCK_CIPHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:COMBINER", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "combiner" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: COMBINER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:DRBG", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "drbg" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: DRBG", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:HASH", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "hash" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: HASH", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:KDF", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "kdf" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: KDF", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:KEM", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "kem" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: KEM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:KEY_AGREE", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "key-agree" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: KEY_AGREE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:MAC", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "mac" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: MAC", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:PKE", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "pke" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: PKE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:SIGNATURE", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "signature" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: SIGNATURE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:STREAM_CIPHER", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "stream-cipher" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: STREAM_CIPHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: UNKNOWN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:XOF", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "xof" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: XOF", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CP:AE" + }, + { + "ref": "dummy-CP:BLOCK_CIPHER" + }, + { + "ref": "dummy-CP:COMBINER" + }, + { + "ref": "dummy-CP:DRBG" + }, + { + "ref": "dummy-CP:HASH" + }, + { + "ref": "dummy-CP:KDF" + }, + { + "ref": "dummy-CP:KEM" + }, + { + "ref": "dummy-CP:KEY_AGREE" + }, + { + "ref": "dummy-CP:MAC" + }, + { + "ref": "dummy-CP:OTHER" + }, + { + "ref": "dummy-CP:PKE" + }, + { + "ref": "dummy-CP:SIGNATURE" + }, + { + "ref": "dummy-CP:STREAM_CIPHER" + }, + { + "ref": "dummy-CP:UNKNOWN" + }, + { + "ref": "dummy-CP:XOF" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoPrimitive-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoPrimitive-1.6.xml.bin new file mode 100644 index 000000000..658a0b6f3 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoPrimitive-1.6.xml.bin @@ -0,0 +1,164 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoPrimitive: AE + + algorithm + + ae + + + + + CryptoPrimitive: BLOCK_CIPHER + + algorithm + + block-cipher + + + + + CryptoPrimitive: COMBINER + + algorithm + + combiner + + + + + CryptoPrimitive: DRBG + + algorithm + + drbg + + + + + CryptoPrimitive: HASH + + algorithm + + hash + + + + + CryptoPrimitive: KDF + + algorithm + + kdf + + + + + CryptoPrimitive: KEM + + algorithm + + kem + + + + + CryptoPrimitive: KEY_AGREE + + algorithm + + key-agree + + + + + CryptoPrimitive: MAC + + algorithm + + mac + + + + + CryptoPrimitive: OTHER + + algorithm + + other + + + + + CryptoPrimitive: PKE + + algorithm + + pke + + + + + CryptoPrimitive: SIGNATURE + + algorithm + + signature + + + + + CryptoPrimitive: STREAM_CIPHER + + algorithm + + stream-cipher + + + + + CryptoPrimitive: UNKNOWN + + algorithm + + unknown + + + + + CryptoPrimitive: XOF + + algorithm + + xof + + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_CryptoPrimitive-1.7.json.bin b/tests/_data/snapshots/enum_CryptoPrimitive-1.7.json.bin new file mode 100644 index 000000000..e78b7d81c --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoPrimitive-1.7.json.bin @@ -0,0 +1,234 @@ +{ + "components": [ + { + "bom-ref": "dummy-CP:AE", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "ae" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: AE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:BLOCK_CIPHER", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "block-cipher" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: BLOCK_CIPHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:COMBINER", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "combiner" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: COMBINER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:DRBG", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "drbg" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: DRBG", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:HASH", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "hash" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: HASH", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:KDF", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "kdf" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: KDF", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:KEM", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "kem" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: KEM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:KEY_AGREE", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "key-agree" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: KEY_AGREE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:MAC", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "mac" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: MAC", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:PKE", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "pke" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: PKE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:SIGNATURE", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "signature" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: SIGNATURE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:STREAM_CIPHER", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "stream-cipher" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: STREAM_CIPHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: UNKNOWN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:XOF", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "xof" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: XOF", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CP:AE" + }, + { + "ref": "dummy-CP:BLOCK_CIPHER" + }, + { + "ref": "dummy-CP:COMBINER" + }, + { + "ref": "dummy-CP:DRBG" + }, + { + "ref": "dummy-CP:HASH" + }, + { + "ref": "dummy-CP:KDF" + }, + { + "ref": "dummy-CP:KEM" + }, + { + "ref": "dummy-CP:KEY_AGREE" + }, + { + "ref": "dummy-CP:MAC" + }, + { + "ref": "dummy-CP:OTHER" + }, + { + "ref": "dummy-CP:PKE" + }, + { + "ref": "dummy-CP:SIGNATURE" + }, + { + "ref": "dummy-CP:STREAM_CIPHER" + }, + { + "ref": "dummy-CP:UNKNOWN" + }, + { + "ref": "dummy-CP:XOF" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoPrimitive-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoPrimitive-1.7.xml.bin new file mode 100644 index 000000000..5e5591c99 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoPrimitive-1.7.xml.bin @@ -0,0 +1,164 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoPrimitive: AE + + algorithm + + ae + + + + + CryptoPrimitive: BLOCK_CIPHER + + algorithm + + block-cipher + + + + + CryptoPrimitive: COMBINER + + algorithm + + combiner + + + + + CryptoPrimitive: DRBG + + algorithm + + drbg + + + + + CryptoPrimitive: HASH + + algorithm + + hash + + + + + CryptoPrimitive: KDF + + algorithm + + kdf + + + + + CryptoPrimitive: KEM + + algorithm + + kem + + + + + CryptoPrimitive: KEY_AGREE + + algorithm + + key-agree + + + + + CryptoPrimitive: MAC + + algorithm + + mac + + + + + CryptoPrimitive: OTHER + + algorithm + + other + + + + + CryptoPrimitive: PKE + + algorithm + + pke + + + + + CryptoPrimitive: SIGNATURE + + algorithm + + signature + + + + + CryptoPrimitive: STREAM_CIPHER + + algorithm + + stream-cipher + + + + + CryptoPrimitive: UNKNOWN + + algorithm + + unknown + + + + + CryptoPrimitive: XOF + + algorithm + + xof + + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + From 1860d13a5b19e4a8d055f6ccc3ea007bffd6737b Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 15 Jun 2026 11:43:18 +0200 Subject: [PATCH 15/41] tests: enum CryptoExecutionEnvironment Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 2 + ...um_CryptoExecutionEnvironment-1.6.json.bin | 108 ++++++++++++++++++ ...num_CryptoExecutionEnvironment-1.6.xml.bin | 74 ++++++++++++ ...um_CryptoExecutionEnvironment-1.7.json.bin | 108 ++++++++++++++++++ ...num_CryptoExecutionEnvironment-1.7.xml.bin | 74 ++++++++++++ tests/test_enums.py | 29 ++++- 6 files changed, 394 insertions(+), 1 deletion(-) create mode 100644 tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.xml.bin diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index 37122e113..746a6deec 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -93,6 +93,8 @@ class CryptoPrimitive(str, Enum): @serializable.serializable_enum class CryptoExecutionEnvironment(str, Enum): + # TODO: rename to `CryptoAlgorithmExecutionEnvironment` + """ This is our internal representation of the cryptoPropertiesType.algorithmProperties.executionEnvironment ENUM type within the CycloneDX standard. diff --git a/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.json.bin b/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.json.bin new file mode 100644 index 000000000..e1cab98b0 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.json.bin @@ -0,0 +1,108 @@ +{ + "components": [ + { + "bom-ref": "dummy-CEE:HARDWARE", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "hardware" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: HARDWARE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:SOFTWARE_ENCRYPTED_RAM", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "software-encrypted-ram" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: SOFTWARE_ENCRYPTED_RAM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:SOFTWARE_PLAIN_RAM", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "software-plain-ram" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: SOFTWARE_PLAIN_RAM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:SOFTWARE_TEE", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "software-tee" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: SOFTWARE_TEE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CEE:HARDWARE" + }, + { + "ref": "dummy-CEE:OTHER" + }, + { + "ref": "dummy-CEE:SOFTWARE_ENCRYPTED_RAM" + }, + { + "ref": "dummy-CEE:SOFTWARE_PLAIN_RAM" + }, + { + "ref": "dummy-CEE:SOFTWARE_TEE" + }, + { + "ref": "dummy-CEE:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.xml.bin new file mode 100644 index 000000000..f45d314ab --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.xml.bin @@ -0,0 +1,74 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoExecutionEnvironment: HARDWARE + + algorithm + + hardware + + + + + CryptoExecutionEnvironment: OTHER + + algorithm + + other + + + + + CryptoExecutionEnvironment: SOFTWARE_ENCRYPTED_RAM + + algorithm + + software-encrypted-ram + + + + + CryptoExecutionEnvironment: SOFTWARE_PLAIN_RAM + + algorithm + + software-plain-ram + + + + + CryptoExecutionEnvironment: SOFTWARE_TEE + + algorithm + + software-tee + + + + + CryptoExecutionEnvironment: UNKNOWN + + algorithm + + unknown + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.json.bin b/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.json.bin new file mode 100644 index 000000000..3d6c2e608 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.json.bin @@ -0,0 +1,108 @@ +{ + "components": [ + { + "bom-ref": "dummy-CEE:HARDWARE", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "hardware" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: HARDWARE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:SOFTWARE_ENCRYPTED_RAM", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "software-encrypted-ram" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: SOFTWARE_ENCRYPTED_RAM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:SOFTWARE_PLAIN_RAM", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "software-plain-ram" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: SOFTWARE_PLAIN_RAM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:SOFTWARE_TEE", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "software-tee" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: SOFTWARE_TEE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CEE:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "executionEnvironment": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoExecutionEnvironment: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CEE:HARDWARE" + }, + { + "ref": "dummy-CEE:OTHER" + }, + { + "ref": "dummy-CEE:SOFTWARE_ENCRYPTED_RAM" + }, + { + "ref": "dummy-CEE:SOFTWARE_PLAIN_RAM" + }, + { + "ref": "dummy-CEE:SOFTWARE_TEE" + }, + { + "ref": "dummy-CEE:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.xml.bin new file mode 100644 index 000000000..fb95914ff --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.xml.bin @@ -0,0 +1,74 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoExecutionEnvironment: HARDWARE + + algorithm + + hardware + + + + + CryptoExecutionEnvironment: OTHER + + algorithm + + other + + + + + CryptoExecutionEnvironment: SOFTWARE_ENCRYPTED_RAM + + algorithm + + software-encrypted-ram + + + + + CryptoExecutionEnvironment: SOFTWARE_PLAIN_RAM + + algorithm + + software-plain-ram + + + + + CryptoExecutionEnvironment: SOFTWARE_TEE + + algorithm + + software-tee + + + + + CryptoExecutionEnvironment: UNKNOWN + + algorithm + + unknown + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/test_enums.py b/tests/test_enums.py index 25aec1e0d..2616688ba 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -674,6 +674,34 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) +@ddt +class TestEnumCryptoExecutionEnvironment(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='executionEnvironment']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'executionEnvironment'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(CryptoExecutionEnvironment, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'CryptoExecutionEnvironment: {cee.name}', bom_ref=f'dummy-CEE:{cee.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.ALGORITHM, + algorithm_properties=AlgorithmProperties( + execution_environment=cee + ) + ) + ) for cee in CryptoExecutionEnvironment + ]) + super()._test_cases_render(bom, of, sv) + + """ @ddt class TestEnum...(_EnumTestCase): @@ -697,7 +725,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, """ missing: -- CryptoExecutionEnvironment - CryptoImplementationPlatform - CryptoCertificationLevel - CryptoMode From e70a29fc9913afc386121d1c9802ce914839dd1f Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 15 Jun 2026 11:50:26 +0200 Subject: [PATCH 16/41] tests: enum CryptoImplementationPlatform Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 2 + ..._CryptoImplementationPlatform-1.6.json.bin | 220 ++++++++++++++++++ ...m_CryptoImplementationPlatform-1.6.xml.bin | 154 ++++++++++++ ..._CryptoImplementationPlatform-1.7.json.bin | 220 ++++++++++++++++++ ...m_CryptoImplementationPlatform-1.7.xml.bin | 154 ++++++++++++ tests/test_enums.py | 31 ++- 6 files changed, 780 insertions(+), 1 deletion(-) create mode 100644 tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.xml.bin diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index 746a6deec..928e9f57a 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -117,6 +117,8 @@ class CryptoExecutionEnvironment(str, Enum): @serializable.serializable_enum class CryptoImplementationPlatform(str, Enum): + # TODO: rename to `CryptoAlgorithmImplementationPlatform` + """ This is our internal representation of the cryptoPropertiesType.algorithmProperties.implementationPlatform ENUM type within the CycloneDX standard. diff --git a/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.json.bin b/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.json.bin new file mode 100644 index 000000000..280d02b19 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.json.bin @@ -0,0 +1,220 @@ +{ + "components": [ + { + "bom-ref": "dummy-CIP:ARMV7_A", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv7-a" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV7_A", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV7_M", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv7-m" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV7_M", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV8_A", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv8-a" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV8_A", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV8_M", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv8-m" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV8_M", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV9_A", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv9-a" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV9_A", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV9_M", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv9-m" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV9_M", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:GENERIC", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "generic" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: GENERIC", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:PPC64", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "ppc64" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: PPC64", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:PPC64LE", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "ppc64le" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: PPC64LE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:S390X", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "s390x" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: S390X", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: UNKNOWN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:X86_32", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "x86_32" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: X86_32", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:X86_64", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "x86_64" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: X86_64", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CIP:ARMV7_A" + }, + { + "ref": "dummy-CIP:ARMV7_M" + }, + { + "ref": "dummy-CIP:ARMV8_A" + }, + { + "ref": "dummy-CIP:ARMV8_M" + }, + { + "ref": "dummy-CIP:ARMV9_A" + }, + { + "ref": "dummy-CIP:ARMV9_M" + }, + { + "ref": "dummy-CIP:GENERIC" + }, + { + "ref": "dummy-CIP:OTHER" + }, + { + "ref": "dummy-CIP:PPC64" + }, + { + "ref": "dummy-CIP:PPC64LE" + }, + { + "ref": "dummy-CIP:S390X" + }, + { + "ref": "dummy-CIP:UNKNOWN" + }, + { + "ref": "dummy-CIP:X86_32" + }, + { + "ref": "dummy-CIP:X86_64" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.xml.bin new file mode 100644 index 000000000..ab0c204ec --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.xml.bin @@ -0,0 +1,154 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoImplementationPlatform: ARMV7_A + + algorithm + + armv7-a + + + + + CryptoImplementationPlatform: ARMV7_M + + algorithm + + armv7-m + + + + + CryptoImplementationPlatform: ARMV8_A + + algorithm + + armv8-a + + + + + CryptoImplementationPlatform: ARMV8_M + + algorithm + + armv8-m + + + + + CryptoImplementationPlatform: ARMV9_A + + algorithm + + armv9-a + + + + + CryptoImplementationPlatform: ARMV9_M + + algorithm + + armv9-m + + + + + CryptoImplementationPlatform: GENERIC + + algorithm + + generic + + + + + CryptoImplementationPlatform: OTHER + + algorithm + + other + + + + + CryptoImplementationPlatform: PPC64 + + algorithm + + ppc64 + + + + + CryptoImplementationPlatform: PPC64LE + + algorithm + + ppc64le + + + + + CryptoImplementationPlatform: S390X + + algorithm + + s390x + + + + + CryptoImplementationPlatform: UNKNOWN + + algorithm + + unknown + + + + + CryptoImplementationPlatform: X86_32 + + algorithm + + x86_32 + + + + + CryptoImplementationPlatform: X86_64 + + algorithm + + x86_64 + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.json.bin b/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.json.bin new file mode 100644 index 000000000..d3d88155f --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.json.bin @@ -0,0 +1,220 @@ +{ + "components": [ + { + "bom-ref": "dummy-CIP:ARMV7_A", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv7-a" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV7_A", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV7_M", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv7-m" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV7_M", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV8_A", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv8-a" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV8_A", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV8_M", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv8-m" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV8_M", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV9_A", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv9-a" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV9_A", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ARMV9_M", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "armv9-m" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: ARMV9_M", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:GENERIC", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "generic" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: GENERIC", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:PPC64", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "ppc64" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: PPC64", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:PPC64LE", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "ppc64le" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: PPC64LE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:S390X", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "s390x" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: S390X", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: UNKNOWN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:X86_32", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "x86_32" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: X86_32", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:X86_64", + "cryptoProperties": { + "algorithmProperties": { + "implementationPlatform": "x86_64" + }, + "assetType": "algorithm" + }, + "name": "CryptoImplementationPlatform: X86_64", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CIP:ARMV7_A" + }, + { + "ref": "dummy-CIP:ARMV7_M" + }, + { + "ref": "dummy-CIP:ARMV8_A" + }, + { + "ref": "dummy-CIP:ARMV8_M" + }, + { + "ref": "dummy-CIP:ARMV9_A" + }, + { + "ref": "dummy-CIP:ARMV9_M" + }, + { + "ref": "dummy-CIP:GENERIC" + }, + { + "ref": "dummy-CIP:OTHER" + }, + { + "ref": "dummy-CIP:PPC64" + }, + { + "ref": "dummy-CIP:PPC64LE" + }, + { + "ref": "dummy-CIP:S390X" + }, + { + "ref": "dummy-CIP:UNKNOWN" + }, + { + "ref": "dummy-CIP:X86_32" + }, + { + "ref": "dummy-CIP:X86_64" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.xml.bin new file mode 100644 index 000000000..91b0c9a0b --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.xml.bin @@ -0,0 +1,154 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoImplementationPlatform: ARMV7_A + + algorithm + + armv7-a + + + + + CryptoImplementationPlatform: ARMV7_M + + algorithm + + armv7-m + + + + + CryptoImplementationPlatform: ARMV8_A + + algorithm + + armv8-a + + + + + CryptoImplementationPlatform: ARMV8_M + + algorithm + + armv8-m + + + + + CryptoImplementationPlatform: ARMV9_A + + algorithm + + armv9-a + + + + + CryptoImplementationPlatform: ARMV9_M + + algorithm + + armv9-m + + + + + CryptoImplementationPlatform: GENERIC + + algorithm + + generic + + + + + CryptoImplementationPlatform: OTHER + + algorithm + + other + + + + + CryptoImplementationPlatform: PPC64 + + algorithm + + ppc64 + + + + + CryptoImplementationPlatform: PPC64LE + + algorithm + + ppc64le + + + + + CryptoImplementationPlatform: S390X + + algorithm + + s390x + + + + + CryptoImplementationPlatform: UNKNOWN + + algorithm + + unknown + + + + + CryptoImplementationPlatform: X86_32 + + algorithm + + x86_32 + + + + + CryptoImplementationPlatform: X86_64 + + algorithm + + x86_64 + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/test_enums.py b/tests/test_enums.py index 2616688ba..a92b05c05 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -702,6 +702,36 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) + +@ddt +class TestEnumCryptoImplementationPlatform (_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='implementationPlatform']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'implementationPlatform'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(CryptoImplementationPlatform, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'CryptoImplementationPlatform: {cip.name}', bom_ref=f'dummy-CIP:{cip.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.ALGORITHM, + algorithm_properties=AlgorithmProperties( + implementation_platform=cip + ) + ) + ) for cip in CryptoImplementationPlatform + ]) + super()._test_cases_render(bom, of, sv) + + + """ @ddt class TestEnum...(_EnumTestCase): @@ -725,7 +755,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, """ missing: -- CryptoImplementationPlatform - CryptoCertificationLevel - CryptoMode - CryptoPadding From d27a09713f32726c960db5726d85382f2c13851d Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 15 Jun 2026 12:08:25 +0200 Subject: [PATCH 17/41] tests: enum CryptoCertificationLevel Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 4 +- ...enum_CryptoCertificationLevel-1.6.json.bin | 488 ++++++++++++++++++ .../enum_CryptoCertificationLevel-1.6.xml.bin | 304 +++++++++++ ...enum_CryptoCertificationLevel-1.7.json.bin | 488 ++++++++++++++++++ .../enum_CryptoCertificationLevel-1.7.xml.bin | 304 +++++++++++ tests/test_enums.py | 29 +- 6 files changed, 1615 insertions(+), 2 deletions(-) create mode 100644 tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.xml.bin diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index 928e9f57a..012975f2b 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -136,7 +136,7 @@ class CryptoImplementationPlatform(str, Enum): ARMV8_M = 'armv8-m' ARMV9_A = 'armv9-a' ARMV9_M = 'armv9-m' - GENERIC = 'generic' + GENERIC = 'generic' # TODO: move down PPC64 = 'ppc64' PPC64LE = 'ppc64le' S390X = 's390x' @@ -149,6 +149,8 @@ class CryptoImplementationPlatform(str, Enum): @serializable.serializable_enum class CryptoCertificationLevel(str, Enum): + # TODO: move to `CryptoAlgorithmCertificationLevel` + """ This is our internal representation of the cryptoPropertiesType.algorithmProperties.certificationLevel ENUM type within the CycloneDX standard. diff --git a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.json.bin b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.json.bin new file mode 100644 index 000000000..9256e7355 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.json.bin @@ -0,0 +1,488 @@ +{ + "components": [ + { + "bom-ref": "dummy-CIP:CC_EAL1", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal1" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL1", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL1_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal1+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL1_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL2", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal2" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL2", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL2_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal2+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL2_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL3", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal3" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL3", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL3_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal3+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL3_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL4", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal4" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL4", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL4_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal4+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL4_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL5", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal5" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL5", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL5_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal5+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL5_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL6", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal6" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL6", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL6_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal6+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL6_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL7", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal7" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL7", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL7_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal7+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL7_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_1_L1", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-1-l1" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_1_L1", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_1_L2", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-1-l2" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_1_L2", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_1_L3", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-1-l3" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_1_L3", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_1_L4", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-1-l4" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_1_L4", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_2_L1", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-2-l1" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_2_L1", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_2_L2", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-2-l2" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_2_L2", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_2_L3", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-2-l3" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_2_L3", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_2_L4", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-2-l4" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_2_L4", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_3_L1", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-3-l1" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_3_L1", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_3_L2", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-3-l2" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_3_L2", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_3_L3", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-3-l3" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_3_L3", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_3_L4", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-3-l4" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_3_L4", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:NONE", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "none" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: NONE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "other" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "unknown" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CIP:CC_EAL1" + }, + { + "ref": "dummy-CIP:CC_EAL1_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL2" + }, + { + "ref": "dummy-CIP:CC_EAL2_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL3" + }, + { + "ref": "dummy-CIP:CC_EAL3_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL4" + }, + { + "ref": "dummy-CIP:CC_EAL4_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL5" + }, + { + "ref": "dummy-CIP:CC_EAL5_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL6" + }, + { + "ref": "dummy-CIP:CC_EAL6_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL7" + }, + { + "ref": "dummy-CIP:CC_EAL7_PLUS" + }, + { + "ref": "dummy-CIP:FIPS140_1_L1" + }, + { + "ref": "dummy-CIP:FIPS140_1_L2" + }, + { + "ref": "dummy-CIP:FIPS140_1_L3" + }, + { + "ref": "dummy-CIP:FIPS140_1_L4" + }, + { + "ref": "dummy-CIP:FIPS140_2_L1" + }, + { + "ref": "dummy-CIP:FIPS140_2_L2" + }, + { + "ref": "dummy-CIP:FIPS140_2_L3" + }, + { + "ref": "dummy-CIP:FIPS140_2_L4" + }, + { + "ref": "dummy-CIP:FIPS140_3_L1" + }, + { + "ref": "dummy-CIP:FIPS140_3_L2" + }, + { + "ref": "dummy-CIP:FIPS140_3_L3" + }, + { + "ref": "dummy-CIP:FIPS140_3_L4" + }, + { + "ref": "dummy-CIP:NONE" + }, + { + "ref": "dummy-CIP:OTHER" + }, + { + "ref": "dummy-CIP:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.xml.bin new file mode 100644 index 000000000..3915c3edd --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.xml.bin @@ -0,0 +1,304 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoCertificationLevel: CC_EAL1 + + algorithm + + cc-eal1 + + + + + CryptoCertificationLevel: CC_EAL1_PLUS + + algorithm + + cc-eal1+ + + + + + CryptoCertificationLevel: CC_EAL2 + + algorithm + + cc-eal2 + + + + + CryptoCertificationLevel: CC_EAL2_PLUS + + algorithm + + cc-eal2+ + + + + + CryptoCertificationLevel: CC_EAL3 + + algorithm + + cc-eal3 + + + + + CryptoCertificationLevel: CC_EAL3_PLUS + + algorithm + + cc-eal3+ + + + + + CryptoCertificationLevel: CC_EAL4 + + algorithm + + cc-eal4 + + + + + CryptoCertificationLevel: CC_EAL4_PLUS + + algorithm + + cc-eal4+ + + + + + CryptoCertificationLevel: CC_EAL5 + + algorithm + + cc-eal5 + + + + + CryptoCertificationLevel: CC_EAL5_PLUS + + algorithm + + cc-eal5+ + + + + + CryptoCertificationLevel: CC_EAL6 + + algorithm + + cc-eal6 + + + + + CryptoCertificationLevel: CC_EAL6_PLUS + + algorithm + + cc-eal6+ + + + + + CryptoCertificationLevel: CC_EAL7 + + algorithm + + cc-eal7 + + + + + CryptoCertificationLevel: CC_EAL7_PLUS + + algorithm + + cc-eal7+ + + + + + CryptoCertificationLevel: FIPS140_1_L1 + + algorithm + + fips140-1-l1 + + + + + CryptoCertificationLevel: FIPS140_1_L2 + + algorithm + + fips140-1-l2 + + + + + CryptoCertificationLevel: FIPS140_1_L3 + + algorithm + + fips140-1-l3 + + + + + CryptoCertificationLevel: FIPS140_1_L4 + + algorithm + + fips140-1-l4 + + + + + CryptoCertificationLevel: FIPS140_2_L1 + + algorithm + + fips140-2-l1 + + + + + CryptoCertificationLevel: FIPS140_2_L2 + + algorithm + + fips140-2-l2 + + + + + CryptoCertificationLevel: FIPS140_2_L3 + + algorithm + + fips140-2-l3 + + + + + CryptoCertificationLevel: FIPS140_2_L4 + + algorithm + + fips140-2-l4 + + + + + CryptoCertificationLevel: FIPS140_3_L1 + + algorithm + + fips140-3-l1 + + + + + CryptoCertificationLevel: FIPS140_3_L2 + + algorithm + + fips140-3-l2 + + + + + CryptoCertificationLevel: FIPS140_3_L3 + + algorithm + + fips140-3-l3 + + + + + CryptoCertificationLevel: FIPS140_3_L4 + + algorithm + + fips140-3-l4 + + + + + CryptoCertificationLevel: NONE + + algorithm + + none + + + + + CryptoCertificationLevel: OTHER + + algorithm + + other + + + + + CryptoCertificationLevel: UNKNOWN + + algorithm + + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.json.bin b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.json.bin new file mode 100644 index 000000000..38cf174dd --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.json.bin @@ -0,0 +1,488 @@ +{ + "components": [ + { + "bom-ref": "dummy-CIP:CC_EAL1", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal1" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL1", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL1_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal1+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL1_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL2", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal2" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL2", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL2_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal2+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL2_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL3", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal3" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL3", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL3_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal3+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL3_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL4", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal4" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL4", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL4_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal4+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL4_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL5", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal5" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL5", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL5_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal5+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL5_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL6", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal6" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL6", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL6_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal6+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL6_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL7", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal7" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL7", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CC_EAL7_PLUS", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "cc-eal7+" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: CC_EAL7_PLUS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_1_L1", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-1-l1" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_1_L1", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_1_L2", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-1-l2" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_1_L2", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_1_L3", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-1-l3" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_1_L3", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_1_L4", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-1-l4" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_1_L4", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_2_L1", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-2-l1" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_2_L1", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_2_L2", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-2-l2" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_2_L2", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_2_L3", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-2-l3" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_2_L3", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_2_L4", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-2-l4" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_2_L4", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_3_L1", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-3-l1" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_3_L1", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_3_L2", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-3-l2" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_3_L2", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_3_L3", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-3-l3" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_3_L3", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:FIPS140_3_L4", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "fips140-3-l4" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: FIPS140_3_L4", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:NONE", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "none" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: NONE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "other" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "certificationLevel": [ + "unknown" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoCertificationLevel: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CIP:CC_EAL1" + }, + { + "ref": "dummy-CIP:CC_EAL1_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL2" + }, + { + "ref": "dummy-CIP:CC_EAL2_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL3" + }, + { + "ref": "dummy-CIP:CC_EAL3_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL4" + }, + { + "ref": "dummy-CIP:CC_EAL4_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL5" + }, + { + "ref": "dummy-CIP:CC_EAL5_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL6" + }, + { + "ref": "dummy-CIP:CC_EAL6_PLUS" + }, + { + "ref": "dummy-CIP:CC_EAL7" + }, + { + "ref": "dummy-CIP:CC_EAL7_PLUS" + }, + { + "ref": "dummy-CIP:FIPS140_1_L1" + }, + { + "ref": "dummy-CIP:FIPS140_1_L2" + }, + { + "ref": "dummy-CIP:FIPS140_1_L3" + }, + { + "ref": "dummy-CIP:FIPS140_1_L4" + }, + { + "ref": "dummy-CIP:FIPS140_2_L1" + }, + { + "ref": "dummy-CIP:FIPS140_2_L2" + }, + { + "ref": "dummy-CIP:FIPS140_2_L3" + }, + { + "ref": "dummy-CIP:FIPS140_2_L4" + }, + { + "ref": "dummy-CIP:FIPS140_3_L1" + }, + { + "ref": "dummy-CIP:FIPS140_3_L2" + }, + { + "ref": "dummy-CIP:FIPS140_3_L3" + }, + { + "ref": "dummy-CIP:FIPS140_3_L4" + }, + { + "ref": "dummy-CIP:NONE" + }, + { + "ref": "dummy-CIP:OTHER" + }, + { + "ref": "dummy-CIP:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.xml.bin new file mode 100644 index 000000000..a4cbd6386 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.xml.bin @@ -0,0 +1,304 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoCertificationLevel: CC_EAL1 + + algorithm + + cc-eal1 + + + + + CryptoCertificationLevel: CC_EAL1_PLUS + + algorithm + + cc-eal1+ + + + + + CryptoCertificationLevel: CC_EAL2 + + algorithm + + cc-eal2 + + + + + CryptoCertificationLevel: CC_EAL2_PLUS + + algorithm + + cc-eal2+ + + + + + CryptoCertificationLevel: CC_EAL3 + + algorithm + + cc-eal3 + + + + + CryptoCertificationLevel: CC_EAL3_PLUS + + algorithm + + cc-eal3+ + + + + + CryptoCertificationLevel: CC_EAL4 + + algorithm + + cc-eal4 + + + + + CryptoCertificationLevel: CC_EAL4_PLUS + + algorithm + + cc-eal4+ + + + + + CryptoCertificationLevel: CC_EAL5 + + algorithm + + cc-eal5 + + + + + CryptoCertificationLevel: CC_EAL5_PLUS + + algorithm + + cc-eal5+ + + + + + CryptoCertificationLevel: CC_EAL6 + + algorithm + + cc-eal6 + + + + + CryptoCertificationLevel: CC_EAL6_PLUS + + algorithm + + cc-eal6+ + + + + + CryptoCertificationLevel: CC_EAL7 + + algorithm + + cc-eal7 + + + + + CryptoCertificationLevel: CC_EAL7_PLUS + + algorithm + + cc-eal7+ + + + + + CryptoCertificationLevel: FIPS140_1_L1 + + algorithm + + fips140-1-l1 + + + + + CryptoCertificationLevel: FIPS140_1_L2 + + algorithm + + fips140-1-l2 + + + + + CryptoCertificationLevel: FIPS140_1_L3 + + algorithm + + fips140-1-l3 + + + + + CryptoCertificationLevel: FIPS140_1_L4 + + algorithm + + fips140-1-l4 + + + + + CryptoCertificationLevel: FIPS140_2_L1 + + algorithm + + fips140-2-l1 + + + + + CryptoCertificationLevel: FIPS140_2_L2 + + algorithm + + fips140-2-l2 + + + + + CryptoCertificationLevel: FIPS140_2_L3 + + algorithm + + fips140-2-l3 + + + + + CryptoCertificationLevel: FIPS140_2_L4 + + algorithm + + fips140-2-l4 + + + + + CryptoCertificationLevel: FIPS140_3_L1 + + algorithm + + fips140-3-l1 + + + + + CryptoCertificationLevel: FIPS140_3_L2 + + algorithm + + fips140-3-l2 + + + + + CryptoCertificationLevel: FIPS140_3_L3 + + algorithm + + fips140-3-l3 + + + + + CryptoCertificationLevel: FIPS140_3_L4 + + algorithm + + fips140-3-l4 + + + + + CryptoCertificationLevel: NONE + + algorithm + + none + + + + + CryptoCertificationLevel: OTHER + + algorithm + + other + + + + + CryptoCertificationLevel: UNKNOWN + + algorithm + + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/test_enums.py b/tests/test_enums.py index a92b05c05..27b88fd0e 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -731,6 +731,33 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) +@ddt +class TestEnumCryptoCertificationLevel (_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='certificationLevel']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'certificationLevel', 'items'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(CryptoCertificationLevel, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'CryptoCertificationLevel: {ccl.name}', bom_ref=f'dummy-CIP:{ccl.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.ALGORITHM, + algorithm_properties=AlgorithmProperties( + certification_levels=[ccl] + ) + ) + ) for ccl in CryptoCertificationLevel + ]) + super()._test_cases_render(bom, of, sv) + """ @ddt @@ -743,7 +770,7 @@ class TestEnum...(_EnumTestCase): def test_knows_value(self, value: str) -> None: super()._test_knows_value(..., value) - @named_data(*NAMED_OF_SV) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ From fef2e7c541178e310181773e7446310fb5a0bc67 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 15 Jun 2026 12:14:12 +0200 Subject: [PATCH 18/41] tests: enum CryptoMode Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 2 ++ tests/test_enums.py | 31 +++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index 012975f2b..6eee07d53 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -197,6 +197,8 @@ class CryptoCertificationLevel(str, Enum): @serializable.serializable_enum class CryptoMode(str, Enum): + # TODO: rename to `CryptoAlgorithmMode` + """ This is our internal representation of the cryptoPropertiesType.algorithmProperties.mode ENUM type within the CycloneDX standard. diff --git a/tests/test_enums.py b/tests/test_enums.py index 27b88fd0e..550f7e43a 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -759,6 +759,35 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) + +@ddt +class TestEnumCryptoMode(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='mode']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'mode'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(CryptoMode, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'CryptoMode: {cm.name}', bom_ref=f'dummy-CIP:{cm.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.ALGORITHM, + algorithm_properties=AlgorithmProperties( + mode=cm + ) + ) + ) for cm in CryptoMode + ]) + super()._test_cases_render(bom, of, sv) + + """ @ddt class TestEnum...(_EnumTestCase): @@ -782,8 +811,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, """ missing: -- CryptoCertificationLevel -- CryptoMode - CryptoPadding - CryptoFunction - RelatedCryptoMaterialType From 0c54bb45c7a24be97c0d7587ee6225dad1c97b62 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 15 Jun 2026 12:14:16 +0200 Subject: [PATCH 19/41] tests: enum CryptoMode Signed-off-by: Jan Kowalleck --- .../snapshots/enum_CryptoMode-1.6.json.bin | 150 ++++++++++++++++++ .../snapshots/enum_CryptoMode-1.6.xml.bin | 104 ++++++++++++ .../snapshots/enum_CryptoMode-1.7.json.bin | 150 ++++++++++++++++++ .../snapshots/enum_CryptoMode-1.7.xml.bin | 104 ++++++++++++ 4 files changed, 508 insertions(+) create mode 100644 tests/_data/snapshots/enum_CryptoMode-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoMode-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_CryptoMode-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoMode-1.7.xml.bin diff --git a/tests/_data/snapshots/enum_CryptoMode-1.6.json.bin b/tests/_data/snapshots/enum_CryptoMode-1.6.json.bin new file mode 100644 index 000000000..c949862ac --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoMode-1.6.json.bin @@ -0,0 +1,150 @@ +{ + "components": [ + { + "bom-ref": "dummy-CIP:CBC", + "cryptoProperties": { + "algorithmProperties": { + "mode": "cbc" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: CBC", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CCM", + "cryptoProperties": { + "algorithmProperties": { + "mode": "ccm" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: CCM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CFB", + "cryptoProperties": { + "algorithmProperties": { + "mode": "cfb" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: CFB", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CTR", + "cryptoProperties": { + "algorithmProperties": { + "mode": "ctr" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: CTR", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ECB", + "cryptoProperties": { + "algorithmProperties": { + "mode": "ecb" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: ECB", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:GCM", + "cryptoProperties": { + "algorithmProperties": { + "mode": "gcm" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: GCM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:OFB", + "cryptoProperties": { + "algorithmProperties": { + "mode": "ofb" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: OFB", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "mode": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "mode": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CIP:CBC" + }, + { + "ref": "dummy-CIP:CCM" + }, + { + "ref": "dummy-CIP:CFB" + }, + { + "ref": "dummy-CIP:CTR" + }, + { + "ref": "dummy-CIP:ECB" + }, + { + "ref": "dummy-CIP:GCM" + }, + { + "ref": "dummy-CIP:OFB" + }, + { + "ref": "dummy-CIP:OTHER" + }, + { + "ref": "dummy-CIP:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoMode-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoMode-1.6.xml.bin new file mode 100644 index 000000000..db49f73d9 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoMode-1.6.xml.bin @@ -0,0 +1,104 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoMode: CBC + + algorithm + + cbc + + + + + CryptoMode: CCM + + algorithm + + ccm + + + + + CryptoMode: CFB + + algorithm + + cfb + + + + + CryptoMode: CTR + + algorithm + + ctr + + + + + CryptoMode: ECB + + algorithm + + ecb + + + + + CryptoMode: GCM + + algorithm + + gcm + + + + + CryptoMode: OFB + + algorithm + + ofb + + + + + CryptoMode: OTHER + + algorithm + + other + + + + + CryptoMode: UNKNOWN + + algorithm + + unknown + + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_CryptoMode-1.7.json.bin b/tests/_data/snapshots/enum_CryptoMode-1.7.json.bin new file mode 100644 index 000000000..5275eba9e --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoMode-1.7.json.bin @@ -0,0 +1,150 @@ +{ + "components": [ + { + "bom-ref": "dummy-CIP:CBC", + "cryptoProperties": { + "algorithmProperties": { + "mode": "cbc" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: CBC", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CCM", + "cryptoProperties": { + "algorithmProperties": { + "mode": "ccm" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: CCM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CFB", + "cryptoProperties": { + "algorithmProperties": { + "mode": "cfb" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: CFB", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:CTR", + "cryptoProperties": { + "algorithmProperties": { + "mode": "ctr" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: CTR", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:ECB", + "cryptoProperties": { + "algorithmProperties": { + "mode": "ecb" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: ECB", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:GCM", + "cryptoProperties": { + "algorithmProperties": { + "mode": "gcm" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: GCM", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:OFB", + "cryptoProperties": { + "algorithmProperties": { + "mode": "ofb" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: OFB", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "mode": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CIP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "mode": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoMode: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CIP:CBC" + }, + { + "ref": "dummy-CIP:CCM" + }, + { + "ref": "dummy-CIP:CFB" + }, + { + "ref": "dummy-CIP:CTR" + }, + { + "ref": "dummy-CIP:ECB" + }, + { + "ref": "dummy-CIP:GCM" + }, + { + "ref": "dummy-CIP:OFB" + }, + { + "ref": "dummy-CIP:OTHER" + }, + { + "ref": "dummy-CIP:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoMode-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoMode-1.7.xml.bin new file mode 100644 index 000000000..25618f714 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoMode-1.7.xml.bin @@ -0,0 +1,104 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoMode: CBC + + algorithm + + cbc + + + + + CryptoMode: CCM + + algorithm + + ccm + + + + + CryptoMode: CFB + + algorithm + + cfb + + + + + CryptoMode: CTR + + algorithm + + ctr + + + + + CryptoMode: ECB + + algorithm + + ecb + + + + + CryptoMode: GCM + + algorithm + + gcm + + + + + CryptoMode: OFB + + algorithm + + ofb + + + + + CryptoMode: OTHER + + algorithm + + other + + + + + CryptoMode: UNKNOWN + + algorithm + + unknown + + + + + + + + + + + + + + + + + val1 + val2 + + From b87c379cd9d1d321b2fbcca7d2463056b49acdbd Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Tue, 16 Jun 2026 17:45:27 +0200 Subject: [PATCH 20/41] CryptoPadding Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 2 ++ tests/test_enums.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index 6eee07d53..ddf693e5d 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -224,6 +224,8 @@ class CryptoMode(str, Enum): @serializable.serializable_enum class CryptoPadding(str, Enum): + # TODO: rename to `CryptoAlgorithmPadding` + """ This is our internal representation of the cryptoPropertiesType.algorithmProperties.padding ENUM type within the CycloneDX standard. diff --git a/tests/test_enums.py b/tests/test_enums.py index 550f7e43a..5089521d4 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -788,6 +788,34 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) +@ddt +class TestEnumCryptoPadding(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='padding']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'padding'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(CryptoPadding, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'CryptoPadding: {cp.name}', bom_ref=f'dummy-CP:{cp.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.ALGORITHM, + algorithm_properties=AlgorithmProperties( + padding=cp + ) + ) + ) for cp in CryptoPadding + ]) + super()._test_cases_render(bom, of, sv) + + """ @ddt class TestEnum...(_EnumTestCase): From c8307d8ac10bdcc0fb93622e678d1dc2c835f834 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Tue, 16 Jun 2026 17:46:30 +0200 Subject: [PATCH 21/41] tests Signed-off-by: Jan Kowalleck --- .../snapshots/enum_CryptoPadding-1.6.json.bin | 122 ++++++++++++++++++ .../snapshots/enum_CryptoPadding-1.6.xml.bin | 84 ++++++++++++ .../snapshots/enum_CryptoPadding-1.7.json.bin | 122 ++++++++++++++++++ .../snapshots/enum_CryptoPadding-1.7.xml.bin | 84 ++++++++++++ tests/test_enums.py | 4 +- 5 files changed, 414 insertions(+), 2 deletions(-) create mode 100644 tests/_data/snapshots/enum_CryptoPadding-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoPadding-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_CryptoPadding-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoPadding-1.7.xml.bin diff --git a/tests/_data/snapshots/enum_CryptoPadding-1.6.json.bin b/tests/_data/snapshots/enum_CryptoPadding-1.6.json.bin new file mode 100644 index 000000000..38a6cf926 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoPadding-1.6.json.bin @@ -0,0 +1,122 @@ +{ + "components": [ + { + "bom-ref": "dummy-CP:OAEP", + "cryptoProperties": { + "algorithmProperties": { + "padding": "oaep" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: OAEP", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "padding": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:PKCS1V15", + "cryptoProperties": { + "algorithmProperties": { + "padding": "pkcs1v15" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: PKCS1V15", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:PKCS5", + "cryptoProperties": { + "algorithmProperties": { + "padding": "pkcs5" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: PKCS5", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:PKCS7", + "cryptoProperties": { + "algorithmProperties": { + "padding": "pkcs7" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: PKCS7", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:RAW", + "cryptoProperties": { + "algorithmProperties": { + "padding": "raw" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: RAW", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "padding": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CP:OAEP" + }, + { + "ref": "dummy-CP:OTHER" + }, + { + "ref": "dummy-CP:PKCS1V15" + }, + { + "ref": "dummy-CP:PKCS5" + }, + { + "ref": "dummy-CP:PKCS7" + }, + { + "ref": "dummy-CP:RAW" + }, + { + "ref": "dummy-CP:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoPadding-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoPadding-1.6.xml.bin new file mode 100644 index 000000000..6d9355ced --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoPadding-1.6.xml.bin @@ -0,0 +1,84 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoPadding: OAEP + + algorithm + + oaep + + + + + CryptoPadding: OTHER + + algorithm + + other + + + + + CryptoPadding: PKCS1V15 + + algorithm + + pkcs1v15 + + + + + CryptoPadding: PKCS5 + + algorithm + + pkcs5 + + + + + CryptoPadding: PKCS7 + + algorithm + + pkcs7 + + + + + CryptoPadding: RAW + + algorithm + + raw + + + + + CryptoPadding: UNKNOWN + + algorithm + + unknown + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_CryptoPadding-1.7.json.bin b/tests/_data/snapshots/enum_CryptoPadding-1.7.json.bin new file mode 100644 index 000000000..7b51708bd --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoPadding-1.7.json.bin @@ -0,0 +1,122 @@ +{ + "components": [ + { + "bom-ref": "dummy-CP:OAEP", + "cryptoProperties": { + "algorithmProperties": { + "padding": "oaep" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: OAEP", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "padding": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:PKCS1V15", + "cryptoProperties": { + "algorithmProperties": { + "padding": "pkcs1v15" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: PKCS1V15", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:PKCS5", + "cryptoProperties": { + "algorithmProperties": { + "padding": "pkcs5" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: PKCS5", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:PKCS7", + "cryptoProperties": { + "algorithmProperties": { + "padding": "pkcs7" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: PKCS7", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:RAW", + "cryptoProperties": { + "algorithmProperties": { + "padding": "raw" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: RAW", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CP:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "padding": "unknown" + }, + "assetType": "algorithm" + }, + "name": "CryptoPadding: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CP:OAEP" + }, + { + "ref": "dummy-CP:OTHER" + }, + { + "ref": "dummy-CP:PKCS1V15" + }, + { + "ref": "dummy-CP:PKCS5" + }, + { + "ref": "dummy-CP:PKCS7" + }, + { + "ref": "dummy-CP:RAW" + }, + { + "ref": "dummy-CP:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoPadding-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoPadding-1.7.xml.bin new file mode 100644 index 000000000..17317828f --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoPadding-1.7.xml.bin @@ -0,0 +1,84 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoPadding: OAEP + + algorithm + + oaep + + + + + CryptoPadding: OTHER + + algorithm + + other + + + + + CryptoPadding: PKCS1V15 + + algorithm + + pkcs1v15 + + + + + CryptoPadding: PKCS5 + + algorithm + + pkcs5 + + + + + CryptoPadding: PKCS7 + + algorithm + + pkcs7 + + + + + CryptoPadding: RAW + + algorithm + + raw + + + + + CryptoPadding: UNKNOWN + + algorithm + + unknown + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/test_enums.py b/tests/test_enums.py index 5089521d4..b25fc9465 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -746,7 +746,7 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, bom = _make_bom( components=[ Component( - name=f'CryptoCertificationLevel: {ccl.name}', bom_ref=f'dummy-CIP:{ccl.name}', + name=f'CryptoCertificationLevel: {ccl.name}', bom_ref=f'dummy-CCL:{ccl.name}', type=ComponentType.CRYPTOGRAPHIC_ASSET, crypto_properties=CryptoProperties( asset_type=CryptoAssetType.ALGORITHM, @@ -775,7 +775,7 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, bom = _make_bom( components=[ Component( - name=f'CryptoMode: {cm.name}', bom_ref=f'dummy-CIP:{cm.name}', + name=f'CryptoMode: {cm.name}', bom_ref=f'dummy-CM:{cm.name}', type=ComponentType.CRYPTOGRAPHIC_ASSET, crypto_properties=CryptoProperties( asset_type=CryptoAssetType.ALGORITHM, From 29a3298f8f3dcc45b42a4b6ab8393b2b2e95afc4 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Tue, 16 Jun 2026 17:52:43 +0200 Subject: [PATCH 22/41] CryptoFunction Signed-off-by: Jan Kowalleck --- .../enum_CryptoFunction-1.6.json.bin | 232 ++++++++++++++++++ .../snapshots/enum_CryptoFunction-1.6.xml.bin | 170 +++++++++++++ .../enum_CryptoFunction-1.7.json.bin | 232 ++++++++++++++++++ .../snapshots/enum_CryptoFunction-1.7.xml.bin | 170 +++++++++++++ tests/test_enums.py | 30 ++- 5 files changed, 832 insertions(+), 2 deletions(-) create mode 100644 tests/_data/snapshots/enum_CryptoFunction-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoFunction-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_CryptoFunction-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_CryptoFunction-1.7.xml.bin diff --git a/tests/_data/snapshots/enum_CryptoFunction-1.6.json.bin b/tests/_data/snapshots/enum_CryptoFunction-1.6.json.bin new file mode 100644 index 000000000..2c1b1277e --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoFunction-1.6.json.bin @@ -0,0 +1,232 @@ +{ + "components": [ + { + "bom-ref": "dummy-CF:DECAPSULATE", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "decapsulate" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: DECAPSULATE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:DECRYPT", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "decrypt" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: DECRYPT", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:DIGEST", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "digest" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: DIGEST", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:ENCAPSULATE", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "encapsulate" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: ENCAPSULATE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:ENCRYPT", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "encrypt" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: ENCRYPT", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:GENERATE", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "generate" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: GENERATE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:KEYDERIVE", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "keyderive" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: KEYDERIVE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:KEYGEN", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "keygen" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: KEYGEN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "other" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:SIGN", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "sign" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: SIGN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:TAG", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "tag" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: TAG", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "unknown" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: UNKNOWN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:VERIFY", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "verify" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: VERIFY", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CF:DECAPSULATE" + }, + { + "ref": "dummy-CF:DECRYPT" + }, + { + "ref": "dummy-CF:DIGEST" + }, + { + "ref": "dummy-CF:ENCAPSULATE" + }, + { + "ref": "dummy-CF:ENCRYPT" + }, + { + "ref": "dummy-CF:GENERATE" + }, + { + "ref": "dummy-CF:KEYDERIVE" + }, + { + "ref": "dummy-CF:KEYGEN" + }, + { + "ref": "dummy-CF:OTHER" + }, + { + "ref": "dummy-CF:SIGN" + }, + { + "ref": "dummy-CF:TAG" + }, + { + "ref": "dummy-CF:UNKNOWN" + }, + { + "ref": "dummy-CF:VERIFY" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoFunction-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoFunction-1.6.xml.bin new file mode 100644 index 000000000..0a732b655 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoFunction-1.6.xml.bin @@ -0,0 +1,170 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoFunction: DECAPSULATE + + algorithm + + + decapsulate + + + + + + CryptoFunction: DECRYPT + + algorithm + + + decrypt + + + + + + CryptoFunction: DIGEST + + algorithm + + + digest + + + + + + CryptoFunction: ENCAPSULATE + + algorithm + + + encapsulate + + + + + + CryptoFunction: ENCRYPT + + algorithm + + + encrypt + + + + + + CryptoFunction: GENERATE + + algorithm + + + generate + + + + + + CryptoFunction: KEYDERIVE + + algorithm + + + keyderive + + + + + + CryptoFunction: KEYGEN + + algorithm + + + keygen + + + + + + CryptoFunction: OTHER + + algorithm + + + other + + + + + + CryptoFunction: SIGN + + algorithm + + + sign + + + + + + CryptoFunction: TAG + + algorithm + + + tag + + + + + + CryptoFunction: UNKNOWN + + algorithm + + + unknown + + + + + + CryptoFunction: VERIFY + + algorithm + + + verify + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_CryptoFunction-1.7.json.bin b/tests/_data/snapshots/enum_CryptoFunction-1.7.json.bin new file mode 100644 index 000000000..ee1ce1f57 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoFunction-1.7.json.bin @@ -0,0 +1,232 @@ +{ + "components": [ + { + "bom-ref": "dummy-CF:DECAPSULATE", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "decapsulate" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: DECAPSULATE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:DECRYPT", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "decrypt" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: DECRYPT", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:DIGEST", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "digest" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: DIGEST", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:ENCAPSULATE", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "encapsulate" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: ENCAPSULATE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:ENCRYPT", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "encrypt" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: ENCRYPT", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:GENERATE", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "generate" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: GENERATE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:KEYDERIVE", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "keyderive" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: KEYDERIVE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:KEYGEN", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "keygen" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: KEYGEN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:OTHER", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "other" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:SIGN", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "sign" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: SIGN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:TAG", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "tag" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: TAG", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:UNKNOWN", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "unknown" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: UNKNOWN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-CF:VERIFY", + "cryptoProperties": { + "algorithmProperties": { + "cryptoFunctions": [ + "verify" + ] + }, + "assetType": "algorithm" + }, + "name": "CryptoFunction: VERIFY", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-CF:DECAPSULATE" + }, + { + "ref": "dummy-CF:DECRYPT" + }, + { + "ref": "dummy-CF:DIGEST" + }, + { + "ref": "dummy-CF:ENCAPSULATE" + }, + { + "ref": "dummy-CF:ENCRYPT" + }, + { + "ref": "dummy-CF:GENERATE" + }, + { + "ref": "dummy-CF:KEYDERIVE" + }, + { + "ref": "dummy-CF:KEYGEN" + }, + { + "ref": "dummy-CF:OTHER" + }, + { + "ref": "dummy-CF:SIGN" + }, + { + "ref": "dummy-CF:TAG" + }, + { + "ref": "dummy-CF:UNKNOWN" + }, + { + "ref": "dummy-CF:VERIFY" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_CryptoFunction-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoFunction-1.7.xml.bin new file mode 100644 index 000000000..8a22c7d80 --- /dev/null +++ b/tests/_data/snapshots/enum_CryptoFunction-1.7.xml.bin @@ -0,0 +1,170 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + CryptoFunction: DECAPSULATE + + algorithm + + + decapsulate + + + + + + CryptoFunction: DECRYPT + + algorithm + + + decrypt + + + + + + CryptoFunction: DIGEST + + algorithm + + + digest + + + + + + CryptoFunction: ENCAPSULATE + + algorithm + + + encapsulate + + + + + + CryptoFunction: ENCRYPT + + algorithm + + + encrypt + + + + + + CryptoFunction: GENERATE + + algorithm + + + generate + + + + + + CryptoFunction: KEYDERIVE + + algorithm + + + keyderive + + + + + + CryptoFunction: KEYGEN + + algorithm + + + keygen + + + + + + CryptoFunction: OTHER + + algorithm + + + other + + + + + + CryptoFunction: SIGN + + algorithm + + + sign + + + + + + CryptoFunction: TAG + + algorithm + + + tag + + + + + + CryptoFunction: UNKNOWN + + algorithm + + + unknown + + + + + + CryptoFunction: VERIFY + + algorithm + + + verify + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/test_enums.py b/tests/test_enums.py index b25fc9465..50bf8954f 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -816,6 +816,34 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) +@ddt +class TestEnumCryptoFunction(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='cryptoFunctions']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='cryptoFunction']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'cryptoFunctions', 'items'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(CryptoFunction, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'CryptoFunction: {cf.name}', bom_ref=f'dummy-CF:{cf.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.ALGORITHM, + algorithm_properties=AlgorithmProperties( + crypto_functions=[cf] + ) + ) + ) for cf in CryptoFunction + ]) + super()._test_cases_render(bom, of, sv) + + """ @ddt class TestEnum...(_EnumTestCase): @@ -839,8 +867,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, """ missing: -- CryptoPadding -- CryptoFunction - RelatedCryptoMaterialType - RelatedCryptoMaterialState - ProtocolPropertiesType From aab68c0e7af3ff1548f073b8fd19e03a2d1e002a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 09:00:31 +0200 Subject: [PATCH 23/41] RelatedCryptoMaterialType Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 50bf8954f..ccf23ef90 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -36,7 +36,7 @@ from cyclonedx.model.bom import Bom, BomMetaData, DistributionConstraints, TlpClassification from cyclonedx.model.component import Component, Patch, Pedigree from cyclonedx.model.component_evidence import ComponentEvidence, Identity as CEIdentity, Method as CEMethod -from cyclonedx.model.crypto import CryptoProperties, AlgorithmProperties +from cyclonedx.model.crypto import CryptoProperties, AlgorithmProperties, RelatedCryptoMaterialProperties from cyclonedx.model.issue import IssueType from cyclonedx.model.license import DisjunctiveLicense from cyclonedx.model.lifecycle import LifecyclePhase, PredefinedLifecycle @@ -844,6 +844,35 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) + +@ddt +class TestEnumRelatedCryptoMaterialType(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='relatedCryptoMaterialProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='type']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'relatedCryptoMaterialProperties', 'properties', 'type'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(RelatedCryptoMaterialType, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'RelatedCryptoMaterialType: {rcmt.name}', bom_ref=f'dummy-RCMT:{rcmt.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.RELATED_CRYPTO_MATERIAL, + related_crypto_material_properties=RelatedCryptoMaterialProperties( + type=rcmt + ) + ) + ) for rcmt in RelatedCryptoMaterialType + ]) + super()._test_cases_render(bom, of, sv) + + """ @ddt class TestEnum...(_EnumTestCase): @@ -867,7 +896,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, """ missing: -- RelatedCryptoMaterialType - RelatedCryptoMaterialState - ProtocolPropertiesType """ From 2e8ea4eab505106885a56a7d854805f58fd0bae2 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 09:00:35 +0200 Subject: [PATCH 24/41] RelatedCryptoMaterialType Signed-off-by: Jan Kowalleck --- ...num_RelatedCryptoMaterialType-1.6.json.bin | 290 ++++++++++++++++++ ...enum_RelatedCryptoMaterialType-1.6.xml.bin | 204 ++++++++++++ ...num_RelatedCryptoMaterialType-1.7.json.bin | 290 ++++++++++++++++++ ...enum_RelatedCryptoMaterialType-1.7.xml.bin | 204 ++++++++++++ 4 files changed, 988 insertions(+) create mode 100644 tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.xml.bin diff --git a/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.6.json.bin b/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.6.json.bin new file mode 100644 index 000000000..3250a0e0b --- /dev/null +++ b/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.6.json.bin @@ -0,0 +1,290 @@ +{ + "components": [ + { + "bom-ref": "dummy-RCMT:ADDITIONAL_DATA", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "additional-data" + } + }, + "name": "RelatedCryptoMaterialType: ADDITIONAL_DATA", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:CIPHERTEXT", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "ciphertext" + } + }, + "name": "RelatedCryptoMaterialType: CIPHERTEXT", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:CREDENTIAL", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "credential" + } + }, + "name": "RelatedCryptoMaterialType: CREDENTIAL", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:DIGEST", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "digest" + } + }, + "name": "RelatedCryptoMaterialType: DIGEST", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:INITIALIZATION_VECTOR", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "initialization-vector" + } + }, + "name": "RelatedCryptoMaterialType: INITIALIZATION_VECTOR", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:KEY", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "key" + } + }, + "name": "RelatedCryptoMaterialType: KEY", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:NONCE", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "nonce" + } + }, + "name": "RelatedCryptoMaterialType: NONCE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:OTHER", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "other" + } + }, + "name": "RelatedCryptoMaterialType: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:PASSWORD", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "password" + } + }, + "name": "RelatedCryptoMaterialType: PASSWORD", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:PRIVATE_KEY", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "private-key" + } + }, + "name": "RelatedCryptoMaterialType: PRIVATE_KEY", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:PUBLIC_KEY", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "public-key" + } + }, + "name": "RelatedCryptoMaterialType: PUBLIC_KEY", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SALT", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "salt" + } + }, + "name": "RelatedCryptoMaterialType: SALT", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SECRET_KEY", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "secret-key" + } + }, + "name": "RelatedCryptoMaterialType: SECRET_KEY", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SEED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "seed" + } + }, + "name": "RelatedCryptoMaterialType: SEED", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SHARED_SECRET", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "shared-secret" + } + }, + "name": "RelatedCryptoMaterialType: SHARED_SECRET", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SIGNATURE", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "signature" + } + }, + "name": "RelatedCryptoMaterialType: SIGNATURE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:TAG", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "tag" + } + }, + "name": "RelatedCryptoMaterialType: TAG", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:TOKEN", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "token" + } + }, + "name": "RelatedCryptoMaterialType: TOKEN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:UNKNOWN", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "unknown" + } + }, + "name": "RelatedCryptoMaterialType: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-RCMT:ADDITIONAL_DATA" + }, + { + "ref": "dummy-RCMT:CIPHERTEXT" + }, + { + "ref": "dummy-RCMT:CREDENTIAL" + }, + { + "ref": "dummy-RCMT:DIGEST" + }, + { + "ref": "dummy-RCMT:INITIALIZATION_VECTOR" + }, + { + "ref": "dummy-RCMT:KEY" + }, + { + "ref": "dummy-RCMT:NONCE" + }, + { + "ref": "dummy-RCMT:OTHER" + }, + { + "ref": "dummy-RCMT:PASSWORD" + }, + { + "ref": "dummy-RCMT:PRIVATE_KEY" + }, + { + "ref": "dummy-RCMT:PUBLIC_KEY" + }, + { + "ref": "dummy-RCMT:SALT" + }, + { + "ref": "dummy-RCMT:SECRET_KEY" + }, + { + "ref": "dummy-RCMT:SEED" + }, + { + "ref": "dummy-RCMT:SHARED_SECRET" + }, + { + "ref": "dummy-RCMT:SIGNATURE" + }, + { + "ref": "dummy-RCMT:TAG" + }, + { + "ref": "dummy-RCMT:TOKEN" + }, + { + "ref": "dummy-RCMT:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.6.xml.bin b/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.6.xml.bin new file mode 100644 index 000000000..3eadbee59 --- /dev/null +++ b/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.6.xml.bin @@ -0,0 +1,204 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + RelatedCryptoMaterialType: ADDITIONAL_DATA + + related-crypto-material + + additional-data + + + + + RelatedCryptoMaterialType: CIPHERTEXT + + related-crypto-material + + ciphertext + + + + + RelatedCryptoMaterialType: CREDENTIAL + + related-crypto-material + + credential + + + + + RelatedCryptoMaterialType: DIGEST + + related-crypto-material + + digest + + + + + RelatedCryptoMaterialType: INITIALIZATION_VECTOR + + related-crypto-material + + initialization-vector + + + + + RelatedCryptoMaterialType: KEY + + related-crypto-material + + key + + + + + RelatedCryptoMaterialType: NONCE + + related-crypto-material + + nonce + + + + + RelatedCryptoMaterialType: OTHER + + related-crypto-material + + other + + + + + RelatedCryptoMaterialType: PASSWORD + + related-crypto-material + + password + + + + + RelatedCryptoMaterialType: PRIVATE_KEY + + related-crypto-material + + private-key + + + + + RelatedCryptoMaterialType: PUBLIC_KEY + + related-crypto-material + + public-key + + + + + RelatedCryptoMaterialType: SALT + + related-crypto-material + + salt + + + + + RelatedCryptoMaterialType: SECRET_KEY + + related-crypto-material + + secret-key + + + + + RelatedCryptoMaterialType: SEED + + related-crypto-material + + seed + + + + + RelatedCryptoMaterialType: SHARED_SECRET + + related-crypto-material + + shared-secret + + + + + RelatedCryptoMaterialType: SIGNATURE + + related-crypto-material + + signature + + + + + RelatedCryptoMaterialType: TAG + + related-crypto-material + + tag + + + + + RelatedCryptoMaterialType: TOKEN + + related-crypto-material + + token + + + + + RelatedCryptoMaterialType: UNKNOWN + + related-crypto-material + + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.json.bin b/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.json.bin new file mode 100644 index 000000000..838ea5948 --- /dev/null +++ b/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.json.bin @@ -0,0 +1,290 @@ +{ + "components": [ + { + "bom-ref": "dummy-RCMT:ADDITIONAL_DATA", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "additional-data" + } + }, + "name": "RelatedCryptoMaterialType: ADDITIONAL_DATA", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:CIPHERTEXT", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "ciphertext" + } + }, + "name": "RelatedCryptoMaterialType: CIPHERTEXT", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:CREDENTIAL", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "credential" + } + }, + "name": "RelatedCryptoMaterialType: CREDENTIAL", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:DIGEST", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "digest" + } + }, + "name": "RelatedCryptoMaterialType: DIGEST", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:INITIALIZATION_VECTOR", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "initialization-vector" + } + }, + "name": "RelatedCryptoMaterialType: INITIALIZATION_VECTOR", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:KEY", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "key" + } + }, + "name": "RelatedCryptoMaterialType: KEY", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:NONCE", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "nonce" + } + }, + "name": "RelatedCryptoMaterialType: NONCE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:OTHER", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "other" + } + }, + "name": "RelatedCryptoMaterialType: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:PASSWORD", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "password" + } + }, + "name": "RelatedCryptoMaterialType: PASSWORD", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:PRIVATE_KEY", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "private-key" + } + }, + "name": "RelatedCryptoMaterialType: PRIVATE_KEY", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:PUBLIC_KEY", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "public-key" + } + }, + "name": "RelatedCryptoMaterialType: PUBLIC_KEY", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SALT", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "salt" + } + }, + "name": "RelatedCryptoMaterialType: SALT", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SECRET_KEY", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "secret-key" + } + }, + "name": "RelatedCryptoMaterialType: SECRET_KEY", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SEED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "seed" + } + }, + "name": "RelatedCryptoMaterialType: SEED", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SHARED_SECRET", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "shared-secret" + } + }, + "name": "RelatedCryptoMaterialType: SHARED_SECRET", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:SIGNATURE", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "signature" + } + }, + "name": "RelatedCryptoMaterialType: SIGNATURE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:TAG", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "tag" + } + }, + "name": "RelatedCryptoMaterialType: TAG", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:TOKEN", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "token" + } + }, + "name": "RelatedCryptoMaterialType: TOKEN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMT:UNKNOWN", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "unknown" + } + }, + "name": "RelatedCryptoMaterialType: UNKNOWN", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-RCMT:ADDITIONAL_DATA" + }, + { + "ref": "dummy-RCMT:CIPHERTEXT" + }, + { + "ref": "dummy-RCMT:CREDENTIAL" + }, + { + "ref": "dummy-RCMT:DIGEST" + }, + { + "ref": "dummy-RCMT:INITIALIZATION_VECTOR" + }, + { + "ref": "dummy-RCMT:KEY" + }, + { + "ref": "dummy-RCMT:NONCE" + }, + { + "ref": "dummy-RCMT:OTHER" + }, + { + "ref": "dummy-RCMT:PASSWORD" + }, + { + "ref": "dummy-RCMT:PRIVATE_KEY" + }, + { + "ref": "dummy-RCMT:PUBLIC_KEY" + }, + { + "ref": "dummy-RCMT:SALT" + }, + { + "ref": "dummy-RCMT:SECRET_KEY" + }, + { + "ref": "dummy-RCMT:SEED" + }, + { + "ref": "dummy-RCMT:SHARED_SECRET" + }, + { + "ref": "dummy-RCMT:SIGNATURE" + }, + { + "ref": "dummy-RCMT:TAG" + }, + { + "ref": "dummy-RCMT:TOKEN" + }, + { + "ref": "dummy-RCMT:UNKNOWN" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.xml.bin b/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.xml.bin new file mode 100644 index 000000000..d29cd825d --- /dev/null +++ b/tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.xml.bin @@ -0,0 +1,204 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + RelatedCryptoMaterialType: ADDITIONAL_DATA + + related-crypto-material + + additional-data + + + + + RelatedCryptoMaterialType: CIPHERTEXT + + related-crypto-material + + ciphertext + + + + + RelatedCryptoMaterialType: CREDENTIAL + + related-crypto-material + + credential + + + + + RelatedCryptoMaterialType: DIGEST + + related-crypto-material + + digest + + + + + RelatedCryptoMaterialType: INITIALIZATION_VECTOR + + related-crypto-material + + initialization-vector + + + + + RelatedCryptoMaterialType: KEY + + related-crypto-material + + key + + + + + RelatedCryptoMaterialType: NONCE + + related-crypto-material + + nonce + + + + + RelatedCryptoMaterialType: OTHER + + related-crypto-material + + other + + + + + RelatedCryptoMaterialType: PASSWORD + + related-crypto-material + + password + + + + + RelatedCryptoMaterialType: PRIVATE_KEY + + related-crypto-material + + private-key + + + + + RelatedCryptoMaterialType: PUBLIC_KEY + + related-crypto-material + + public-key + + + + + RelatedCryptoMaterialType: SALT + + related-crypto-material + + salt + + + + + RelatedCryptoMaterialType: SECRET_KEY + + related-crypto-material + + secret-key + + + + + RelatedCryptoMaterialType: SEED + + related-crypto-material + + seed + + + + + RelatedCryptoMaterialType: SHARED_SECRET + + related-crypto-material + + shared-secret + + + + + RelatedCryptoMaterialType: SIGNATURE + + related-crypto-material + + signature + + + + + RelatedCryptoMaterialType: TAG + + related-crypto-material + + tag + + + + + RelatedCryptoMaterialType: TOKEN + + related-crypto-material + + token + + + + + RelatedCryptoMaterialType: UNKNOWN + + related-crypto-material + + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + val1 + val2 + + From b1ef5761c71ff256513533be6cfca75a61344b8f Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 09:04:04 +0200 Subject: [PATCH 25/41] RelatedCryptoMaterialState Signed-off-by: Jan Kowalleck --- ...um_RelatedCryptoMaterialState-1.6.json.bin | 108 ++++++++++++++++++ ...num_RelatedCryptoMaterialState-1.6.xml.bin | 74 ++++++++++++ ...um_RelatedCryptoMaterialState-1.7.json.bin | 108 ++++++++++++++++++ ...num_RelatedCryptoMaterialState-1.7.xml.bin | 74 ++++++++++++ tests/test_enums.py | 29 +++++ 5 files changed, 393 insertions(+) create mode 100644 tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.xml.bin diff --git a/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.json.bin b/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.json.bin new file mode 100644 index 000000000..adfa9e1a7 --- /dev/null +++ b/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.json.bin @@ -0,0 +1,108 @@ +{ + "components": [ + { + "bom-ref": "dummy-RCMS:ACTIVE", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "active" + } + }, + "name": "RelatedCryptoMaterialState: ACTIVE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:COMPROMISED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "compromised" + } + }, + "name": "RelatedCryptoMaterialState: COMPROMISED", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:DEACTIVATED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "deactivated" + } + }, + "name": "RelatedCryptoMaterialState: DEACTIVATED", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:DESTROYED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "destroyed" + } + }, + "name": "RelatedCryptoMaterialState: DESTROYED", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:PRE_ACTIVATION", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "pre-activation" + } + }, + "name": "RelatedCryptoMaterialState: PRE_ACTIVATION", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:SUSPENDED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "suspended" + } + }, + "name": "RelatedCryptoMaterialState: SUSPENDED", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-RCMS:ACTIVE" + }, + { + "ref": "dummy-RCMS:COMPROMISED" + }, + { + "ref": "dummy-RCMS:DEACTIVATED" + }, + { + "ref": "dummy-RCMS:DESTROYED" + }, + { + "ref": "dummy-RCMS:PRE_ACTIVATION" + }, + { + "ref": "dummy-RCMS:SUSPENDED" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.xml.bin b/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.xml.bin new file mode 100644 index 000000000..10bddb1c9 --- /dev/null +++ b/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.xml.bin @@ -0,0 +1,74 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + RelatedCryptoMaterialState: ACTIVE + + related-crypto-material + + active + + + + + RelatedCryptoMaterialState: COMPROMISED + + related-crypto-material + + compromised + + + + + RelatedCryptoMaterialState: DEACTIVATED + + related-crypto-material + + deactivated + + + + + RelatedCryptoMaterialState: DESTROYED + + related-crypto-material + + destroyed + + + + + RelatedCryptoMaterialState: PRE_ACTIVATION + + related-crypto-material + + pre-activation + + + + + RelatedCryptoMaterialState: SUSPENDED + + related-crypto-material + + suspended + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.json.bin b/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.json.bin new file mode 100644 index 000000000..29e6056d1 --- /dev/null +++ b/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.json.bin @@ -0,0 +1,108 @@ +{ + "components": [ + { + "bom-ref": "dummy-RCMS:ACTIVE", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "active" + } + }, + "name": "RelatedCryptoMaterialState: ACTIVE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:COMPROMISED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "compromised" + } + }, + "name": "RelatedCryptoMaterialState: COMPROMISED", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:DEACTIVATED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "deactivated" + } + }, + "name": "RelatedCryptoMaterialState: DEACTIVATED", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:DESTROYED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "destroyed" + } + }, + "name": "RelatedCryptoMaterialState: DESTROYED", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:PRE_ACTIVATION", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "pre-activation" + } + }, + "name": "RelatedCryptoMaterialState: PRE_ACTIVATION", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-RCMS:SUSPENDED", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "state": "suspended" + } + }, + "name": "RelatedCryptoMaterialState: SUSPENDED", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-RCMS:ACTIVE" + }, + { + "ref": "dummy-RCMS:COMPROMISED" + }, + { + "ref": "dummy-RCMS:DEACTIVATED" + }, + { + "ref": "dummy-RCMS:DESTROYED" + }, + { + "ref": "dummy-RCMS:PRE_ACTIVATION" + }, + { + "ref": "dummy-RCMS:SUSPENDED" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.xml.bin b/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.xml.bin new file mode 100644 index 000000000..ac9eb9cb0 --- /dev/null +++ b/tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.xml.bin @@ -0,0 +1,74 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + RelatedCryptoMaterialState: ACTIVE + + related-crypto-material + + active + + + + + RelatedCryptoMaterialState: COMPROMISED + + related-crypto-material + + compromised + + + + + RelatedCryptoMaterialState: DEACTIVATED + + related-crypto-material + + deactivated + + + + + RelatedCryptoMaterialState: DESTROYED + + related-crypto-material + + destroyed + + + + + RelatedCryptoMaterialState: PRE_ACTIVATION + + related-crypto-material + + pre-activation + + + + + RelatedCryptoMaterialState: SUSPENDED + + related-crypto-material + + suspended + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/test_enums.py b/tests/test_enums.py index ccf23ef90..bf4d730d3 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -873,6 +873,35 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) +@ddt +class TestEnumRelatedCryptoMaterialState(_EnumTestCase): + + @idata(set(chain( + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='relatedCryptoMaterialProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='state']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'relatedCryptoMaterialProperties', 'properties', 'state'), + ))) + def test_knows_value(self, value: str) -> None: + super()._test_knows_value(RelatedCryptoMaterialState, value) + + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: + bom = _make_bom( + components=[ + Component( + name=f'RelatedCryptoMaterialState: {rcms.name}', bom_ref=f'dummy-RCMS:{rcms.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.RELATED_CRYPTO_MATERIAL, + related_crypto_material_properties=RelatedCryptoMaterialProperties( + state=rcms + ) + ) + ) for rcms in RelatedCryptoMaterialState + ]) + super()._test_cases_render(bom, of, sv) + + + """ @ddt class TestEnum...(_EnumTestCase): From 33e4f3532865f3412e68ddda6fed1a3c780716f5 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 09:14:18 +0200 Subject: [PATCH 26/41] ProtocolPropertiesType Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 6 + .../enum_ProtocolPropertiesType-1.6.json.bin | 136 ++++++++++++++++++ .../enum_ProtocolPropertiesType-1.6.xml.bin | 94 ++++++++++++ .../enum_ProtocolPropertiesType-1.7.json.bin | 136 ++++++++++++++++++ .../enum_ProtocolPropertiesType-1.7.xml.bin | 94 ++++++++++++ tests/test_enums.py | 29 ++-- 6 files changed, 481 insertions(+), 14 deletions(-) create mode 100644 tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.json.bin create mode 100644 tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.xml.bin create mode 100644 tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin create mode 100644 tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index ddf693e5d..892792ca3 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -1115,6 +1115,12 @@ class ProtocolPropertiesType(str, Enum): SSTP = 'sstp' TLS = 'tls' WPA = 'wpa' + # TODO: add 'eap-aka-prime' + # TODO: add '5g-aka' + # TODO: add 'dtls' + # TODO: add 'quic' + # TODO: add 'eap-aka' + # TODO: add 'prins' OTHER = 'other' UNKNOWN = 'unknown' diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.json.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.json.bin new file mode 100644 index 000000000..8fd17bd06 --- /dev/null +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.json.bin @@ -0,0 +1,136 @@ +{ + "components": [ + { + "bom-ref": "dummy-PPT:IKE", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ike" + } + }, + "name": "ProtocolPropertiesType: IKE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:IPSEC", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ipsec" + } + }, + "name": "ProtocolPropertiesType: IPSEC", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:OTHER", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "other" + } + }, + "name": "ProtocolPropertiesType: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:SSH", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ssh" + } + }, + "name": "ProtocolPropertiesType: SSH", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:SSTP", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "sstp" + } + }, + "name": "ProtocolPropertiesType: SSTP", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:TLS", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "tls" + } + }, + "name": "ProtocolPropertiesType: TLS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:UNKNOWN", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "unknown" + } + }, + "name": "ProtocolPropertiesType: UNKNOWN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:WPA", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "wpa" + } + }, + "name": "ProtocolPropertiesType: WPA", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-PPT:IKE" + }, + { + "ref": "dummy-PPT:IPSEC" + }, + { + "ref": "dummy-PPT:OTHER" + }, + { + "ref": "dummy-PPT:SSH" + }, + { + "ref": "dummy-PPT:SSTP" + }, + { + "ref": "dummy-PPT:TLS" + }, + { + "ref": "dummy-PPT:UNKNOWN" + }, + { + "ref": "dummy-PPT:WPA" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.xml.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.xml.bin new file mode 100644 index 000000000..5ff87918c --- /dev/null +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.xml.bin @@ -0,0 +1,94 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + ProtocolPropertiesType: IKE + + protocol + + ike + + + + + ProtocolPropertiesType: IPSEC + + protocol + + ipsec + + + + + ProtocolPropertiesType: OTHER + + protocol + + other + + + + + ProtocolPropertiesType: SSH + + protocol + + ssh + + + + + ProtocolPropertiesType: SSTP + + protocol + + sstp + + + + + ProtocolPropertiesType: TLS + + protocol + + tls + + + + + ProtocolPropertiesType: UNKNOWN + + protocol + + unknown + + + + + ProtocolPropertiesType: WPA + + protocol + + wpa + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin new file mode 100644 index 000000000..f9e41dc40 --- /dev/null +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin @@ -0,0 +1,136 @@ +{ + "components": [ + { + "bom-ref": "dummy-PPT:IKE", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ike" + } + }, + "name": "ProtocolPropertiesType: IKE", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:IPSEC", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ipsec" + } + }, + "name": "ProtocolPropertiesType: IPSEC", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:OTHER", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "other" + } + }, + "name": "ProtocolPropertiesType: OTHER", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:SSH", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ssh" + } + }, + "name": "ProtocolPropertiesType: SSH", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:SSTP", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "sstp" + } + }, + "name": "ProtocolPropertiesType: SSTP", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:TLS", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "tls" + } + }, + "name": "ProtocolPropertiesType: TLS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:UNKNOWN", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "unknown" + } + }, + "name": "ProtocolPropertiesType: UNKNOWN", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:WPA", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "wpa" + } + }, + "name": "ProtocolPropertiesType: WPA", + "type": "cryptographic-asset" + } + ], + "dependencies": [ + { + "ref": "dummy-PPT:IKE" + }, + { + "ref": "dummy-PPT:IPSEC" + }, + { + "ref": "dummy-PPT:OTHER" + }, + { + "ref": "dummy-PPT:SSH" + }, + { + "ref": "dummy-PPT:SSTP" + }, + { + "ref": "dummy-PPT:TLS" + }, + { + "ref": "dummy-PPT:UNKNOWN" + }, + { + "ref": "dummy-PPT:WPA" + } + ], + "metadata": { + "timestamp": "2023-01-07T13:44:32.312678+00:00" + }, + "properties": [ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + } + ], + "serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.7.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.7" +} \ No newline at end of file diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin new file mode 100644 index 000000000..414beab2b --- /dev/null +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin @@ -0,0 +1,94 @@ + + + + 2023-01-07T13:44:32.312678+00:00 + + + + ProtocolPropertiesType: IKE + + protocol + + ike + + + + + ProtocolPropertiesType: IPSEC + + protocol + + ipsec + + + + + ProtocolPropertiesType: OTHER + + protocol + + other + + + + + ProtocolPropertiesType: SSH + + protocol + + ssh + + + + + ProtocolPropertiesType: SSTP + + protocol + + sstp + + + + + ProtocolPropertiesType: TLS + + protocol + + tls + + + + + ProtocolPropertiesType: UNKNOWN + + protocol + + unknown + + + + + ProtocolPropertiesType: WPA + + protocol + + wpa + + + + + + + + + + + + + + + + val1 + val2 + + diff --git a/tests/test_enums.py b/tests/test_enums.py index bf4d730d3..4d3cf3da8 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -36,7 +36,7 @@ from cyclonedx.model.bom import Bom, BomMetaData, DistributionConstraints, TlpClassification from cyclonedx.model.component import Component, Patch, Pedigree from cyclonedx.model.component_evidence import ComponentEvidence, Identity as CEIdentity, Method as CEMethod -from cyclonedx.model.crypto import CryptoProperties, AlgorithmProperties, RelatedCryptoMaterialProperties +from cyclonedx.model.crypto import CryptoProperties, AlgorithmProperties, RelatedCryptoMaterialProperties, ProtocolProperties from cyclonedx.model.issue import IssueType from cyclonedx.model.license import DisjunctiveLicense from cyclonedx.model.lifecycle import LifecyclePhase, PredefinedLifecycle @@ -901,33 +901,34 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) - -""" @ddt -class TestEnum...(_EnumTestCase): +class TestEnumProtocolPropertiesType(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='...']"), - dp_cases_from_json_schemas('definitions', '...'), + dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='protocolProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='type']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'protocolProperties', 'properties', 'type'), ))) def test_knows_value(self, value: str) -> None: - super()._test_knows_value(..., value) + super()._test_knows_value(ProtocolPropertiesType, value) @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ - ... + Component( + name=f'ProtocolPropertiesType: {ppt.name}', bom_ref=f'dummy-PPT:{ppt.name}', + type=ComponentType.CRYPTOGRAPHIC_ASSET, + crypto_properties=CryptoProperties( + asset_type=CryptoAssetType.PROTOCOL, + protocol_properties=ProtocolProperties( + type=ppt + ) + ) + ) for ppt in ProtocolPropertiesType ]) super()._test_cases_render(bom, of, sv) -""" -""" -missing: -- RelatedCryptoMaterialState -- ProtocolPropertiesType -""" # add new test cases above this line From cadb83e8fafc6e2c7d3bf5779c0cdc37f99c1cd2 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 09:29:18 +0200 Subject: [PATCH 27/41] dings Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 73 +++++++++-- ...enum_CryptoCertificationLevel-1.6.json.bin | 116 +++++++++--------- .../enum_CryptoCertificationLevel-1.6.xml.bin | 116 +++++++++--------- ...enum_CryptoCertificationLevel-1.7.json.bin | 116 +++++++++--------- .../enum_CryptoCertificationLevel-1.7.xml.bin | 116 +++++++++--------- .../snapshots/enum_CryptoMode-1.6.json.bin | 36 +++--- .../snapshots/enum_CryptoMode-1.6.xml.bin | 36 +++--- .../snapshots/enum_CryptoMode-1.7.json.bin | 36 +++--- .../snapshots/enum_CryptoMode-1.7.xml.bin | 36 +++--- .../enum_CryptoPrimitive-1.6.json.bin | 14 +++ .../enum_CryptoPrimitive-1.6.xml.bin | 10 ++ .../enum_CryptoPrimitive-1.7.json.bin | 14 +++ .../enum_CryptoPrimitive-1.7.xml.bin | 10 ++ 13 files changed, 416 insertions(+), 313 deletions(-) diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index 892792ca3..7bdeedb03 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -80,17 +80,71 @@ class CryptoPrimitive(str, Enum): KDF = 'kdf' KEM = 'kem' KEY_AGREE = 'key-agree' + KEY_WRAP = 'key-wrap' # since CDX1.7key-wrap MAC = 'mac' PKE = 'pke' SIGNATURE = 'signature' STREAM_CIPHER = 'stream-cipher' XOF = 'xof' - # TODO: add `key-wrap` - since CDX1.7key-wrap - + # -- OTHER = 'other' UNKNOWN = 'unknown' + +class _CryptoPrimitiveSerializationHelper(serializable.helpers.BaseHelper): + """ THIS CLASS IS NON-PUBLIC API """ + + __CASES: dict[type[serializable.ViewType], frozenset[CryptoPrimitive]] = dict() + __CASES[SchemaVersion1Dot6] = frozenset({ + CryptoPrimitive.AE, + CryptoPrimitive.BLOCK_CIPHER, + CryptoPrimitive.COMBINER, + CryptoPrimitive.DRBG, + CryptoPrimitive.HASH, + CryptoPrimitive.KDF, + CryptoPrimitive.KEM, + CryptoPrimitive.KEY_AGREE, + CryptoPrimitive.MAC, + CryptoPrimitive.PKE, + CryptoPrimitive.SIGNATURE, + CryptoPrimitive.STREAM_CIPHER, + CryptoPrimitive.XOF, + CryptoPrimitive.OTHER, + CryptoPrimitive.UNKNOWN, + }) + __CASES[SchemaVersion1Dot7] = __CASES[SchemaVersion1Dot6] | { + CryptoPrimitive.KEY_WRAP, + } + + @classmethod + def __normalize(cls, cp: CryptoPrimitive, view: type[serializable.ViewType]) -> str: + return ( + cp + if cp in cls.__CASES.get(view, ()) + else CryptoPrimitive.OTHER + ).value + + @classmethod + def json_normalize(cls, o: Any, *, + view: Optional[type[serializable.ViewType]], + **__: Any) -> str: + assert view is not None + return cls.__normalize(o, view) + + @classmethod + def xml_normalize(cls, o: Any, *, + view: Optional[type[serializable.ViewType]], + **__: Any) -> str: + assert view is not None + return cls.__normalize(o, view) + + @classmethod + def deserialize(cls, o: Any) -> CryptoPrimitive: + return CryptoPrimitive(o) + + + @serializable.serializable_enum class CryptoExecutionEnvironment(str, Enum): # TODO: rename to `CryptoAlgorithmExecutionEnvironment` @@ -110,7 +164,7 @@ class CryptoExecutionEnvironment(str, Enum): SOFTWARE_ENCRYPTED_RAM = 'software-encrypted-ram' SOFTWARE_PLAIN_RAM = 'software-plain-ram' SOFTWARE_TEE = 'software-tee' - + # -- OTHER = 'other' UNKNOWN = 'unknown' @@ -142,7 +196,7 @@ class CryptoImplementationPlatform(str, Enum): S390X = 's390x' X86_32 = 'x86_32' X86_64 = 'x86_64' - + # -- OTHER = 'other' UNKNOWN = 'unknown' @@ -163,7 +217,7 @@ class CryptoCertificationLevel(str, Enum): """ NONE = 'none' - + # -- FIPS140_1_L1 = 'fips140-1-l1' FIPS140_1_L2 = 'fips140-1-l2' FIPS140_1_L3 = 'fips140-1-l3' @@ -190,7 +244,7 @@ class CryptoCertificationLevel(str, Enum): CC_EAL6_PLUS = 'cc-eal6+' CC_EAL7 = 'cc-eal7' CC_EAL7_PLUS = 'cc-eal7+' - + # -- OTHER = 'other' UNKNOWN = 'unknown' @@ -217,7 +271,7 @@ class CryptoMode(str, Enum): ECB = 'ecb' GCM = 'gcm' OFB = 'ofb' - + # -- OTHER = 'other' UNKNOWN = 'unknown' @@ -242,7 +296,7 @@ class CryptoPadding(str, Enum): PKCS1V15 = 'pkcs1v15' OAEP = 'oaep' RAW = 'raw' - + # -- OTHER = 'other' UNKNOWN = 'unknown' @@ -271,7 +325,7 @@ class CryptoFunction(str, Enum): SIGN = 'sign' TAG = 'tag' VERIFY = 'verify' - + # -- OTHER = 'other' UNKNOWN = 'unknown' @@ -316,6 +370,7 @@ def __init__( self.nist_quantum_security_level = nist_quantum_security_level @property + @serializable.type_mapping(_CryptoPrimitiveSerializationHelper) @serializable.xml_sequence(1) def primitive(self) -> Optional[CryptoPrimitive]: """ diff --git a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.json.bin b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.json.bin index 9256e7355..28b6f5a90 100644 --- a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.json.bin +++ b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.json.bin @@ -1,7 +1,7 @@ { "components": [ { - "bom-ref": "dummy-CIP:CC_EAL1", + "bom-ref": "dummy-CCL:CC_EAL1", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -14,7 +14,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL1_PLUS", + "bom-ref": "dummy-CCL:CC_EAL1_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -27,7 +27,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL2", + "bom-ref": "dummy-CCL:CC_EAL2", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -40,7 +40,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL2_PLUS", + "bom-ref": "dummy-CCL:CC_EAL2_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -53,7 +53,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL3", + "bom-ref": "dummy-CCL:CC_EAL3", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -66,7 +66,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL3_PLUS", + "bom-ref": "dummy-CCL:CC_EAL3_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -79,7 +79,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL4", + "bom-ref": "dummy-CCL:CC_EAL4", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -92,7 +92,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL4_PLUS", + "bom-ref": "dummy-CCL:CC_EAL4_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -105,7 +105,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL5", + "bom-ref": "dummy-CCL:CC_EAL5", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -118,7 +118,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL5_PLUS", + "bom-ref": "dummy-CCL:CC_EAL5_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -131,7 +131,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL6", + "bom-ref": "dummy-CCL:CC_EAL6", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -144,7 +144,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL6_PLUS", + "bom-ref": "dummy-CCL:CC_EAL6_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -157,7 +157,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL7", + "bom-ref": "dummy-CCL:CC_EAL7", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -170,7 +170,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL7_PLUS", + "bom-ref": "dummy-CCL:CC_EAL7_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -183,7 +183,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_1_L1", + "bom-ref": "dummy-CCL:FIPS140_1_L1", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -196,7 +196,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_1_L2", + "bom-ref": "dummy-CCL:FIPS140_1_L2", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -209,7 +209,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_1_L3", + "bom-ref": "dummy-CCL:FIPS140_1_L3", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -222,7 +222,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_1_L4", + "bom-ref": "dummy-CCL:FIPS140_1_L4", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -235,7 +235,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_2_L1", + "bom-ref": "dummy-CCL:FIPS140_2_L1", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -248,7 +248,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_2_L2", + "bom-ref": "dummy-CCL:FIPS140_2_L2", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -261,7 +261,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_2_L3", + "bom-ref": "dummy-CCL:FIPS140_2_L3", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -274,7 +274,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_2_L4", + "bom-ref": "dummy-CCL:FIPS140_2_L4", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -287,7 +287,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_3_L1", + "bom-ref": "dummy-CCL:FIPS140_3_L1", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -300,7 +300,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_3_L2", + "bom-ref": "dummy-CCL:FIPS140_3_L2", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -313,7 +313,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_3_L3", + "bom-ref": "dummy-CCL:FIPS140_3_L3", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -326,7 +326,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_3_L4", + "bom-ref": "dummy-CCL:FIPS140_3_L4", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -339,7 +339,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:NONE", + "bom-ref": "dummy-CCL:NONE", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -352,7 +352,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:OTHER", + "bom-ref": "dummy-CCL:OTHER", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -365,7 +365,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:UNKNOWN", + "bom-ref": "dummy-CCL:UNKNOWN", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -380,91 +380,91 @@ ], "dependencies": [ { - "ref": "dummy-CIP:CC_EAL1" + "ref": "dummy-CCL:CC_EAL1" }, { - "ref": "dummy-CIP:CC_EAL1_PLUS" + "ref": "dummy-CCL:CC_EAL1_PLUS" }, { - "ref": "dummy-CIP:CC_EAL2" + "ref": "dummy-CCL:CC_EAL2" }, { - "ref": "dummy-CIP:CC_EAL2_PLUS" + "ref": "dummy-CCL:CC_EAL2_PLUS" }, { - "ref": "dummy-CIP:CC_EAL3" + "ref": "dummy-CCL:CC_EAL3" }, { - "ref": "dummy-CIP:CC_EAL3_PLUS" + "ref": "dummy-CCL:CC_EAL3_PLUS" }, { - "ref": "dummy-CIP:CC_EAL4" + "ref": "dummy-CCL:CC_EAL4" }, { - "ref": "dummy-CIP:CC_EAL4_PLUS" + "ref": "dummy-CCL:CC_EAL4_PLUS" }, { - "ref": "dummy-CIP:CC_EAL5" + "ref": "dummy-CCL:CC_EAL5" }, { - "ref": "dummy-CIP:CC_EAL5_PLUS" + "ref": "dummy-CCL:CC_EAL5_PLUS" }, { - "ref": "dummy-CIP:CC_EAL6" + "ref": "dummy-CCL:CC_EAL6" }, { - "ref": "dummy-CIP:CC_EAL6_PLUS" + "ref": "dummy-CCL:CC_EAL6_PLUS" }, { - "ref": "dummy-CIP:CC_EAL7" + "ref": "dummy-CCL:CC_EAL7" }, { - "ref": "dummy-CIP:CC_EAL7_PLUS" + "ref": "dummy-CCL:CC_EAL7_PLUS" }, { - "ref": "dummy-CIP:FIPS140_1_L1" + "ref": "dummy-CCL:FIPS140_1_L1" }, { - "ref": "dummy-CIP:FIPS140_1_L2" + "ref": "dummy-CCL:FIPS140_1_L2" }, { - "ref": "dummy-CIP:FIPS140_1_L3" + "ref": "dummy-CCL:FIPS140_1_L3" }, { - "ref": "dummy-CIP:FIPS140_1_L4" + "ref": "dummy-CCL:FIPS140_1_L4" }, { - "ref": "dummy-CIP:FIPS140_2_L1" + "ref": "dummy-CCL:FIPS140_2_L1" }, { - "ref": "dummy-CIP:FIPS140_2_L2" + "ref": "dummy-CCL:FIPS140_2_L2" }, { - "ref": "dummy-CIP:FIPS140_2_L3" + "ref": "dummy-CCL:FIPS140_2_L3" }, { - "ref": "dummy-CIP:FIPS140_2_L4" + "ref": "dummy-CCL:FIPS140_2_L4" }, { - "ref": "dummy-CIP:FIPS140_3_L1" + "ref": "dummy-CCL:FIPS140_3_L1" }, { - "ref": "dummy-CIP:FIPS140_3_L2" + "ref": "dummy-CCL:FIPS140_3_L2" }, { - "ref": "dummy-CIP:FIPS140_3_L3" + "ref": "dummy-CCL:FIPS140_3_L3" }, { - "ref": "dummy-CIP:FIPS140_3_L4" + "ref": "dummy-CCL:FIPS140_3_L4" }, { - "ref": "dummy-CIP:NONE" + "ref": "dummy-CCL:NONE" }, { - "ref": "dummy-CIP:OTHER" + "ref": "dummy-CCL:OTHER" }, { - "ref": "dummy-CIP:UNKNOWN" + "ref": "dummy-CCL:UNKNOWN" } ], "metadata": { diff --git a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.xml.bin index 3915c3edd..2d36f68ed 100644 --- a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.xml.bin +++ b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.6.xml.bin @@ -4,7 +4,7 @@ 2023-01-07T13:44:32.312678+00:00 - + CryptoCertificationLevel: CC_EAL1 algorithm @@ -13,7 +13,7 @@ - + CryptoCertificationLevel: CC_EAL1_PLUS algorithm @@ -22,7 +22,7 @@ - + CryptoCertificationLevel: CC_EAL2 algorithm @@ -31,7 +31,7 @@ - + CryptoCertificationLevel: CC_EAL2_PLUS algorithm @@ -40,7 +40,7 @@ - + CryptoCertificationLevel: CC_EAL3 algorithm @@ -49,7 +49,7 @@ - + CryptoCertificationLevel: CC_EAL3_PLUS algorithm @@ -58,7 +58,7 @@ - + CryptoCertificationLevel: CC_EAL4 algorithm @@ -67,7 +67,7 @@ - + CryptoCertificationLevel: CC_EAL4_PLUS algorithm @@ -76,7 +76,7 @@ - + CryptoCertificationLevel: CC_EAL5 algorithm @@ -85,7 +85,7 @@ - + CryptoCertificationLevel: CC_EAL5_PLUS algorithm @@ -94,7 +94,7 @@ - + CryptoCertificationLevel: CC_EAL6 algorithm @@ -103,7 +103,7 @@ - + CryptoCertificationLevel: CC_EAL6_PLUS algorithm @@ -112,7 +112,7 @@ - + CryptoCertificationLevel: CC_EAL7 algorithm @@ -121,7 +121,7 @@ - + CryptoCertificationLevel: CC_EAL7_PLUS algorithm @@ -130,7 +130,7 @@ - + CryptoCertificationLevel: FIPS140_1_L1 algorithm @@ -139,7 +139,7 @@ - + CryptoCertificationLevel: FIPS140_1_L2 algorithm @@ -148,7 +148,7 @@ - + CryptoCertificationLevel: FIPS140_1_L3 algorithm @@ -157,7 +157,7 @@ - + CryptoCertificationLevel: FIPS140_1_L4 algorithm @@ -166,7 +166,7 @@ - + CryptoCertificationLevel: FIPS140_2_L1 algorithm @@ -175,7 +175,7 @@ - + CryptoCertificationLevel: FIPS140_2_L2 algorithm @@ -184,7 +184,7 @@ - + CryptoCertificationLevel: FIPS140_2_L3 algorithm @@ -193,7 +193,7 @@ - + CryptoCertificationLevel: FIPS140_2_L4 algorithm @@ -202,7 +202,7 @@ - + CryptoCertificationLevel: FIPS140_3_L1 algorithm @@ -211,7 +211,7 @@ - + CryptoCertificationLevel: FIPS140_3_L2 algorithm @@ -220,7 +220,7 @@ - + CryptoCertificationLevel: FIPS140_3_L3 algorithm @@ -229,7 +229,7 @@ - + CryptoCertificationLevel: FIPS140_3_L4 algorithm @@ -238,7 +238,7 @@ - + CryptoCertificationLevel: NONE algorithm @@ -247,7 +247,7 @@ - + CryptoCertificationLevel: OTHER algorithm @@ -256,7 +256,7 @@ - + CryptoCertificationLevel: UNKNOWN algorithm @@ -267,35 +267,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + val1 diff --git a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.json.bin b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.json.bin index 38cf174dd..eb645477b 100644 --- a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.json.bin +++ b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.json.bin @@ -1,7 +1,7 @@ { "components": [ { - "bom-ref": "dummy-CIP:CC_EAL1", + "bom-ref": "dummy-CCL:CC_EAL1", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -14,7 +14,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL1_PLUS", + "bom-ref": "dummy-CCL:CC_EAL1_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -27,7 +27,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL2", + "bom-ref": "dummy-CCL:CC_EAL2", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -40,7 +40,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL2_PLUS", + "bom-ref": "dummy-CCL:CC_EAL2_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -53,7 +53,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL3", + "bom-ref": "dummy-CCL:CC_EAL3", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -66,7 +66,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL3_PLUS", + "bom-ref": "dummy-CCL:CC_EAL3_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -79,7 +79,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL4", + "bom-ref": "dummy-CCL:CC_EAL4", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -92,7 +92,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL4_PLUS", + "bom-ref": "dummy-CCL:CC_EAL4_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -105,7 +105,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL5", + "bom-ref": "dummy-CCL:CC_EAL5", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -118,7 +118,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL5_PLUS", + "bom-ref": "dummy-CCL:CC_EAL5_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -131,7 +131,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL6", + "bom-ref": "dummy-CCL:CC_EAL6", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -144,7 +144,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL6_PLUS", + "bom-ref": "dummy-CCL:CC_EAL6_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -157,7 +157,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL7", + "bom-ref": "dummy-CCL:CC_EAL7", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -170,7 +170,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CC_EAL7_PLUS", + "bom-ref": "dummy-CCL:CC_EAL7_PLUS", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -183,7 +183,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_1_L1", + "bom-ref": "dummy-CCL:FIPS140_1_L1", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -196,7 +196,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_1_L2", + "bom-ref": "dummy-CCL:FIPS140_1_L2", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -209,7 +209,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_1_L3", + "bom-ref": "dummy-CCL:FIPS140_1_L3", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -222,7 +222,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_1_L4", + "bom-ref": "dummy-CCL:FIPS140_1_L4", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -235,7 +235,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_2_L1", + "bom-ref": "dummy-CCL:FIPS140_2_L1", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -248,7 +248,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_2_L2", + "bom-ref": "dummy-CCL:FIPS140_2_L2", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -261,7 +261,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_2_L3", + "bom-ref": "dummy-CCL:FIPS140_2_L3", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -274,7 +274,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_2_L4", + "bom-ref": "dummy-CCL:FIPS140_2_L4", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -287,7 +287,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_3_L1", + "bom-ref": "dummy-CCL:FIPS140_3_L1", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -300,7 +300,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_3_L2", + "bom-ref": "dummy-CCL:FIPS140_3_L2", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -313,7 +313,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_3_L3", + "bom-ref": "dummy-CCL:FIPS140_3_L3", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -326,7 +326,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:FIPS140_3_L4", + "bom-ref": "dummy-CCL:FIPS140_3_L4", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -339,7 +339,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:NONE", + "bom-ref": "dummy-CCL:NONE", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -352,7 +352,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:OTHER", + "bom-ref": "dummy-CCL:OTHER", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -365,7 +365,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:UNKNOWN", + "bom-ref": "dummy-CCL:UNKNOWN", "cryptoProperties": { "algorithmProperties": { "certificationLevel": [ @@ -380,91 +380,91 @@ ], "dependencies": [ { - "ref": "dummy-CIP:CC_EAL1" + "ref": "dummy-CCL:CC_EAL1" }, { - "ref": "dummy-CIP:CC_EAL1_PLUS" + "ref": "dummy-CCL:CC_EAL1_PLUS" }, { - "ref": "dummy-CIP:CC_EAL2" + "ref": "dummy-CCL:CC_EAL2" }, { - "ref": "dummy-CIP:CC_EAL2_PLUS" + "ref": "dummy-CCL:CC_EAL2_PLUS" }, { - "ref": "dummy-CIP:CC_EAL3" + "ref": "dummy-CCL:CC_EAL3" }, { - "ref": "dummy-CIP:CC_EAL3_PLUS" + "ref": "dummy-CCL:CC_EAL3_PLUS" }, { - "ref": "dummy-CIP:CC_EAL4" + "ref": "dummy-CCL:CC_EAL4" }, { - "ref": "dummy-CIP:CC_EAL4_PLUS" + "ref": "dummy-CCL:CC_EAL4_PLUS" }, { - "ref": "dummy-CIP:CC_EAL5" + "ref": "dummy-CCL:CC_EAL5" }, { - "ref": "dummy-CIP:CC_EAL5_PLUS" + "ref": "dummy-CCL:CC_EAL5_PLUS" }, { - "ref": "dummy-CIP:CC_EAL6" + "ref": "dummy-CCL:CC_EAL6" }, { - "ref": "dummy-CIP:CC_EAL6_PLUS" + "ref": "dummy-CCL:CC_EAL6_PLUS" }, { - "ref": "dummy-CIP:CC_EAL7" + "ref": "dummy-CCL:CC_EAL7" }, { - "ref": "dummy-CIP:CC_EAL7_PLUS" + "ref": "dummy-CCL:CC_EAL7_PLUS" }, { - "ref": "dummy-CIP:FIPS140_1_L1" + "ref": "dummy-CCL:FIPS140_1_L1" }, { - "ref": "dummy-CIP:FIPS140_1_L2" + "ref": "dummy-CCL:FIPS140_1_L2" }, { - "ref": "dummy-CIP:FIPS140_1_L3" + "ref": "dummy-CCL:FIPS140_1_L3" }, { - "ref": "dummy-CIP:FIPS140_1_L4" + "ref": "dummy-CCL:FIPS140_1_L4" }, { - "ref": "dummy-CIP:FIPS140_2_L1" + "ref": "dummy-CCL:FIPS140_2_L1" }, { - "ref": "dummy-CIP:FIPS140_2_L2" + "ref": "dummy-CCL:FIPS140_2_L2" }, { - "ref": "dummy-CIP:FIPS140_2_L3" + "ref": "dummy-CCL:FIPS140_2_L3" }, { - "ref": "dummy-CIP:FIPS140_2_L4" + "ref": "dummy-CCL:FIPS140_2_L4" }, { - "ref": "dummy-CIP:FIPS140_3_L1" + "ref": "dummy-CCL:FIPS140_3_L1" }, { - "ref": "dummy-CIP:FIPS140_3_L2" + "ref": "dummy-CCL:FIPS140_3_L2" }, { - "ref": "dummy-CIP:FIPS140_3_L3" + "ref": "dummy-CCL:FIPS140_3_L3" }, { - "ref": "dummy-CIP:FIPS140_3_L4" + "ref": "dummy-CCL:FIPS140_3_L4" }, { - "ref": "dummy-CIP:NONE" + "ref": "dummy-CCL:NONE" }, { - "ref": "dummy-CIP:OTHER" + "ref": "dummy-CCL:OTHER" }, { - "ref": "dummy-CIP:UNKNOWN" + "ref": "dummy-CCL:UNKNOWN" } ], "metadata": { diff --git a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.xml.bin index a4cbd6386..736777f96 100644 --- a/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.xml.bin +++ b/tests/_data/snapshots/enum_CryptoCertificationLevel-1.7.xml.bin @@ -4,7 +4,7 @@ 2023-01-07T13:44:32.312678+00:00 - + CryptoCertificationLevel: CC_EAL1 algorithm @@ -13,7 +13,7 @@ - + CryptoCertificationLevel: CC_EAL1_PLUS algorithm @@ -22,7 +22,7 @@ - + CryptoCertificationLevel: CC_EAL2 algorithm @@ -31,7 +31,7 @@ - + CryptoCertificationLevel: CC_EAL2_PLUS algorithm @@ -40,7 +40,7 @@ - + CryptoCertificationLevel: CC_EAL3 algorithm @@ -49,7 +49,7 @@ - + CryptoCertificationLevel: CC_EAL3_PLUS algorithm @@ -58,7 +58,7 @@ - + CryptoCertificationLevel: CC_EAL4 algorithm @@ -67,7 +67,7 @@ - + CryptoCertificationLevel: CC_EAL4_PLUS algorithm @@ -76,7 +76,7 @@ - + CryptoCertificationLevel: CC_EAL5 algorithm @@ -85,7 +85,7 @@ - + CryptoCertificationLevel: CC_EAL5_PLUS algorithm @@ -94,7 +94,7 @@ - + CryptoCertificationLevel: CC_EAL6 algorithm @@ -103,7 +103,7 @@ - + CryptoCertificationLevel: CC_EAL6_PLUS algorithm @@ -112,7 +112,7 @@ - + CryptoCertificationLevel: CC_EAL7 algorithm @@ -121,7 +121,7 @@ - + CryptoCertificationLevel: CC_EAL7_PLUS algorithm @@ -130,7 +130,7 @@ - + CryptoCertificationLevel: FIPS140_1_L1 algorithm @@ -139,7 +139,7 @@ - + CryptoCertificationLevel: FIPS140_1_L2 algorithm @@ -148,7 +148,7 @@ - + CryptoCertificationLevel: FIPS140_1_L3 algorithm @@ -157,7 +157,7 @@ - + CryptoCertificationLevel: FIPS140_1_L4 algorithm @@ -166,7 +166,7 @@ - + CryptoCertificationLevel: FIPS140_2_L1 algorithm @@ -175,7 +175,7 @@ - + CryptoCertificationLevel: FIPS140_2_L2 algorithm @@ -184,7 +184,7 @@ - + CryptoCertificationLevel: FIPS140_2_L3 algorithm @@ -193,7 +193,7 @@ - + CryptoCertificationLevel: FIPS140_2_L4 algorithm @@ -202,7 +202,7 @@ - + CryptoCertificationLevel: FIPS140_3_L1 algorithm @@ -211,7 +211,7 @@ - + CryptoCertificationLevel: FIPS140_3_L2 algorithm @@ -220,7 +220,7 @@ - + CryptoCertificationLevel: FIPS140_3_L3 algorithm @@ -229,7 +229,7 @@ - + CryptoCertificationLevel: FIPS140_3_L4 algorithm @@ -238,7 +238,7 @@ - + CryptoCertificationLevel: NONE algorithm @@ -247,7 +247,7 @@ - + CryptoCertificationLevel: OTHER algorithm @@ -256,7 +256,7 @@ - + CryptoCertificationLevel: UNKNOWN algorithm @@ -267,35 +267,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + val1 diff --git a/tests/_data/snapshots/enum_CryptoMode-1.6.json.bin b/tests/_data/snapshots/enum_CryptoMode-1.6.json.bin index c949862ac..bad094add 100644 --- a/tests/_data/snapshots/enum_CryptoMode-1.6.json.bin +++ b/tests/_data/snapshots/enum_CryptoMode-1.6.json.bin @@ -1,7 +1,7 @@ { "components": [ { - "bom-ref": "dummy-CIP:CBC", + "bom-ref": "dummy-CM:CBC", "cryptoProperties": { "algorithmProperties": { "mode": "cbc" @@ -12,7 +12,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CCM", + "bom-ref": "dummy-CM:CCM", "cryptoProperties": { "algorithmProperties": { "mode": "ccm" @@ -23,7 +23,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CFB", + "bom-ref": "dummy-CM:CFB", "cryptoProperties": { "algorithmProperties": { "mode": "cfb" @@ -34,7 +34,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CTR", + "bom-ref": "dummy-CM:CTR", "cryptoProperties": { "algorithmProperties": { "mode": "ctr" @@ -45,7 +45,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:ECB", + "bom-ref": "dummy-CM:ECB", "cryptoProperties": { "algorithmProperties": { "mode": "ecb" @@ -56,7 +56,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:GCM", + "bom-ref": "dummy-CM:GCM", "cryptoProperties": { "algorithmProperties": { "mode": "gcm" @@ -67,7 +67,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:OFB", + "bom-ref": "dummy-CM:OFB", "cryptoProperties": { "algorithmProperties": { "mode": "ofb" @@ -78,7 +78,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:OTHER", + "bom-ref": "dummy-CM:OTHER", "cryptoProperties": { "algorithmProperties": { "mode": "other" @@ -89,7 +89,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:UNKNOWN", + "bom-ref": "dummy-CM:UNKNOWN", "cryptoProperties": { "algorithmProperties": { "mode": "unknown" @@ -102,31 +102,31 @@ ], "dependencies": [ { - "ref": "dummy-CIP:CBC" + "ref": "dummy-CM:CBC" }, { - "ref": "dummy-CIP:CCM" + "ref": "dummy-CM:CCM" }, { - "ref": "dummy-CIP:CFB" + "ref": "dummy-CM:CFB" }, { - "ref": "dummy-CIP:CTR" + "ref": "dummy-CM:CTR" }, { - "ref": "dummy-CIP:ECB" + "ref": "dummy-CM:ECB" }, { - "ref": "dummy-CIP:GCM" + "ref": "dummy-CM:GCM" }, { - "ref": "dummy-CIP:OFB" + "ref": "dummy-CM:OFB" }, { - "ref": "dummy-CIP:OTHER" + "ref": "dummy-CM:OTHER" }, { - "ref": "dummy-CIP:UNKNOWN" + "ref": "dummy-CM:UNKNOWN" } ], "metadata": { diff --git a/tests/_data/snapshots/enum_CryptoMode-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoMode-1.6.xml.bin index db49f73d9..38306ff27 100644 --- a/tests/_data/snapshots/enum_CryptoMode-1.6.xml.bin +++ b/tests/_data/snapshots/enum_CryptoMode-1.6.xml.bin @@ -4,7 +4,7 @@ 2023-01-07T13:44:32.312678+00:00 - + CryptoMode: CBC algorithm @@ -13,7 +13,7 @@ - + CryptoMode: CCM algorithm @@ -22,7 +22,7 @@ - + CryptoMode: CFB algorithm @@ -31,7 +31,7 @@ - + CryptoMode: CTR algorithm @@ -40,7 +40,7 @@ - + CryptoMode: ECB algorithm @@ -49,7 +49,7 @@ - + CryptoMode: GCM algorithm @@ -58,7 +58,7 @@ - + CryptoMode: OFB algorithm @@ -67,7 +67,7 @@ - + CryptoMode: OTHER algorithm @@ -76,7 +76,7 @@ - + CryptoMode: UNKNOWN algorithm @@ -87,15 +87,15 @@ - - - - - - - - - + + + + + + + + + val1 diff --git a/tests/_data/snapshots/enum_CryptoMode-1.7.json.bin b/tests/_data/snapshots/enum_CryptoMode-1.7.json.bin index 5275eba9e..45bafe3d7 100644 --- a/tests/_data/snapshots/enum_CryptoMode-1.7.json.bin +++ b/tests/_data/snapshots/enum_CryptoMode-1.7.json.bin @@ -1,7 +1,7 @@ { "components": [ { - "bom-ref": "dummy-CIP:CBC", + "bom-ref": "dummy-CM:CBC", "cryptoProperties": { "algorithmProperties": { "mode": "cbc" @@ -12,7 +12,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CCM", + "bom-ref": "dummy-CM:CCM", "cryptoProperties": { "algorithmProperties": { "mode": "ccm" @@ -23,7 +23,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CFB", + "bom-ref": "dummy-CM:CFB", "cryptoProperties": { "algorithmProperties": { "mode": "cfb" @@ -34,7 +34,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:CTR", + "bom-ref": "dummy-CM:CTR", "cryptoProperties": { "algorithmProperties": { "mode": "ctr" @@ -45,7 +45,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:ECB", + "bom-ref": "dummy-CM:ECB", "cryptoProperties": { "algorithmProperties": { "mode": "ecb" @@ -56,7 +56,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:GCM", + "bom-ref": "dummy-CM:GCM", "cryptoProperties": { "algorithmProperties": { "mode": "gcm" @@ -67,7 +67,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:OFB", + "bom-ref": "dummy-CM:OFB", "cryptoProperties": { "algorithmProperties": { "mode": "ofb" @@ -78,7 +78,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:OTHER", + "bom-ref": "dummy-CM:OTHER", "cryptoProperties": { "algorithmProperties": { "mode": "other" @@ -89,7 +89,7 @@ "type": "cryptographic-asset" }, { - "bom-ref": "dummy-CIP:UNKNOWN", + "bom-ref": "dummy-CM:UNKNOWN", "cryptoProperties": { "algorithmProperties": { "mode": "unknown" @@ -102,31 +102,31 @@ ], "dependencies": [ { - "ref": "dummy-CIP:CBC" + "ref": "dummy-CM:CBC" }, { - "ref": "dummy-CIP:CCM" + "ref": "dummy-CM:CCM" }, { - "ref": "dummy-CIP:CFB" + "ref": "dummy-CM:CFB" }, { - "ref": "dummy-CIP:CTR" + "ref": "dummy-CM:CTR" }, { - "ref": "dummy-CIP:ECB" + "ref": "dummy-CM:ECB" }, { - "ref": "dummy-CIP:GCM" + "ref": "dummy-CM:GCM" }, { - "ref": "dummy-CIP:OFB" + "ref": "dummy-CM:OFB" }, { - "ref": "dummy-CIP:OTHER" + "ref": "dummy-CM:OTHER" }, { - "ref": "dummy-CIP:UNKNOWN" + "ref": "dummy-CM:UNKNOWN" } ], "metadata": { diff --git a/tests/_data/snapshots/enum_CryptoMode-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoMode-1.7.xml.bin index 25618f714..24814c35b 100644 --- a/tests/_data/snapshots/enum_CryptoMode-1.7.xml.bin +++ b/tests/_data/snapshots/enum_CryptoMode-1.7.xml.bin @@ -4,7 +4,7 @@ 2023-01-07T13:44:32.312678+00:00 - + CryptoMode: CBC algorithm @@ -13,7 +13,7 @@ - + CryptoMode: CCM algorithm @@ -22,7 +22,7 @@ - + CryptoMode: CFB algorithm @@ -31,7 +31,7 @@ - + CryptoMode: CTR algorithm @@ -40,7 +40,7 @@ - + CryptoMode: ECB algorithm @@ -49,7 +49,7 @@ - + CryptoMode: GCM algorithm @@ -58,7 +58,7 @@ - + CryptoMode: OFB algorithm @@ -67,7 +67,7 @@ - + CryptoMode: OTHER algorithm @@ -76,7 +76,7 @@ - + CryptoMode: UNKNOWN algorithm @@ -87,15 +87,15 @@ - - - - - - - - - + + + + + + + + + val1 diff --git a/tests/_data/snapshots/enum_CryptoPrimitive-1.6.json.bin b/tests/_data/snapshots/enum_CryptoPrimitive-1.6.json.bin index 656f8677c..062a67fdd 100644 --- a/tests/_data/snapshots/enum_CryptoPrimitive-1.6.json.bin +++ b/tests/_data/snapshots/enum_CryptoPrimitive-1.6.json.bin @@ -88,6 +88,17 @@ "name": "CryptoPrimitive: KEY_AGREE", "type": "cryptographic-asset" }, + { + "bom-ref": "dummy-CP:KEY_WRAP", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "other" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: KEY_WRAP", + "type": "cryptographic-asset" + }, { "bom-ref": "dummy-CP:MAC", "cryptoProperties": { @@ -191,6 +202,9 @@ { "ref": "dummy-CP:KEY_AGREE" }, + { + "ref": "dummy-CP:KEY_WRAP" + }, { "ref": "dummy-CP:MAC" }, diff --git a/tests/_data/snapshots/enum_CryptoPrimitive-1.6.xml.bin b/tests/_data/snapshots/enum_CryptoPrimitive-1.6.xml.bin index 658a0b6f3..03bd7e5ae 100644 --- a/tests/_data/snapshots/enum_CryptoPrimitive-1.6.xml.bin +++ b/tests/_data/snapshots/enum_CryptoPrimitive-1.6.xml.bin @@ -76,6 +76,15 @@ + + CryptoPrimitive: KEY_WRAP + + algorithm + + other + + + CryptoPrimitive: MAC @@ -149,6 +158,7 @@ + diff --git a/tests/_data/snapshots/enum_CryptoPrimitive-1.7.json.bin b/tests/_data/snapshots/enum_CryptoPrimitive-1.7.json.bin index e78b7d81c..063c4cb37 100644 --- a/tests/_data/snapshots/enum_CryptoPrimitive-1.7.json.bin +++ b/tests/_data/snapshots/enum_CryptoPrimitive-1.7.json.bin @@ -88,6 +88,17 @@ "name": "CryptoPrimitive: KEY_AGREE", "type": "cryptographic-asset" }, + { + "bom-ref": "dummy-CP:KEY_WRAP", + "cryptoProperties": { + "algorithmProperties": { + "primitive": "key-wrap" + }, + "assetType": "algorithm" + }, + "name": "CryptoPrimitive: KEY_WRAP", + "type": "cryptographic-asset" + }, { "bom-ref": "dummy-CP:MAC", "cryptoProperties": { @@ -191,6 +202,9 @@ { "ref": "dummy-CP:KEY_AGREE" }, + { + "ref": "dummy-CP:KEY_WRAP" + }, { "ref": "dummy-CP:MAC" }, diff --git a/tests/_data/snapshots/enum_CryptoPrimitive-1.7.xml.bin b/tests/_data/snapshots/enum_CryptoPrimitive-1.7.xml.bin index 5e5591c99..f6b9bdae3 100644 --- a/tests/_data/snapshots/enum_CryptoPrimitive-1.7.xml.bin +++ b/tests/_data/snapshots/enum_CryptoPrimitive-1.7.xml.bin @@ -76,6 +76,15 @@ + + CryptoPrimitive: KEY_WRAP + + algorithm + + key-wrap + + + CryptoPrimitive: MAC @@ -149,6 +158,7 @@ + From 840a32cdfc954c2dbc328cae1612e00f67347d03 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 09:43:09 +0200 Subject: [PATCH 28/41] dings Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 70 +++++++++++++--- .../enum_ProtocolPropertiesType-1.6.json.bin | 84 +++++++++++++++++++ .../enum_ProtocolPropertiesType-1.6.xml.bin | 60 +++++++++++++ .../enum_ProtocolPropertiesType-1.7.json.bin | 84 +++++++++++++++++++ .../enum_ProtocolPropertiesType-1.7.xml.bin | 60 +++++++++++++ 5 files changed, 348 insertions(+), 10 deletions(-) diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index 7bdeedb03..89e099867 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -80,7 +80,7 @@ class CryptoPrimitive(str, Enum): KDF = 'kdf' KEM = 'kem' KEY_AGREE = 'key-agree' - KEY_WRAP = 'key-wrap' # since CDX1.7key-wrap + KEY_WRAP = 'key-wrap' # since CDX1.7 MAC = 'mac' PKE = 'pke' SIGNATURE = 'signature' @@ -190,13 +190,13 @@ class CryptoImplementationPlatform(str, Enum): ARMV8_M = 'armv8-m' ARMV9_A = 'armv9-a' ARMV9_M = 'armv9-m' - GENERIC = 'generic' # TODO: move down PPC64 = 'ppc64' PPC64LE = 'ppc64le' S390X = 's390x' X86_32 = 'x86_32' X86_64 = 'x86_64' # -- + GENERIC = 'generic' OTHER = 'other' UNKNOWN = 'unknown' @@ -799,7 +799,7 @@ class RelatedCryptoMaterialType(str, Enum): SIGNATURE = 'signature' TAG = 'tag' TOKEN = 'token' # nosec - + # -- OTHER = 'other' UNKNOWN = 'unknown' @@ -1164,23 +1164,72 @@ class ProtocolPropertiesType(str, Enum): See the CycloneDX Schema for hashType: https://cyclonedx.org/docs/1.7/xml/#type_cryptoPropertiesType """ + DTLS = 'dtls' # since CDX1.7 + EAP_AKA ='eap-aka' # since CDX1.7 + EAP_AKA_PRIME ='eap-aka-prime' # since CDX1.7 + FIVEG_AKA = '5g-aka' # since CDX1.7 IKE = 'ike' IPSEC = 'ipsec' + PRINS = 'prins' # since CDX1.7 + QUIC = 'quic' # since CDX1.7 SSH = 'ssh' SSTP = 'sstp' TLS = 'tls' WPA = 'wpa' - # TODO: add 'eap-aka-prime' - # TODO: add '5g-aka' - # TODO: add 'dtls' - # TODO: add 'quic' - # TODO: add 'eap-aka' - # TODO: add 'prins' - + # -- OTHER = 'other' UNKNOWN = 'unknown' +class _ProtocolPropertiesTypeSerializationHelper(serializable.helpers.BaseHelper): + """ THIS CLASS IS NON-PUBLIC API """ + + __CASES: dict[type[serializable.ViewType], frozenset[ProtocolPropertiesType]] = dict() + __CASES[SchemaVersion1Dot6] = frozenset({ + ProtocolPropertiesType.IKE, + ProtocolPropertiesType.IPSEC, + ProtocolPropertiesType.SSH, + ProtocolPropertiesType.SSTP, + ProtocolPropertiesType.TLS, + ProtocolPropertiesType.WPA, + ProtocolPropertiesType.OTHER, + ProtocolPropertiesType.UNKNOWN, + }) + __CASES[SchemaVersion1Dot7] = __CASES[SchemaVersion1Dot6] | { + ProtocolPropertiesType.DTLS, + ProtocolPropertiesType.EAP_AKA, + ProtocolPropertiesType.EAP_AKA_PRIME, + ProtocolPropertiesType.PRINS, + ProtocolPropertiesType.QUIC, + } + + @classmethod + def __normalize(cls, ppt: ProtocolPropertiesType, view: type[serializable.ViewType]) -> str: + return ( + ppt + if ppt in cls.__CASES.get(view, ()) + else ProtocolPropertiesType.OTHER + ).value + + @classmethod + def json_normalize(cls, o: Any, *, + view: Optional[type[serializable.ViewType]], + **__: Any) -> str: + assert view is not None + return cls.__normalize(o, view) + + @classmethod + def xml_normalize(cls, o: Any, *, + view: Optional[type[serializable.ViewType]], + **__: Any) -> str: + assert view is not None + return cls.__normalize(o, view) + + @classmethod + def deserialize(cls, o: Any) -> ProtocolPropertiesType: + return ProtocolPropertiesType(o) + + @serializable.serializable_class(ignore_unknown_during_deserialization=True) class ProtocolPropertiesCipherSuite: """ @@ -1450,6 +1499,7 @@ def __init__( self.crypto_refs = crypto_refs or [] @property + @serializable.type_mapping(_ProtocolPropertiesTypeSerializationHelper) @serializable.xml_sequence(10) def type(self) -> Optional[ProtocolPropertiesType]: """ diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.json.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.json.bin index 8fd17bd06..44e45f54f 100644 --- a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.json.bin +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.json.bin @@ -1,5 +1,49 @@ { "components": [ + { + "bom-ref": "dummy-PPT:DTLS", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "other" + } + }, + "name": "ProtocolPropertiesType: DTLS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:EAP_AKA", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "other" + } + }, + "name": "ProtocolPropertiesType: EAP_AKA", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:EAP_AKA_PRIME", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "other" + } + }, + "name": "ProtocolPropertiesType: EAP_AKA_PRIME", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:FIVEG_AKA", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "other" + } + }, + "name": "ProtocolPropertiesType: FIVEG_AKA", + "type": "cryptographic-asset" + }, { "bom-ref": "dummy-PPT:IKE", "cryptoProperties": { @@ -33,6 +77,28 @@ "name": "ProtocolPropertiesType: OTHER", "type": "cryptographic-asset" }, + { + "bom-ref": "dummy-PPT:PRINS", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "other" + } + }, + "name": "ProtocolPropertiesType: PRINS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:QUIC", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "other" + } + }, + "name": "ProtocolPropertiesType: QUIC", + "type": "cryptographic-asset" + }, { "bom-ref": "dummy-PPT:SSH", "cryptoProperties": { @@ -90,6 +156,18 @@ } ], "dependencies": [ + { + "ref": "dummy-PPT:DTLS" + }, + { + "ref": "dummy-PPT:EAP_AKA" + }, + { + "ref": "dummy-PPT:EAP_AKA_PRIME" + }, + { + "ref": "dummy-PPT:FIVEG_AKA" + }, { "ref": "dummy-PPT:IKE" }, @@ -99,6 +177,12 @@ { "ref": "dummy-PPT:OTHER" }, + { + "ref": "dummy-PPT:PRINS" + }, + { + "ref": "dummy-PPT:QUIC" + }, { "ref": "dummy-PPT:SSH" }, diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.xml.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.xml.bin index 5ff87918c..36e1bc064 100644 --- a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.xml.bin +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.xml.bin @@ -4,6 +4,42 @@ 2023-01-07T13:44:32.312678+00:00 + + ProtocolPropertiesType: DTLS + + protocol + + other + + + + + ProtocolPropertiesType: EAP_AKA + + protocol + + other + + + + + ProtocolPropertiesType: EAP_AKA_PRIME + + protocol + + other + + + + + ProtocolPropertiesType: FIVEG_AKA + + protocol + + other + + + ProtocolPropertiesType: IKE @@ -31,6 +67,24 @@ + + ProtocolPropertiesType: PRINS + + protocol + + other + + + + + ProtocolPropertiesType: QUIC + + protocol + + other + + + ProtocolPropertiesType: SSH @@ -78,9 +132,15 @@ + + + + + + diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin index f9e41dc40..cd49ffcab 100644 --- a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin @@ -1,5 +1,49 @@ { "components": [ + { + "bom-ref": "dummy-PPT:DTLS", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "dtls" + } + }, + "name": "ProtocolPropertiesType: DTLS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:EAP_AKA", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "eap-aka" + } + }, + "name": "ProtocolPropertiesType: EAP_AKA", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:EAP_AKA_PRIME", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "eap-aka-prime" + } + }, + "name": "ProtocolPropertiesType: EAP_AKA_PRIME", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:FIVEG_AKA", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "other" + } + }, + "name": "ProtocolPropertiesType: FIVEG_AKA", + "type": "cryptographic-asset" + }, { "bom-ref": "dummy-PPT:IKE", "cryptoProperties": { @@ -33,6 +77,28 @@ "name": "ProtocolPropertiesType: OTHER", "type": "cryptographic-asset" }, + { + "bom-ref": "dummy-PPT:PRINS", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "prins" + } + }, + "name": "ProtocolPropertiesType: PRINS", + "type": "cryptographic-asset" + }, + { + "bom-ref": "dummy-PPT:QUIC", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "quic" + } + }, + "name": "ProtocolPropertiesType: QUIC", + "type": "cryptographic-asset" + }, { "bom-ref": "dummy-PPT:SSH", "cryptoProperties": { @@ -90,6 +156,18 @@ } ], "dependencies": [ + { + "ref": "dummy-PPT:DTLS" + }, + { + "ref": "dummy-PPT:EAP_AKA" + }, + { + "ref": "dummy-PPT:EAP_AKA_PRIME" + }, + { + "ref": "dummy-PPT:FIVEG_AKA" + }, { "ref": "dummy-PPT:IKE" }, @@ -99,6 +177,12 @@ { "ref": "dummy-PPT:OTHER" }, + { + "ref": "dummy-PPT:PRINS" + }, + { + "ref": "dummy-PPT:QUIC" + }, { "ref": "dummy-PPT:SSH" }, diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin index 414beab2b..8e2ce7112 100644 --- a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin @@ -4,6 +4,42 @@ 2023-01-07T13:44:32.312678+00:00 + + ProtocolPropertiesType: DTLS + + protocol + + dtls + + + + + ProtocolPropertiesType: EAP_AKA + + protocol + + eap-aka + + + + + ProtocolPropertiesType: EAP_AKA_PRIME + + protocol + + eap-aka-prime + + + + + ProtocolPropertiesType: FIVEG_AKA + + protocol + + other + + + ProtocolPropertiesType: IKE @@ -31,6 +67,24 @@ + + ProtocolPropertiesType: PRINS + + protocol + + prins + + + + + ProtocolPropertiesType: QUIC + + protocol + + quic + + + ProtocolPropertiesType: SSH @@ -78,9 +132,15 @@ + + + + + + From 82004df37ac363cd3fe11b40734411bcc4b43ab8 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 09:55:29 +0200 Subject: [PATCH 29/41] dings Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 12 ++-- tests/test_enums.py | 147 +++++++++++++++++++++++++------------- 2 files changed, 102 insertions(+), 57 deletions(-) diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index 89e099867..03d95cf86 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -80,7 +80,7 @@ class CryptoPrimitive(str, Enum): KDF = 'kdf' KEM = 'kem' KEY_AGREE = 'key-agree' - KEY_WRAP = 'key-wrap' # since CDX1.7 + KEY_WRAP = 'key-wrap' # since CDX1.7 MAC = 'mac' PKE = 'pke' SIGNATURE = 'signature' @@ -91,7 +91,6 @@ class CryptoPrimitive(str, Enum): UNKNOWN = 'unknown' - class _CryptoPrimitiveSerializationHelper(serializable.helpers.BaseHelper): """ THIS CLASS IS NON-PUBLIC API """ @@ -144,7 +143,6 @@ def deserialize(cls, o: Any) -> CryptoPrimitive: return CryptoPrimitive(o) - @serializable.serializable_enum class CryptoExecutionEnvironment(str, Enum): # TODO: rename to `CryptoAlgorithmExecutionEnvironment` @@ -1165,13 +1163,13 @@ class ProtocolPropertiesType(str, Enum): """ DTLS = 'dtls' # since CDX1.7 - EAP_AKA ='eap-aka' # since CDX1.7 - EAP_AKA_PRIME ='eap-aka-prime' # since CDX1.7 + EAP_AKA = 'eap-aka' # since CDX1.7 + EAP_AKA_PRIME = 'eap-aka-prime' # since CDX1.7 FIVEG_AKA = '5g-aka' # since CDX1.7 IKE = 'ike' IPSEC = 'ipsec' - PRINS = 'prins' # since CDX1.7 - QUIC = 'quic' # since CDX1.7 + PRINS = 'prins' # since CDX1.7 + QUIC = 'quic' # since CDX1.7 SSH = 'ssh' SSTP = 'sstp' TLS = 'tls' diff --git a/tests/test_enums.py b/tests/test_enums.py index 4d3cf3da8..7ba054d05 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -36,7 +36,12 @@ from cyclonedx.model.bom import Bom, BomMetaData, DistributionConstraints, TlpClassification from cyclonedx.model.component import Component, Patch, Pedigree from cyclonedx.model.component_evidence import ComponentEvidence, Identity as CEIdentity, Method as CEMethod -from cyclonedx.model.crypto import CryptoProperties, AlgorithmProperties, RelatedCryptoMaterialProperties, ProtocolProperties +from cyclonedx.model.crypto import ( + AlgorithmProperties, + CryptoProperties, + ProtocolProperties, + RelatedCryptoMaterialProperties, +) from cyclonedx.model.issue import IssueType from cyclonedx.model.license import DisjunctiveLicense from cyclonedx.model.lifecycle import LifecyclePhase, PredefinedLifecycle @@ -89,17 +94,17 @@ VulnerabilitySeverity, ) from cyclonedx.model.crypto import ( # isort:skip - CryptoAssetType, - CryptoPrimitive, - CryptoExecutionEnvironment, - CryptoImplementationPlatform, - CryptoCertificationLevel, - CryptoMode, - CryptoPadding, - CryptoFunction, - RelatedCryptoMaterialType, - RelatedCryptoMaterialState, - ProtocolPropertiesType, + CryptoAssetType, + CryptoCertificationLevel, + CryptoExecutionEnvironment, + CryptoFunction, + CryptoImplementationPlatform, + CryptoMode, + CryptoPadding, + CryptoPrimitive, + ProtocolPropertiesType, + RelatedCryptoMaterialState, + RelatedCryptoMaterialType, ) # endregion SUT @@ -124,6 +129,7 @@ def dp_cases_from_xml_schemas(xpath: str) -> set[str]: raise ValueError(f'no values for xpath: {xpath!r}') return cases + def dp_cases_from_json_schema(sf: str, jsonpointer: Iterable[str]) -> Generator[str, None, None]: with open(sf) as sfh: data = json_load(sfh) @@ -513,7 +519,8 @@ class TestEnumLifecyclePhase(_EnumTestCase): @idata(set(chain( dp_cases_from_xml_schemas(f"./{SCHEMA_NS}simpleType[@name='lifecyclePhaseType']"), - dp_cases_from_json_schemas('definitions', 'metadata', 'properties', 'lifecycles', 'items', 'oneOf', 0, 'properties', 'phase'), + dp_cases_from_json_schemas('definitions', 'metadata', 'properties', 'lifecycles', + 'items', 'oneOf', 0, 'properties', 'phase'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(LifecyclePhase, value) @@ -621,17 +628,20 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, ]) super()._test_cases_render(bom, of, sv) + @ddt class TestEnumCryptoAssetType(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='assetType']/{SCHEMA_NS}simpleType"), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='assetType']/{SCHEMA_NS}simpleType"), dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'assetType'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(CryptoAssetType, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -650,13 +660,17 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, class TestEnumCryptoPrimitive(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='primitive']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'primitive'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='primitive']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'algorithmProperties', 'properties', 'primitive'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(CryptoPrimitive, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -678,13 +692,17 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, class TestEnumCryptoExecutionEnvironment(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='executionEnvironment']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'executionEnvironment'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='executionEnvironment']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'algorithmProperties', 'properties', 'executionEnvironment'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(CryptoExecutionEnvironment, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -702,22 +720,25 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) - @ddt class TestEnumCryptoImplementationPlatform (_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='implementationPlatform']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'implementationPlatform'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='implementationPlatform']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'algorithmProperties', 'properties', 'implementationPlatform'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(CryptoImplementationPlatform, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ - Component( + Component( name=f'CryptoImplementationPlatform: {cip.name}', bom_ref=f'dummy-CIP:{cip.name}', type=ComponentType.CRYPTOGRAPHIC_ASSET, crypto_properties=CryptoProperties( @@ -735,13 +756,17 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, class TestEnumCryptoCertificationLevel (_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='certificationLevel']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'certificationLevel', 'items'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='certificationLevel']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'algorithmProperties', 'properties', 'certificationLevel', 'items'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(CryptoCertificationLevel, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -759,18 +784,21 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) - @ddt class TestEnumCryptoMode(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='mode']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'mode'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType" + f"/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='mode']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'algorithmProperties', 'properties', 'mode'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(CryptoMode, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -792,13 +820,17 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, class TestEnumCryptoPadding(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='padding']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'padding'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='padding']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'algorithmProperties', 'properties', 'padding'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(CryptoPadding, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -820,13 +852,18 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, class TestEnumCryptoFunction(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='cryptoFunctions']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='cryptoFunction']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'algorithmProperties', 'properties', 'cryptoFunctions', 'items'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='algorithmProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='cryptoFunctions']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='cryptoFunction']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'algorithmProperties', 'properties', 'cryptoFunctions', 'items'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(CryptoFunction, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -844,18 +881,21 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) - @ddt class TestEnumRelatedCryptoMaterialType(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='relatedCryptoMaterialProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='type']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'relatedCryptoMaterialProperties', 'properties', 'type'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='relatedCryptoMaterialProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='type']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'relatedCryptoMaterialProperties', 'properties', 'type'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(RelatedCryptoMaterialType, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -877,13 +917,17 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, class TestEnumRelatedCryptoMaterialState(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='relatedCryptoMaterialProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='state']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'relatedCryptoMaterialProperties', 'properties', 'state'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='relatedCryptoMaterialProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='state']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'relatedCryptoMaterialProperties', 'properties', 'state'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(RelatedCryptoMaterialState, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -905,13 +949,17 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, class TestEnumProtocolPropertiesType(_EnumTestCase): @idata(set(chain( - dp_cases_from_xml_schemas(f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='protocolProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence/{SCHEMA_NS}element[@name='type']/{SCHEMA_NS}simpleType"), - dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', 'protocolProperties', 'properties', 'type'), + dp_cases_from_xml_schemas( + f"./{SCHEMA_NS}complexType[@name='cryptoPropertiesType']/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='protocolProperties']/{SCHEMA_NS}complexType/{SCHEMA_NS}sequence" + f"/{SCHEMA_NS}element[@name='type']/{SCHEMA_NS}simpleType"), + dp_cases_from_json_schemas('definitions', 'cryptoProperties', 'properties', + 'protocolProperties', 'properties', 'type'), ))) def test_knows_value(self, value: str) -> None: super()._test_knows_value(ProtocolPropertiesType, value) - @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6 )) + @named_data(*(d for d in NAMED_OF_SV if d[2] >= SchemaVersion.V1_6)) def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None: bom = _make_bom( components=[ @@ -929,7 +977,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, super()._test_cases_render(bom, of, sv) - # add new test cases above this line From 5d813fbd6eb39dba2e327057ed479a4ac04caf7a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 10:10:20 +0200 Subject: [PATCH 30/41] dings Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 7ba054d05..aaf836cd0 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -1000,12 +1000,12 @@ def __get_defined_enumcases(cls) -> tuple[str, ...]: and obj.__module__ and obj.__module__ == __name__ and issubclass(obj, _EnumTestCase) - and not obj is _EnumTestCase + and obj is not _EnumTestCase ) return cls.__defined_enumcases @staticmethod - def __get_defined_model_enums(): + def __get_defined_model_enums() -> Generator[str, None, None]: models_path = path.join(path.dirname(__file__), '..', 'cyclonedx', 'model') model_files = glob(path.join('**', '*.py'), root_dir=models_path, recursive=True) for model_file in model_files: @@ -1024,7 +1024,7 @@ def __get_defined_model_enums(): break @idata(__get_defined_model_enums()) - def test_case_exists(self, enum_name) -> None: + def test_case_exists(self, enum_name: str) -> None: self.assertIn(f'{self.__TestCasePrefix}{enum_name}', self.__get_defined_enumcases(), f'Missing Test Case for Enum: {enum_name}') From 3b5fb6d0a35dd5e04f7ca8f2c2d1cbb38f4470b0 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 10:11:48 +0200 Subject: [PATCH 31/41] dings Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index aaf836cd0..bbba3a7b6 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -1009,7 +1009,7 @@ def __get_defined_model_enums() -> Generator[str, None, None]: models_path = path.join(path.dirname(__file__), '..', 'cyclonedx', 'model') model_files = glob(path.join('**', '*.py'), root_dir=models_path, recursive=True) for model_file in model_files: - with open(path.join(models_path, model_file), 'r', encoding='utf-8') as f: + with open(path.join(models_path, model_file), encoding='utf-8') as f: tree = ast.parse(f.read(), filename=model_file) for node in ast.walk(tree): if isinstance(node, ast.ClassDef): From 4c1ffb531c0d6a7495470490196cabcc92fb40be Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 10:21:48 +0200 Subject: [PATCH 32/41] dings Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index bbba3a7b6..0aa586cf6 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -1023,7 +1023,9 @@ def __get_defined_model_enums() -> Generator[str, None, None]: yield node.name break - @idata(__get_defined_model_enums()) + @idata( + __get_defined_model_enums.__func__() # py39 compat + ) def test_case_exists(self, enum_name: str) -> None: self.assertIn(f'{self.__TestCasePrefix}{enum_name}', self.__get_defined_enumcases(), From 2da1b78143b8cfef31bdbb8eea591a7aa2abe896 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 10:28:28 +0200 Subject: [PATCH 33/41] dings Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 0aa586cf6..d549e2345 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -16,6 +16,7 @@ # Copyright (c) OWASP Foundation. All Rights Reserved. import ast +import sys from collections.abc import Generator, Iterable from decimal import Decimal from enum import Enum @@ -24,7 +25,7 @@ from json import load as json_load from os import path from typing import Any, Optional -from unittest import TestCase +from unittest import TestCase, skipIf from warnings import warn from xml.etree.ElementTree import parse as xml_parse # nosec B405 @@ -980,6 +981,7 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, # add new test cases above this line +@skipIf(sys.version_info < (3, 10), "Requires Python 3.10+") @ddt class TestCaseCompleteness(TestCase): """ @@ -1023,9 +1025,7 @@ def __get_defined_model_enums() -> Generator[str, None, None]: yield node.name break - @idata( - __get_defined_model_enums.__func__() # py39 compat - ) + @idata(__get_defined_model_enums()) def test_case_exists(self, enum_name: str) -> None: self.assertIn(f'{self.__TestCasePrefix}{enum_name}', self.__get_defined_enumcases(), From 811b78e3d47c23a72727af324cfaf4ebb90ace87 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 10:30:13 +0200 Subject: [PATCH 34/41] dings Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index d549e2345..1359cb1c2 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -981,7 +981,7 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, # add new test cases above this line -@skipIf(sys.version_info < (3, 10), "Requires Python 3.10+") +@skipIf(sys.version_info < (3, 10), 'Requires Python 3.10+') @ddt class TestCaseCompleteness(TestCase): """ From 598f147af736a4d7e3e97f93de212642d1eb9307 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 10:39:14 +0200 Subject: [PATCH 35/41] dings Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 1359cb1c2..9e36fbd24 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -16,7 +16,6 @@ # Copyright (c) OWASP Foundation. All Rights Reserved. import ast -import sys from collections.abc import Generator, Iterable from decimal import Decimal from enum import Enum @@ -25,7 +24,7 @@ from json import load as json_load from os import path from typing import Any, Optional -from unittest import TestCase, skipIf +from unittest import TestCase from warnings import warn from xml.etree.ElementTree import parse as xml_parse # nosec B405 @@ -981,7 +980,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, # add new test cases above this line -@skipIf(sys.version_info < (3, 10), 'Requires Python 3.10+') @ddt class TestCaseCompleteness(TestCase): """ @@ -1008,10 +1006,10 @@ def __get_defined_enumcases(cls) -> tuple[str, ...]: @staticmethod def __get_defined_model_enums() -> Generator[str, None, None]: - models_path = path.join(path.dirname(__file__), '..', 'cyclonedx', 'model') - model_files = glob(path.join('**', '*.py'), root_dir=models_path, recursive=True) + models_path = path.abspath(path.join(path.dirname(__file__), '..', 'cyclonedx', 'model')) + model_files = glob(path.join(models_path, '**', '*.py'), recursive=True) for model_file in model_files: - with open(path.join(models_path, model_file), encoding='utf-8') as f: + with open(model_file, encoding='utf-8') as f: tree = ast.parse(f.read(), filename=model_file) for node in ast.walk(tree): if isinstance(node, ast.ClassDef): @@ -1025,7 +1023,9 @@ def __get_defined_model_enums() -> Generator[str, None, None]: yield node.name break - @idata(__get_defined_model_enums()) + @idata( + __get_defined_model_enums.__func__() # py3.9 compat + ) def test_case_exists(self, enum_name: str) -> None: self.assertIn(f'{self.__TestCasePrefix}{enum_name}', self.__get_defined_enumcases(), From da6ba63c4f899f014c2f740555b46719728edc03 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 10:54:51 +0200 Subject: [PATCH 36/41] dings Signed-off-by: Jan Kowalleck --- tests/test_enums.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_enums.py b/tests/test_enums.py index 9e36fbd24..d2b9ac98a 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -1005,10 +1005,11 @@ def __get_defined_enumcases(cls) -> tuple[str, ...]: return cls.__defined_enumcases @staticmethod - def __get_defined_model_enums() -> Generator[str, None, None]: + def __get_defined_model_enums() -> Generator[tuple[str, str], None, None]: models_path = path.abspath(path.join(path.dirname(__file__), '..', 'cyclonedx', 'model')) model_files = glob(path.join(models_path, '**', '*.py'), recursive=True) for model_file in model_files: + model_file_rel = path.relpath(model_file, models_path) with open(model_file, encoding='utf-8') as f: tree = ast.parse(f.read(), filename=model_file) for node in ast.walk(tree): @@ -1016,17 +1017,18 @@ def __get_defined_model_enums() -> Generator[str, None, None]: for base in node.bases: # Case 1: direct name: "Enum" if isinstance(base, ast.Name) and base.id == 'Enum': - yield node.name + yield model_file_rel, node.name break # Case 2: qualified name: "enum.Enum" if isinstance(base, ast.Attribute) and base.attr == 'Enum': - yield node.name + yield model_file_rel, node.name break @idata( __get_defined_model_enums.__func__() # py3.9 compat ) - def test_case_exists(self, enum_name: str) -> None: + def test_case_exists(self, defined_model_enums: tuple[str, str]) -> None: + model_file_rel, enum_name = defined_model_enums self.assertIn(f'{self.__TestCasePrefix}{enum_name}', self.__get_defined_enumcases(), - f'Missing Test Case for Enum: {enum_name}') + f'Missing Test Case for Enum {enum_name!r} from File {model_file_rel!r}') From 01ac58c71e567d5f20e0cdb7031ab37319f0f30a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 11:04:54 +0200 Subject: [PATCH 37/41] dings Signed-off-by: Jan Kowalleck --- tests/__init__.py | 7 ++++++- tests/test_enums.py | 7 +++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 585b8649f..4b2f11bd6 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -34,6 +34,11 @@ _T = TypeVar('_T') + +PROJECT_ROOT_DIRECTORY = path.abspath(path.join(path.dirname(__file__), '..')) +PROJECT_LIB_DIRECTORY = path.join(PROJECT_ROOT_DIRECTORY, 'cyclonedx') +PROJECT_LIB_MODELS_DIRECTORY = path.join(PROJECT_LIB_DIRECTORY, 'model') + _TESTDATA_DIRECTORY = path.join(path.dirname(__file__), '_data') SCHEMA_TESTDATA_DIRECTORY = path.join(_TESTDATA_DIRECTORY, 'schemaTestData') @@ -199,5 +204,5 @@ def load_pyproject() -> dict[str, Any]: from tomllib import load as toml_load else: from tomli import load as toml_load - with open(path.join(path.dirname(__file__), '..', 'pyproject.toml'), 'rb') as f: + with open(path.join(PROJECT_ROOT_DIRECTORY, 'pyproject.toml'), 'rb') as f: return toml_load(f) diff --git a/tests/test_enums.py b/tests/test_enums.py index d2b9ac98a..88ac8e714 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -57,7 +57,7 @@ from cyclonedx.schema import OutputFormat, SchemaVersion from cyclonedx.schema._res import BOM_JSON as SCHEMA_JSON, BOM_XML as SCHEMA_XML from cyclonedx.validation import make_schemabased_validator -from tests import SnapshotMixin +from tests import PROJECT_LIB_MODELS_DIRECTORY, SnapshotMixin from tests._data.models import _make_bom # region SUT: all the enums @@ -1006,10 +1006,9 @@ def __get_defined_enumcases(cls) -> tuple[str, ...]: @staticmethod def __get_defined_model_enums() -> Generator[tuple[str, str], None, None]: - models_path = path.abspath(path.join(path.dirname(__file__), '..', 'cyclonedx', 'model')) - model_files = glob(path.join(models_path, '**', '*.py'), recursive=True) + model_files = glob(path.join(PROJECT_LIB_MODELS_DIRECTORY, '**', '*.py'), recursive=True) for model_file in model_files: - model_file_rel = path.relpath(model_file, models_path) + model_file_rel = path.relpath(model_file, PROJECT_LIB_MODELS_DIRECTORY) with open(model_file, encoding='utf-8') as f: tree = ast.parse(f.read(), filename=model_file) for node in ast.walk(tree): From 0f845c41109e61338321a143c975e4318410978e Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 11:15:00 +0200 Subject: [PATCH 38/41] dings Signed-off-by: Jan Kowalleck --- tests/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/__init__.py b/tests/__init__.py index 4b2f11bd6..31bf18d98 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -45,7 +45,7 @@ OWN_DATA_DIRECTORY = path.join(_TESTDATA_DIRECTORY, 'own') SNAPSHOTS_DIRECTORY = path.join(_TESTDATA_DIRECTORY, 'snapshots') -RECREATE_SNAPSHOTS = True or '1' == getenv('CDX_TEST_RECREATE_SNAPSHOTS') +RECREATE_SNAPSHOTS = '1' == getenv('CDX_TEST_RECREATE_SNAPSHOTS') if RECREATE_SNAPSHOTS: print('!!! WILL RECREATE ALL SNAPSHOTS !!!') From 094104dd45e22fcb7c9a19a5a3489bed7c27d934 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 12:16:24 +0200 Subject: [PATCH 39/41] docs Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index 03d95cf86..ffb160d79 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -201,7 +201,7 @@ class CryptoImplementationPlatform(str, Enum): @serializable.serializable_enum class CryptoCertificationLevel(str, Enum): - # TODO: move to `CryptoAlgorithmCertificationLevel` + # TODO: rename to `CryptoAlgorithmCertificationLevel` """ This is our internal representation of the cryptoPropertiesType.algorithmProperties.certificationLevel ENUM type From 525e82a7cb0a01d73759be571783d38ca01307e8 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 12:28:38 +0200 Subject: [PATCH 40/41] dings Signed-off-by: Jan Kowalleck --- cyclonedx/model/crypto.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py index ffb160d79..44bdc182f 100644 --- a/cyclonedx/model/crypto.py +++ b/cyclonedx/model/crypto.py @@ -1197,6 +1197,7 @@ class _ProtocolPropertiesTypeSerializationHelper(serializable.helpers.BaseHelper ProtocolPropertiesType.DTLS, ProtocolPropertiesType.EAP_AKA, ProtocolPropertiesType.EAP_AKA_PRIME, + ProtocolPropertiesType.FIVEG_AKA, ProtocolPropertiesType.PRINS, ProtocolPropertiesType.QUIC, } From 857b885f46077075f043d84bb7823390cdfa0846 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 17 Jun 2026 12:35:50 +0200 Subject: [PATCH 41/41] tests Signed-off-by: Jan Kowalleck --- tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin | 2 +- tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin index cd49ffcab..9d35a3ee6 100644 --- a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin @@ -38,7 +38,7 @@ "cryptoProperties": { "assetType": "protocol", "protocolProperties": { - "type": "other" + "type": "5g-aka" } }, "name": "ProtocolPropertiesType: FIVEG_AKA", diff --git a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin index 8e2ce7112..d4d4ea0e8 100644 --- a/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin +++ b/tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin @@ -36,7 +36,7 @@ protocol - other + 5g-aka