Merge pull request #418 from OpenKMIP/bug/derive-key-usage-masks

Add cryptographic usage mask support for DeriveKey
This commit is contained in:
Peter Hamilton 2018-04-11 22:16:14 -04:00 committed by GitHub
commit 8260da0905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -484,6 +484,13 @@ class ProxyKmipClient(object):
kwargs.get('cryptographic_algorithm')
)
)
if kwargs.get('cryptographic_usage_mask'):
attributes.append(
self.attribute_factory.create_attribute(
enums.AttributeType.CRYPTOGRAPHIC_USAGE_MASK,
kwargs.get('cryptographic_usage_mask')
)
)
template_attribute = cobjects.TemplateAttribute(
attributes=attributes
)

View File

@ -1586,7 +1586,11 @@ class TestProxyKmipClient(testtools.TestCase):
'derivation_data': b'\xFF\xFE\xFE\xFC'
},
cryptographic_length=128,
cryptographic_algorithm=enums.CryptographicAlgorithm.AES
cryptographic_algorithm=enums.CryptographicAlgorithm.AES,
cryptographic_usage_mask=[
enums.CryptographicUsageMask.ENCRYPT,
enums.CryptographicUsageMask.DECRYPT
]
)
self.assertEqual('1', derived_id)