OpenKMIP / PyKMIP

A Python implementation of the KMIP specification.
Apache License 2.0
262 stars 132 forks source link

BUG - object recall broken - get() #639

Open KBassford opened 4 years ago

KBassford commented 4 years ago

Hi Peter,

I register this ...

SymmetricKey(algorithm=CryptographicAlgorithm.AES, length=256, value=b'7f91c44fe841034dd7d98b972c7f537554efb54f84a94c589199481f42be7be7', masks=[<CryptographicUsageMask.ENCRYPT: 4>, <CryptographicUsageMask.DECRYPT: 8>], names=['upper-once-pause'], key_wrapping_data={})

but when I call "get" on the same object, I receive this ...

SymmetricKey(algorithm=CryptographicAlgorithm.AES, length=256, value=b'7f91c44fe841034dd7d98b972c7f537554efb54f84a94c589199481f42be7be7', masks=[], names=['Symmetric Key'], key_wrapping_data={})

Where are my "masks" and "names"? I know the only thing that counts at the end of the day is the "value" field, but it would be nice to get back what I put in.

It is saved, as I can see if I query the attributes ...

Attribute List
 "['Cryptographic Algorithm', 'Cryptographic Length', 'Cryptographic Usage Mask', 'Initial Date', 'Name', 'Object Type', 'Sensitive', 'State', 'Unique Identifier']"
Attributes
 "('1', [Attribute(attribute_name=AttributeName(value='Unique Identifier'), attribute_index=None, attribute_value=UniqueIdentifier(value='1')), Attribute(attribute_name=AttributeName(value='Name'), attribute_index=None, attribute_value=Name(type=NameType(value=<NameType.UNINTERPRETED_TEXT_STRING: 1>),value=NameValue(value='upper-once-pause'))), Attribute(attribute_name=AttributeName(value='Object Type'), attribute_index=None, attribute_value=Enumeration(enum=ObjectType, value=ObjectType.SYMMETRIC_KEY, tag=Tags.ATTRIBUTE_VALUE)), Attribute(attribute_name=AttributeName(value='Cryptographic Algorithm'), attribute_index=None, attribute_value=Enumeration(enum=CryptographicAlgorithm, value=CryptographicAlgorithm.AES, tag=Tags.ATTRIBUTE_VALUE)), Attribute(attribute_name=AttributeName(value='Cryptographic Length'), attribute_index=None, attribute_value=CryptographicLength(value=256)), Attribute(attribute_name=AttributeName(value='Cryptographic Usage Mask'), attribute_index=None, attribute_value=CryptographicUsageMask(value=12)), Attribute(attribute_name=AttributeName(value='State'), attribute_index=None, attribute_value=Enumeration(enum=State, value=State.ACTIVE, tag=Tags.ATTRIBUTE_VALUE)), Attribute(attribute_name=AttributeName(value='Initial Date'), attribute_index=None, attribute_value=DateTime(value=1603196795, tag=Tags.ATTRIBUTE_VALUE)), Attribute(attribute_name=AttributeName(value='Sensitive'), attribute_index=None, attribute_value=Boolean(value=False))])"

I'll see if I can fix this in the time I have left. (NOTE: This appears to be related to bug 637 which fixed to object structure.)

KBassford commented 4 years ago

Did not get fully through before running out of time. I found a lot needs to be done in both object files and the factory files in order to retrieve both masks and names form the database. It may even require some changes to the primitives file as well.