Skip to content

Commit 324f683

Browse files
fix
1 parent d2b79c9 commit 324f683

File tree

1 file changed

+13
-11
lines changed
  • src/aws_encryption_sdk/materials_managers/mpl

1 file changed

+13
-11
lines changed

src/aws_encryption_sdk/materials_managers/mpl/cmm.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,20 @@ def get_encryption_materials(
7878
def _native_to_mpl_get_encryption_materials(
7979
request: EncryptionMaterialsRequest
8080
) -> 'MPL_GetEncryptionMaterialsInput':
81-
commitment_policy = CryptoMaterialsManagerFromMPL._native_to_mpl_commitment_policy(
82-
request.commitment_policy
83-
)
84-
output: MPL_GetEncryptionMaterialsInput = MPL_GetEncryptionMaterialsInput(
85-
encryption_context=request.encryption_context,
86-
commitment_policy=commitment_policy,
87-
algorithm_suite_id=CryptoMaterialsManagerFromMPL._native_algorithm_id_to_mpl_algorithm_id(
81+
output_kwargs = {
82+
"encryption_context": request.encryption_context,
83+
"max_plaintext_length": request.plaintext_length,
84+
"commitment_policy": CryptoMaterialsManagerFromMPL._native_to_mpl_commitment_policy(
85+
request.commitment_policy
86+
)
87+
}
88+
89+
if request.algorithm is not None:
90+
output_kwargs["algorithm_suite_id"] = CryptoMaterialsManagerFromMPL._native_algorithm_id_to_mpl_algorithm_id(
8891
request.algorithm.algorithm_id
89-
),
90-
max_plaintext_length=request.plaintext_length,
91-
)
92-
return output
92+
)
93+
94+
return MPL_GetEncryptionMaterialsInput(**output_kwargs)
9395

9496
@staticmethod
9597
def _native_to_mpl_commitment_policy(

0 commit comments

Comments
 (0)