2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-27 21:53:39 +00:00

Add CertificateType filtering support for Locate

This change updates Locate operation support in the PyKMIP server,
allowing users to filter objects based on the object's
Certificate Type. 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 Certificate Type filtering. Simply use the
"--certificate-type" flag to specify a Certificate Type
enumeration values for the Locate script to filter on.
This commit is contained in:
Peter Hamilton
2019-08-16 16:53:15 -04:00
committed by Peter Hamilton
parent b5a8739157
commit 44d55f2550
9 changed files with 376 additions and 5 deletions

View File

@@ -41,6 +41,7 @@ if __name__ == '__main__':
initial_dates = opts.initial_dates
state = opts.state
object_type = opts.object_type
certificate_type = opts.certificate_type
cryptographic_algorithm = opts.cryptographic_algorithm
cryptographic_length = opts.cryptographic_length
cryptographic_usage_masks = opts.cryptographic_usage_masks
@@ -198,6 +199,27 @@ if __name__ == '__main__':
masks
)
)
if certificate_type:
certificate_type = getattr(
enums.CertificateType,
certificate_type,
None
)
if certificate_type:
attributes.append(
attribute_factory.create_attribute(
enums.AttributeType.CERTIFICATE_TYPE,
certificate_type
)
)
else:
logger.error(
"Invalid certificate type provided: {}".format(
opts.certificate_type
)
)
client.close()
sys.exit(-8)
if unique_identifier:
attributes.append(
attribute_factory.create_attribute(