Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 12 additions & 1 deletion 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`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ TODO


"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.primitive ENUM type within the
CycloneDX standard.
Expand All @@ -83,13 +85,16 @@ class CryptoPrimitive(str, Enum):
SIGNATURE = 'signature'
STREAM_CIPHER = 'stream-cipher'
XOF = 'xof'
# TODO: add `key-wrap` - since CDX1.7key-wrap

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ TODO


OTHER = 'other'
UNKNOWN = 'unknown'


@serializable.serializable_enum
class CryptoExecutionEnvironment(str, Enum):
# TODO: rename to `CryptoAlgorithmExecutionEnvironment`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ TODO


"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.executionEnvironment ENUM type
within the CycloneDX standard.
Expand All @@ -112,6 +117,8 @@ class CryptoExecutionEnvironment(str, Enum):

@serializable.serializable_enum
class CryptoImplementationPlatform(str, Enum):
# TODO: rename to `CryptoAlgorithmImplementationPlatform`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ TODO


"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.implementationPlatform ENUM type
within the CycloneDX standard.
Expand All @@ -129,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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ TODO

PPC64 = 'ppc64'
PPC64LE = 'ppc64le'
S390X = 's390x'
Expand All @@ -142,6 +149,8 @@ class CryptoImplementationPlatform(str, Enum):

@serializable.serializable_enum
class CryptoCertificationLevel(str, Enum):
# TODO: move to `CryptoAlgorithmCertificationLevel`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ TODO


"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.certificationLevel ENUM type
within the CycloneDX standard.
Expand Down Expand Up @@ -188,6 +197,8 @@ class CryptoCertificationLevel(str, Enum):

@serializable.serializable_enum
class CryptoMode(str, Enum):
# TODO: rename to `CryptoAlgorithmMode`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ TODO


"""
This is our internal representation of the cryptoPropertiesType.algorithmProperties.mode ENUM type
within the CycloneDX standard.
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ revert

if RECREATE_SNAPSHOTS:
print('!!! WILL RECREATE ALL SNAPSHOTS !!!')

Expand Down
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"
}
75 changes: 75 additions & 0 deletions tests/_data/snapshots/enum_AnalysisTechnique-1.5.xml.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.5" 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>
<identity>
<field>name</field>
<methods>
<method>
<technique>ast-fingerprint</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: AST_FINGERPRINT</value>
</method>
<method>
<technique>attestation</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: ATTESTATION</value>
</method>
<method>
<technique>binary-analysis</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: BINARY_ANALYSIS</value>
</method>
<method>
<technique>dynamic-analysis</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: DYNAMIC_ANALYSIS</value>
</method>
<method>
<technique>filename</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: FILENAME</value>
</method>
<method>
<technique>hash-comparison</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: HASH_COMPARISON</value>
</method>
<method>
<technique>instrumentation</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: INSTRUMENTATION</value>
</method>
<method>
<technique>manifest-analysis</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: MANIFEST_ANALYSIS</value>
</method>
<method>
<technique>other</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: OTHER</value>
</method>
<method>
<technique>source-code-analysis</technique>
<confidence>1</confidence>
<value>AnalysisTechnique: SOURCE_CODE_ANALYSIS</value>
</method>
</methods>
</identity>
</evidence>
</component>
</components>
<dependencies>
<dependency ref="dummy"/>
</dependencies>
<properties>
<property name="key1">val1</property>
<property name="key2">val2</property>
</properties>
</bom>
Loading
Loading