mirror of
https://github.com/openkmip/pykmip
synced 2025-12-23 11:43:17 +00:00
Enforce server support for DeriveKey truncation
This change updates DeriveKey support in the software server to enforce key truncation. If the derived key is longer than the requested cryptographic length, the derived key is truncated to fit the requested length. A unit test has been added to cover this update.
This commit is contained in:
@@ -1473,6 +1473,8 @@ class KmipEngine(object):
|
||||
"The specified length exceeds the output of the derivation "
|
||||
"method."
|
||||
)
|
||||
if len(derived_data) > derivation_length:
|
||||
derived_data = derived_data[:derivation_length]
|
||||
|
||||
if payload.object_type == enums.ObjectType.SYMMETRIC_KEY:
|
||||
managed_object = objects.SymmetricKey(
|
||||
|
||||
Reference in New Issue
Block a user