57
57
_HashTypeRepositorySerializationHelper ,
58
58
)
59
59
from .bom_ref import BomRef
60
+ from .crypto import CryptoProperties
60
61
from .dependency import Dependable
61
62
from .issue import IssueType
62
63
from .license import License , LicenseRepository
@@ -1044,8 +1045,8 @@ def __init__(self, *,
1044
1045
components : Optional [Iterable ['Component' ]] = None , evidence : Optional [ComponentEvidence ] = None ,
1045
1046
modified : bool = False , manufacturer : Optional [OrganizationalEntity ] = None ,
1046
1047
authors : Optional [Iterable [OrganizationalContact ]] = None ,
1047
- omnibor_ids : Optional [Iterable [OmniborId ]] = None ,
1048
- swhids : Optional [Iterable [Swhid ]] = None ,
1048
+ omnibor_ids : Optional [Iterable [OmniborId ]] = None , swhids : Optional [ Iterable [ Swhid ]] = None ,
1049
+ crypto_properties : Optional [CryptoProperties ] = None , tags : Optional [ Iterable [str ]] = None ,
1049
1050
# Deprecated in v1.6
1050
1051
author : Optional [str ] = None ,
1051
1052
) -> None :
@@ -1058,6 +1059,7 @@ def __init__(self, *,
1058
1059
self .supplier = supplier
1059
1060
self .manufacturer = manufacturer
1060
1061
self .authors = authors or [] # type:ignore[assignment]
1062
+ self .author = author
1061
1063
self .publisher = publisher
1062
1064
self .group = group
1063
1065
self .name = name
@@ -1079,13 +1081,15 @@ def __init__(self, *,
1079
1081
self .components = components or [] # type:ignore[assignment]
1080
1082
self .evidence = evidence
1081
1083
self .release_notes = release_notes
1084
+ self .crypto_properties = crypto_properties
1085
+ self .tags = tags or [] # type:ignore[assignment]
1082
1086
1083
- self .author = author
1087
+ if modified :
1088
+ warn ('`.component.modified` is deprecated from CycloneDX v1.3 onwards. '
1089
+ 'Please use `@.pedigree` instead.' , DeprecationWarning )
1084
1090
if author :
1085
- warn (
1086
- '`.component.author` is deprecated from CycloneDX v1.6 onwards. '
1087
- 'Please use `@.authors` or `@.manufacturer` instead.' ,
1088
- DeprecationWarning )
1091
+ warn ('`.component.author` is deprecated from CycloneDX v1.6 onwards. '
1092
+ 'Please use `@.authors` or `@.manufacturer` instead.' , DeprecationWarning )
1089
1093
1090
1094
@property
1091
1095
@serializable .type_mapping (_ComponentTypeSerializationHelper )
@@ -1632,6 +1636,44 @@ def release_notes(self, release_notes: Optional[ReleaseNotes]) -> None:
1632
1636
# def data(self, ...) -> None:
1633
1637
# ... # TODO since CDX1.5
1634
1638
1639
+ @property
1640
+ @serializable .view (SchemaVersion1Dot6 )
1641
+ @serializable .xml_sequence (30 )
1642
+ def crypto_properties (self ) -> Optional [CryptoProperties ]:
1643
+ """
1644
+ Cryptographic assets have properties that uniquely define them and that make them actionable for further
1645
+ reasoning. As an example, it makes a difference if one knows the algorithm family (e.g. AES) or the specific
1646
+ variant or instantiation (e.g. AES-128-GCM). This is because the security level and the algorithm primitive
1647
+ (authenticated encryption) is only defined by the definition of the algorithm variant. The presence of a weak
1648
+ cryptographic algorithm like SHA1 vs. HMAC-SHA1 also makes a difference.
1649
+
1650
+ Returns:
1651
+ `CryptoProperties` or `None`
1652
+ """
1653
+ return self ._crypto_properties
1654
+
1655
+ @crypto_properties .setter
1656
+ def crypto_properties (self , crypto_properties : Optional [CryptoProperties ]) -> None :
1657
+ self ._crypto_properties = crypto_properties
1658
+
1659
+ @property
1660
+ @serializable .view (SchemaVersion1Dot6 )
1661
+ @serializable .xml_array (serializable .XmlArraySerializationType .NESTED , 'tag' )
1662
+ @serializable .xml_sequence (31 )
1663
+ def tags (self ) -> 'SortedSet[str]' :
1664
+ """
1665
+ Textual strings that aid in discovery, search, and retrieval of the associated object.
1666
+ Tags often serve as a way to group or categorize similar or related objects by various attributes.
1667
+
1668
+ Returns:
1669
+ `Iterable[str]`
1670
+ """
1671
+ return self ._tags
1672
+
1673
+ @tags .setter
1674
+ def tags (self , tags : Iterable [str ]) -> None :
1675
+ self ._tags = SortedSet (tags )
1676
+
1635
1677
def get_all_nested_components (self , include_self : bool = False ) -> Set ['Component' ]:
1636
1678
components = set ()
1637
1679
if include_self :
0 commit comments