2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-16 00:04:26 +00:00

Add CryptographicUsageMask filtering support for Locate

This change updates Locate operation support in the PyKMIP server,
allowing users to filter objects based on the object's
Cryptographic Usage Masks. Unit tests and integration tests have
been added to test and verify the correctness of this feature.

Additionally, the Locate demo scripts have also been updated to
support Cryptographic Usage Mask filtering. Simply use the
"--cryptographic-usage-mask" flag to specify one or more
Cryptographic Usage Mask enumeration values for the Locate script
to filter on.
This commit is contained in:
Peter Hamilton
2019-08-12 15:22:04 -04:00
committed by Peter Hamilton
parent 4a6a2eccc1
commit b5a8739157
7 changed files with 302 additions and 0 deletions

View File

@@ -1743,6 +1743,25 @@ class KmipEngine(object):
)
add_object = False
break
elif name == "Cryptographic Usage Mask":
value = value.value
mask_values = enums.get_enumerations_from_bit_mask(
enums.CryptographicUsageMask,
value
)
for mask_value in mask_values:
if mask_value not in attribute:
self._logger.debug(
"Failed match: "
"the specified cryptographic usage mask "
"({}) is not set on the object.".format(
mask_value.name
)
)
add_object = False
break
if not add_object:
break
elif name == enums.AttributeType.INITIAL_DATE.value:
initial_date["value"] = attribute
self._track_date_attributes(