Skip to content

Commit 72c1c31

Browse files
reset
1 parent 69abc8b commit 72c1c31

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

examples/src/keyrings/raw_rsa_keyring_example.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,14 @@
3939
from aws_cryptographic_materialproviders.mpl.config import MaterialProvidersConfig
4040
from aws_cryptographic_materialproviders.mpl.models import CreateRawRsaKeyringInput, PaddingScheme
4141
from aws_cryptographic_materialproviders.mpl.references import IKeyring
42-
from aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_materialproviders.errors import (
43-
CollectionOfErrors,
44-
)
4542
from cryptography.hazmat.backends import default_backend as crypto_default_backend
4643
from cryptography.hazmat.primitives import serialization as crypto_serialization
4744
from cryptography.hazmat.primitives.asymmetric import rsa
4845
from typing import Dict
4946

5047
import aws_encryption_sdk
5148
from aws_encryption_sdk import CommitmentPolicy
49+
from aws_encryption_sdk.exceptions import AWSEncryptionSDKClientError
5250

5351
# TODO-MPL: Remove this as part of removing PYTHONPATH hacks.
5452
MODULE_ROOT_DIR = '/'.join(__file__.split("/")[:-1])
@@ -244,6 +242,6 @@ def encrypt_and_decrypt_with_keyring(public_key_file_name=None, private_key_file
244242
keyring=raw_rsa_keyring_bob
245243
)
246244

247-
raise AssertionError("client.decrypt should throw an error of type CollectionOfErrors!")
248-
except CollectionOfErrors:
245+
raise AssertionError("client.decrypt should throw an error of type AWSEncryptionSDKClientError!")
246+
except AWSEncryptionSDKClientError:
249247
pass

src/aws_encryption_sdk/materials_managers/mpl/cmm.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
# pylint should pass even if the MPL isn't installed
88
# Also thinks these imports aren't used if it can't import them
99
# noqa pylint: disable=import-error,unused-import
10-
from aws_cryptographic_materialproviders.mpl.errors import AwsCryptographicMaterialProvidersException
10+
from aws_cryptographic_materialproviders.mpl.errors import (
11+
AwsCryptographicMaterialProvidersException,
12+
CollectionOfErrors,
13+
)
1114
from aws_cryptographic_materialproviders.mpl.models import (
1215
AlgorithmSuiteIdESDK as MPL_AlgorithmSuiteIdESDK,
1316
CommitmentPolicyESDK as MPL_CommitmentPolicyESDK,
@@ -114,7 +117,7 @@ def decrypt_materials(
114117
CryptoMaterialsManagerFromMPL._create_mpl_decrypt_materials_input_from_request(request)
115118
mpl_output: 'MPL_DecryptMaterialsOutput' = self.mpl_cmm.decrypt_materials(mpl_input)
116119
return DecryptionMaterialsFromMPL(mpl_output.decryption_materials)
117-
except AwsCryptographicMaterialProvidersException as mpl_exception:
120+
except (AwsCryptographicMaterialProvidersException, CollectionOfErrors) as mpl_exception:
118121
# Wrap MPL error into the ESDK error type
119122
# so customers only have to catch ESDK error types.
120123
raise AWSEncryptionSDKClientError(mpl_exception)

0 commit comments

Comments
 (0)