create SecretData objects with custom attributes

This commit is contained in:
Pranathi Locula 2021-07-22 15:26:10 -04:00 committed by Peter Hamilton
parent 9403ff3d2a
commit a9d15eb253
2 changed files with 10 additions and 1 deletions

View File

@ -20,6 +20,7 @@ from kmip.core import enums
from kmip.core import primitives from kmip.core import primitives
from kmip.core import objects as cobjects from kmip.core import objects as cobjects
from kmip.core.objects import Attribute
from kmip.core.factories import attributes from kmip.core.factories import attributes
from kmip.core.attributes import CryptographicParameters from kmip.core.attributes import CryptographicParameters
@ -557,6 +558,11 @@ class ProxyKmipClient(object):
) )
object_attributes.append(name_attribute) 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) template = cobjects.TemplateAttribute(attributes=object_attributes)
object_type = managed_object.object_type object_type = managed_object.object_type

View File

@ -1580,7 +1580,7 @@ class SecretData(CryptographicObject):
'sqlite_autoincrement': True '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. Create a SecretData object.
@ -1600,6 +1600,9 @@ class SecretData(CryptographicObject):
self.data_type = data_type self.data_type = data_type
self.names = [name] self.names = [name]
if app_specific_info:
self._application_specific_informations = app_specific_info
if masks: if masks:
self.cryptographic_usage_masks = masks self.cryptographic_usage_masks = masks