-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add cyclonedx.model.crypto.ProtocolProperties.crypto_ref_array
#692
Comments
Not a bug, but a lack of a feature. CycloneDX python library is a community effort, everybody is free to add the bits and pieces they need. see #633 In this case, it is the property cyclonedx-python-lib/cyclonedx/model/crypto.py Line 1292 in 2aea159
If you are interested in providing the missing feature, please let me know. |
cyclonedx.model.crypto.ProtocolProperties.crypto_ref_array
see also: #537 |
Hi If no one has picked i'll be interested to contribute to this to help, i went through this thread and tried to apply what you suggested and that seems to work and get rid of the error that is raised for above mentioned MRC. please let me know if this is correct specifically the docstring and xml_sequence, will raise a PR along with tests based on feedback if this is the correct direction to go. diff --git a/cyclonedx/model/crypto.py b/cyclonedx/model/crypto.py
index d9fd810..9eebf8e 100644
--- a/cyclonedx/model/crypto.py
+++ b/cyclonedx/model/crypto.py
@@ -1309,11 +1309,13 @@ class ProtocolProperties:
version: Optional[str] = None,
cipher_suites: Optional[Iterable[ProtocolPropertiesCipherSuite]] = None,
ikev2_transform_types: Optional[Ikev2TransformTypes] = None,
+ crypto_ref_array: Optional[BomRef] = None,
) -> None:
self.type = type
self.version = version
self.cipher_suites = cipher_suites or [] # type:ignore[assignment]
self.ikev2_transform_types = ikev2_transform_types
+ self.crypto_ref_array = crypto_ref_array
@property
@serializable.xml_sequence(10)
@@ -1376,13 +1378,29 @@ class ProtocolProperties:
def ikev2_transform_types(self, ikev2_transform_types: Optional[Ikev2TransformTypes]) -> None:
self._ikev2_transform_types = ikev2_transform_types
+
+ @property
+ @serializable.xml_sequence(40)
+ def crypto_ref_array(self) -> Optional[BomRef]:
+ """
+ A list of protocol-related cryptographic assets.
+
+ Returns:
+ `BomRef` or `None`
+ """
+ return self._crypto_ref_array
+
+ @crypto_ref_array.setter
+ def crypto_ref_array(self, crypto_ref_array: Optional[BomRef]) -> None:
+ self._crypto_ref_array = crypto_ref_array
+
def __eq__(self, other: object) -> bool:
if isinstance(other, ProtocolProperties):
return hash(other) == hash(self)
return False
def __hash__(self) -> int:
- return hash((self.type, self.version, tuple(self.cipher_suites), self.ikev2_transform_types))
+ return hash((self.type, self.version, tuple(self.cipher_suites), self.ikev2_transform_types), self.crypto_ref_array)
def __repr__(self) -> str:
return f'<ProtocolProperties type={self.type}, version={self.version}>' |
lets discuss this in the PR, where code can be annotated and changes can be suggested/plucked easily.
👍 please do |
applied the fix recommended in the thread. added testcase and BOM json from the mentioned issue.
applied the fix recommended in the thread. added testcase and BOM json from the mentioned issue. Signed-off-by: Indivar Mishra <[email protected]>
feature was released via https://github.com/CycloneDX/cyclonedx-python-lib/releases/tag/v8.8.0 |
Library Version:
7.6.1
Description:
Steps to Reproduce:
Observed Behavior:
The code fails with the following exception:
Environment:
3.10
macOS
7.6.1
Let me know if this works!
The text was updated successfully, but these errors were encountered: