in src/aws_encryption_sdk/key_providers/kms.py [0:0]
def _key_resource_match(key1, key2):
"""Given two KMS key identifiers, determines whether they use the same key type resource ID.
This method works with either bare key IDs or key ARNs; if an input cannot be parsed as an ARN
it is assumed to be a bare key ID. Will output false if either input is an alias arn.
"""
try:
arn1 = arn_from_str(key1)
if arn1.resource_type == "alias":
return False
resource_id_1 = arn1.resource_id
except MalformedArnError:
# We need to handle the case where the key id is not ARNs,
# treat it as a bare id
resource_id_1 = key1
try:
arn2 = arn_from_str(key2)
if arn2.resource_type == "alias":
return False
resource_id_2 = arn2.resource_id
except MalformedArnError:
# We need to handle the case where the key id is not ARNs,
# treat it as a bare id
resource_id_2 = key2
return resource_id_1 == resource_id_2