From a9d15eb25393374fcfb7fc5ad789f176193d6d46 Mon Sep 17 00:00:00 2001 From: Pranathi Locula Date: Thu, 22 Jul 2021 15:26:10 -0400 Subject: [PATCH] create SecretData objects with custom attributes --- kmip/pie/client.py | 6 ++++++ kmip/pie/objects.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kmip/pie/client.py b/kmip/pie/client.py index e8b7a76..c9fd721 100644 --- a/kmip/pie/client.py +++ b/kmip/pie/client.py @@ -20,6 +20,7 @@ from kmip.core import enums from kmip.core import primitives from kmip.core import objects as cobjects +from kmip.core.objects import Attribute from kmip.core.factories import attributes from kmip.core.attributes import CryptographicParameters @@ -557,6 +558,11 @@ class ProxyKmipClient(object): ) object_attributes.append(name_attribute) + if hasattr(managed_object, '_application_specific_informations'): + if managed_object._application_specific_informations: + for attr in managed_object._application_specific_informations: + object_attributes.append(attr) + template = cobjects.TemplateAttribute(attributes=object_attributes) object_type = managed_object.object_type diff --git a/kmip/pie/objects.py b/kmip/pie/objects.py index 7f20b2c..e0ab00d 100644 --- a/kmip/pie/objects.py +++ b/kmip/pie/objects.py @@ -1580,7 +1580,7 @@ class SecretData(CryptographicObject): 'sqlite_autoincrement': True } - def __init__(self, value, data_type, masks=None, name='Secret Data'): + def __init__(self, value, data_type, app_specific_info=None, masks=None, name='Secret Data'): """ Create a SecretData object. @@ -1599,6 +1599,9 @@ class SecretData(CryptographicObject): self.value = value self.data_type = data_type self.names = [name] + + if app_specific_info: + self._application_specific_informations = app_specific_info if masks: self.cryptographic_usage_masks = masks