@@ -494,16 +494,20 @@ def nist_quantum_security_level(self, nist_quantum_security_level: Optional[int]
494494 )
495495 self ._nist_quantum_security_level = nist_quantum_security_level
496496
497+ def __comparable_tuple (self ) -> _ComparableTuple :
498+ return _ComparableTuple ((
499+ self .primitive , self ._parameter_set_identifier , self .curve , self .execution_environment ,
500+ self .implementation_platform , _ComparableTuple (self .certification_levels ), self .mode , self .padding ,
501+ _ComparableTuple (self .crypto_functions ), self .classical_security_level , self .nist_quantum_security_level ,
502+ ))
503+
497504 def __eq__ (self , other : object ) -> bool :
498505 if isinstance (other , AlgorithmProperties ):
499- return hash ( other ) == hash ( self )
506+ return self . __comparable_tuple ( ) == other . __comparable_tuple ( )
500507 return False
501508
502509 def __hash__ (self ) -> int :
503- # TODO
504- return hash ((self .primitive , self ._parameter_set_identifier , self .curve , self .execution_environment ,
505- self .implementation_platform , tuple (self .certification_levels ), self .mode , self .padding ,
506- tuple (self .crypto_functions ), self .classical_security_level , self .nist_quantum_security_level ,))
510+ return hash (self .__comparable_tuple ())
507511
508512 def __repr__ (self ) -> str :
509513 return f'<AlgorithmProperties primitive={ self .primitive } , execution_environment={ self .execution_environment } >'
@@ -1336,11 +1340,13 @@ def __init__(
13361340 version : Optional [str ] = None ,
13371341 cipher_suites : Optional [Iterable [ProtocolPropertiesCipherSuite ]] = None ,
13381342 ikev2_transform_types : Optional [Ikev2TransformTypes ] = None ,
1343+ crypto_refs : Optional [Iterable [BomRef ]] = None ,
13391344 ) -> None :
13401345 self .type = type
13411346 self .version = version
13421347 self .cipher_suites = cipher_suites or [] # type:ignore[assignment]
13431348 self .ikev2_transform_types = ikev2_transform_types
1349+ self .crypto_refs = crypto_refs or [] # type:ignore[assignment]
13441350
13451351 @property
13461352 @serializable .xml_sequence (10 )
@@ -1403,9 +1409,29 @@ def ikev2_transform_types(self) -> Optional[Ikev2TransformTypes]:
14031409 def ikev2_transform_types (self , ikev2_transform_types : Optional [Ikev2TransformTypes ]) -> None :
14041410 self ._ikev2_transform_types = ikev2_transform_types
14051411
1412+ @property
1413+ @serializable .xml_array (serializable .XmlArraySerializationType .FLAT , 'cryptoRef' )
1414+ @serializable .json_name ('cryptoRefArray' )
1415+ def crypto_refs (self ) -> 'SortedSet[BomRef]' :
1416+ """
1417+ A list of protocol-related cryptographic assets.
1418+
1419+ Returns:
1420+ `Iterable[BomRef]`
1421+ """
1422+ return self ._crypto_refs
1423+
1424+ @crypto_refs .setter
1425+ def crypto_refs (self , crypto_refs : Iterable [BomRef ]) -> None :
1426+ self ._crypto_refs = SortedSet (crypto_refs )
1427+
14061428 def __comparable_tuple (self ) -> _ComparableTuple :
14071429 return _ComparableTuple ((
1408- self .type , self .version , _ComparableTuple (self .cipher_suites ), self .ikev2_transform_types
1430+ self .type ,
1431+ self .version ,
1432+ _ComparableTuple (self .cipher_suites ),
1433+ self .ikev2_transform_types ,
1434+ _ComparableTuple (self .crypto_refs )
14091435 ))
14101436
14111437 def __eq__ (self , other : object ) -> bool :
0 commit comments