Skip to content

Commit

Permalink
Merge 4d6ba8a into 843c75d
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterHamilton committed Oct 6, 2016
2 parents 843c75d + 4d6ba8a commit c273b54
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kmip/services/server/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ def _set_attribute_on_managed_object(self, managed_object, attribute):
for e in enums.CryptographicUsageMask:
if e.value & attribute_value.value:
value.append(e)
elif attribute_name == 'Operation Policy Name':
field = 'operation_policy_name'

if field:
existing_value = getattr(managed_object, field)
Expand Down
12 changes: 12 additions & 0 deletions kmip/tests/unit/services/server/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,10 @@ def test_create(self):
enums.CryptographicUsageMask.ENCRYPT,
enums.CryptographicUsageMask.DECRYPT
]
),
attribute_factory.create_attribute(
enums.AttributeType.OPERATION_POLICY_NAME,
'test'
)
]
)
Expand Down Expand Up @@ -1552,6 +1556,7 @@ def test_create(self):
enums.CryptographicUsageMask.DECRYPT,
symmetric_key.cryptographic_usage_masks
)
self.assertEqual('test', symmetric_key.operation_policy_name)

self.assertEqual(uid, e._id_placeholder)

Expand Down Expand Up @@ -1822,6 +1827,7 @@ def test_create_key_pair(self):
enums.CryptographicUsageMask.ENCRYPT,
public_key.cryptographic_usage_masks
)
self.assertEqual('default', public_key.operation_policy_name)

# Retrieve the stored private key and verify all attributes were set
# appropriately.
Expand All @@ -1846,6 +1852,7 @@ def test_create_key_pair(self):
enums.CryptographicUsageMask.DECRYPT,
private_key.cryptographic_usage_masks
)
self.assertEqual('default', private_key.operation_policy_name)

self.assertEqual(private_id, e._id_placeholder)

Expand Down Expand Up @@ -2442,6 +2449,10 @@ def test_register(self):
enums.CryptographicUsageMask.ENCRYPT,
enums.CryptographicUsageMask.DECRYPT
]
),
attribute_factory.create_attribute(
enums.AttributeType.OPERATION_POLICY_NAME,
'test'
)
]
)
Expand Down Expand Up @@ -2507,6 +2518,7 @@ def test_register(self):
enums.CryptographicUsageMask.DECRYPT,
symmetric_key.cryptographic_usage_masks
)
self.assertEqual('test', symmetric_key.operation_policy_name)

self.assertEqual(uid, e._id_placeholder)

Expand Down

0 comments on commit c273b54

Please sign in to comment.