Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
500f3cf
tests: test all the enums.
jkowalleck Jun 8, 2026
06f34c5
tests: test all the enums.
jkowalleck Jun 8, 2026
5efa460
tests: LicenseAcknowledgement
jkowalleck Jun 8, 2026
8ddc37f
isort
jkowalleck Jun 8, 2026
1dfe71f
autopep8
jkowalleck Jun 8, 2026
20509fe
tests: TestEnumIdentityField & TestEnumAnalysisTechnique
jkowalleck Jun 8, 2026
44a98ef
autopep8
jkowalleck Jun 8, 2026
ec38b2e
test data
jkowalleck Jun 8, 2026
f4ae307
tests: TestEnumIdentityField & TestEnumAnalysisTechnique
jkowalleck Jun 8, 2026
4868e2d
autopep8
jkowalleck Jun 8, 2026
b29e49c
tests: enum CryptoAssetType
jkowalleck Jun 15, 2026
4ff6db8
tests: enum CryptoAssetType
jkowalleck Jun 15, 2026
a3f5eea
tests: enum CryptoPrimitive
jkowalleck Jun 15, 2026
9129d38
tests: enum CryptoPrimitive
jkowalleck Jun 15, 2026
1860d13
tests: enum CryptoExecutionEnvironment
jkowalleck Jun 15, 2026
e70a29f
tests: enum CryptoImplementationPlatform
jkowalleck Jun 15, 2026
d27a097
tests: enum CryptoCertificationLevel
jkowalleck Jun 15, 2026
fef2e7c
tests: enum CryptoMode
jkowalleck Jun 15, 2026
0c54bb4
tests: enum CryptoMode
jkowalleck Jun 15, 2026
b87c379
CryptoPadding
jkowalleck Jun 16, 2026
c8307d8
tests
jkowalleck Jun 16, 2026
29a3298
CryptoFunction
jkowalleck Jun 16, 2026
aab68c0
RelatedCryptoMaterialType
jkowalleck Jun 17, 2026
2e8ea4e
RelatedCryptoMaterialType
jkowalleck Jun 17, 2026
b1ef576
RelatedCryptoMaterialState
jkowalleck Jun 17, 2026
33e4f35
ProtocolPropertiesType
jkowalleck Jun 17, 2026
cadb83e
dings
jkowalleck Jun 17, 2026
840a32c
dings
jkowalleck Jun 17, 2026
82004df
dings
jkowalleck Jun 17, 2026
5d813fb
dings
jkowalleck Jun 17, 2026
3b5fb6d
dings
jkowalleck Jun 17, 2026
4c1ffb5
dings
jkowalleck Jun 17, 2026
2da1b78
dings
jkowalleck Jun 17, 2026
811b78e
dings
jkowalleck Jun 17, 2026
598f147
dings
jkowalleck Jun 17, 2026
da6ba63
dings
jkowalleck Jun 17, 2026
01ac58c
dings
jkowalleck Jun 17, 2026
0f845c4
dings
jkowalleck Jun 17, 2026
c2e7b02
Merge branch 'main' into tests/check-all-enum-completeness
jkowalleck Jun 17, 2026
094104d
docs
jkowalleck Jun 17, 2026
525e82a
dings
jkowalleck Jun 17, 2026
57766c2
Merge remote-tracking branch 'origin/main' into tests/check-all-enum-…
jkowalleck Jun 17, 2026
857b885
tests
jkowalleck Jun 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions cyclonedx/model/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class CryptoAssetType(str, Enum):

@serializable.serializable_enum
class CryptoPrimitive(str, Enum):
# TODO: rename to `CryptoAlgorithmPrimitive`
Comment thread
jkowalleck marked this conversation as resolved.

"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.primitive ENUM type within the
CycloneDX standard.
Expand Down Expand Up @@ -143,6 +145,8 @@ def deserialize(cls, o: Any) -> CryptoPrimitive:

@serializable.serializable_enum
class CryptoExecutionEnvironment(str, Enum):
# TODO: rename to `CryptoAlgorithmExecutionEnvironment`
Comment thread
jkowalleck marked this conversation as resolved.

"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.executionEnvironment ENUM type
within the CycloneDX standard.
Expand All @@ -158,13 +162,15 @@ class CryptoExecutionEnvironment(str, Enum):
SOFTWARE_ENCRYPTED_RAM = 'software-encrypted-ram'
SOFTWARE_PLAIN_RAM = 'software-plain-ram'
SOFTWARE_TEE = 'software-tee'

# --
OTHER = 'other'
UNKNOWN = 'unknown'


@serializable.serializable_enum
class CryptoImplementationPlatform(str, Enum):
# TODO: rename to `CryptoAlgorithmImplementationPlatform`
Comment thread
jkowalleck marked this conversation as resolved.

"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.implementationPlatform ENUM type
within the CycloneDX standard.
Expand All @@ -182,19 +188,21 @@ class CryptoImplementationPlatform(str, Enum):
ARMV8_M = 'armv8-m'
ARMV9_A = 'armv9-a'
ARMV9_M = 'armv9-m'
GENERIC = 'generic'
PPC64 = 'ppc64'
PPC64LE = 'ppc64le'
S390X = 's390x'
X86_32 = 'x86_32'
X86_64 = 'x86_64'

# --
GENERIC = 'generic'
OTHER = 'other'
UNKNOWN = 'unknown'


@serializable.serializable_enum
class CryptoCertificationLevel(str, Enum):
# TODO: rename to `CryptoAlgorithmCertificationLevel`
Comment thread
jkowalleck marked this conversation as resolved.

"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.certificationLevel ENUM type
within the CycloneDX standard.
Expand All @@ -207,7 +215,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'
Expand All @@ -234,13 +242,15 @@ class CryptoCertificationLevel(str, Enum):
CC_EAL6_PLUS = 'cc-eal6+'
CC_EAL7 = 'cc-eal7'
CC_EAL7_PLUS = 'cc-eal7+'

# --
OTHER = 'other'
UNKNOWN = 'unknown'


@serializable.serializable_enum
class CryptoMode(str, Enum):
# TODO: rename to `CryptoAlgorithmMode`
Comment thread
jkowalleck marked this conversation as resolved.

"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.mode ENUM type
within the CycloneDX standard.
Expand All @@ -259,13 +269,15 @@ class CryptoMode(str, Enum):
ECB = 'ecb'
GCM = 'gcm'
OFB = 'ofb'

# --
OTHER = 'other'
UNKNOWN = 'unknown'


@serializable.serializable_enum
class CryptoPadding(str, Enum):
# TODO: rename to `CryptoAlgorithmPadding`
Comment thread
jkowalleck marked this conversation as resolved.

"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.padding ENUM type
within the CycloneDX standard.
Expand All @@ -282,7 +294,7 @@ class CryptoPadding(str, Enum):
PKCS1V15 = 'pkcs1v15'
OAEP = 'oaep'
RAW = 'raw'

# --
OTHER = 'other'
UNKNOWN = 'unknown'

Expand Down Expand Up @@ -311,7 +323,7 @@ class CryptoFunction(str, Enum):
SIGN = 'sign'
TAG = 'tag'
VERIFY = 'verify'

# --
OTHER = 'other'
UNKNOWN = 'unknown'

Expand Down Expand Up @@ -785,7 +797,7 @@ class RelatedCryptoMaterialType(str, Enum):
SIGNATURE = 'signature'
TAG = 'tag'
TOKEN = 'token' # nosec

# --
OTHER = 'other'
UNKNOWN = 'unknown'

Expand Down
7 changes: 6 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
10 changes: 10 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.0.xml.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.0" version="1">
<components>
<component type="library">
<name>dummy</name>
<version/>
<modified>false</modified>
</component>
</components>
</bom>
9 changes: 9 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.1.xml.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.1" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<components>
<component type="library" bom-ref="dummy">
<name>dummy</name>
<version/>
</component>
</components>
</bom>
23 changes: 23 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.2.json.bin
Original file line number Diff line number Diff line change
@@ -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"
}
15 changes: 15 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.2.xml.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
</metadata>
<components>
<component type="library" bom-ref="dummy">
<name>dummy</name>
<version/>
</component>
</components>
<dependencies>
<dependency ref="dummy"/>
</dependencies>
</bom>
24 changes: 24 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.3.json.bin
Original file line number Diff line number Diff line change
@@ -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"
}
16 changes: 16 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.3.xml.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.3" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
</metadata>
<components>
<component type="library" bom-ref="dummy">
<name>dummy</name>
<version/>
<evidence/>
</component>
</components>
<dependencies>
<dependency ref="dummy"/>
</dependencies>
</bom>
23 changes: 23 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.4.json.bin
Original file line number Diff line number Diff line change
@@ -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"
}
15 changes: 15 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.4.xml.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.4" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
</metadata>
<components>
<component type="library" bom-ref="dummy">
<name>dummy</name>
<evidence/>
</component>
</components>
<dependencies>
<dependency ref="dummy"/>
</dependencies>
</bom>
89 changes: 89 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.5.json.bin
Original file line number Diff line number Diff line change
@@ -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"
}
Loading
Loading