Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use set_attribute with custom_attribute #663

Open
loknath01 opened this issue Mar 8, 2022 · 1 comment
Open

How to use set_attribute with custom_attribute #663

loknath01 opened this issue Mar 8, 2022 · 1 comment

Comments

@loknath01
Copy link

loknath01 commented Mar 8, 2022

I am unable to set the custom attributes using set_attribute, could someone help me on this?

python version: 3.8.10
pykmip version: 0.10.0

requirenment:
Need to pass different data types into x-value field
example: attr_name= "dummy name" attr_value="dummy text" --> data type of attr_value can be datetime or string or int

masks=enums.CryptographicUsageMask.DERIVE_KEY])
id = client.register(secret_data)

attribute_v = '{"kmip-x-AttributeName": "TextString:HELLO"}'
client.set_attribute(unique_identifier=id, attribute_name="Custom Attribute", attribute_value=attribute_v)`

image

@arp102
Copy link
Contributor

arp102 commented Mar 16, 2022

The main issue here is that there's no KMIP version that supports both the "Set Attribute" operation and the "Custom Attribute" attribute.
The KMIP 2.0 spec added "Set Attribute" and replaced "Custom Attribute" with "Attribute" (sometimes referred to as "Vendor Attribute").

Unfortunately, PyKMIP does not fully support all of the attributes added in the 2.0 spec, so if you changed "Custom Attribute" to "Attribute" then you would still get an exception in the client.
It should be pretty easy to add support for "Attribute" though if anyone wants to make that pull request.

You could also try to find a workaround using a different KMIP version, a different operation like modify_attribute, or a different attribute type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants