Skip to content

Commit 00fcfe7

Browse files
authored
feat: change from KmsKeyring to AwsKmsKeyring (#253)
* feat: rename KmsKeyring to AwsKmsKeyring * docs: update example descriptions and comments to reference AWS KMS rather than KMS * docs: s/a RSA/an RSA/g
1 parent 00c7e1d commit 00fcfe7

32 files changed

+172
-172
lines changed

examples/src/crypto_materials_manager/caching/simple_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"""
2525
import aws_encryption_sdk
2626
from aws_encryption_sdk.caches.local import LocalCryptoMaterialsCache
27-
from aws_encryption_sdk.keyrings.aws_kms import KmsKeyring
27+
from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
2828
from aws_encryption_sdk.materials_managers.caching import CachingCryptoMaterialsManager
2929

3030

@@ -46,7 +46,7 @@ def run(aws_kms_cmk, source_plaintext):
4646
}
4747

4848
# Create the keyring that determines how your data keys are protected.
49-
keyring = KmsKeyring(generator_key_id=aws_kms_cmk)
49+
keyring = AwsKmsKeyring(generator_key_id=aws_kms_cmk)
5050

5151
# Create the caching cryptographic materials manager using your keyring.
5252
cmm = CachingCryptoMaterialsManager(

examples/src/crypto_materials_manager/custom/algorithm_suite_enforcement.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"""
2525
import aws_encryption_sdk
2626
from aws_encryption_sdk.identifiers import AlgorithmSuite
27-
from aws_encryption_sdk.keyrings.aws_kms import KmsKeyring
27+
from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
2828
from aws_encryption_sdk.keyrings.base import Keyring
2929
from aws_encryption_sdk.materials_managers import (
3030
DecryptionMaterials,
@@ -92,7 +92,7 @@ def run(aws_kms_cmk, source_plaintext):
9292
}
9393

9494
# Create the keyring that determines how your data keys are protected.
95-
keyring = KmsKeyring(generator_key_id=aws_kms_cmk)
95+
keyring = AwsKmsKeyring(generator_key_id=aws_kms_cmk)
9696

9797
# Create the algorithm suite restricting cryptographic materials manager using your keyring.
9898
cmm = RequireApprovedAlgorithmSuitesCryptoMaterialsManager(keyring=keyring)

examples/src/crypto_materials_manager/custom/requiring_encryption_context_fields.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
1212
If you are using the AWS Encryption SDK with AWS KMS,
1313
you can use AWS KMS to provide additional powerful controls using the encryption context.
14-
For more information on that, see the KMS developer guide:
14+
For more information on that, see the AWS KMS developer guide:
1515
1616
https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
1717
1818
This example shows how to create a custom cryptographic materials manager (CMM)
1919
that requires a particular field in the encryption context.
2020
"""
2121
import aws_encryption_sdk
22-
from aws_encryption_sdk.keyrings.aws_kms import KmsKeyring
22+
from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
2323
from aws_encryption_sdk.keyrings.base import Keyring
2424
from aws_encryption_sdk.materials_managers import (
2525
DecryptionMaterials,
@@ -87,7 +87,7 @@ def run(aws_kms_cmk, source_plaintext):
8787
}
8888

8989
# Create the keyring that determines how your data keys are protected.
90-
keyring = KmsKeyring(generator_key_id=aws_kms_cmk)
90+
keyring = AwsKmsKeyring(generator_key_id=aws_kms_cmk)
9191

9292
# Create the classification requiring cryptographic materials manager using your keyring.
9393
cmm = ClassificationRequiringCryptoMaterialsManager(keyring=keyring)

examples/src/file_streaming_defaults.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import filecmp
1515

1616
import aws_encryption_sdk
17-
from aws_encryption_sdk.keyrings.aws_kms import KmsKeyring
17+
from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
1818

1919

2020
def run(aws_kms_cmk, source_plaintext_filename):
@@ -40,7 +40,7 @@ def run(aws_kms_cmk, source_plaintext_filename):
4040
}
4141

4242
# Create the keyring that determines how your data keys are protected.
43-
keyring = KmsKeyring(generator_key_id=aws_kms_cmk)
43+
keyring = AwsKmsKeyring(generator_key_id=aws_kms_cmk)
4444

4545
# Open the files you want to work with.
4646
with open(source_plaintext_filename, "rb") as plaintext, open(ciphertext_filename, "wb") as ciphertext:

examples/src/in_memory_streaming_defaults.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import io
1515

1616
import aws_encryption_sdk
17-
from aws_encryption_sdk.keyrings.aws_kms import KmsKeyring
17+
from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
1818

1919

2020
def run(aws_kms_cmk, source_plaintext):
@@ -35,7 +35,7 @@ def run(aws_kms_cmk, source_plaintext):
3535
}
3636

3737
# Create the keyring that determines how your data keys are protected.
38-
keyring = KmsKeyring(generator_key_id=aws_kms_cmk)
38+
keyring = AwsKmsKeyring(generator_key_id=aws_kms_cmk)
3939

4040
ciphertext = io.BytesIO()
4141

examples/src/keyring/aws_kms/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"""
44
AWS KMS keyring examples.
55
6-
These examples show how to use the KMS keyring.
6+
These examples show how to use the AWS KMS keyring.
77
"""

examples/src/keyring/aws_kms/custom_client_supplier.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
"""
4-
By default, the KMS keyring uses a client supplier that
4+
By default, the AWS KMS keyring uses a client supplier that
55
supplies a client with the same configuration for every region.
66
If you need different behavior, you can write your own client supplier.
77
@@ -12,18 +12,18 @@
1212
like ``ap-east-1`` and ``me-south-1``.
1313
1414
This example shows how to create a client supplier
15-
that will supply KMS clients with valid credentials for the target region
15+
that will supply AWS KMS clients with valid credentials for the target region
1616
even when working with regions that need different credentials.
1717
1818
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/choose-keyring.html#use-kms-keyring
1919
20-
For an example of how to use the KMS keyring with CMKs in multiple regions,
20+
For an example of how to use the AWS KMS keyring with CMKs in multiple regions,
2121
see the ``keyring/aws_kms/multiple_regions`` example.
2222
23-
For another example of how to use the KMS keyring with a custom client configuration,
23+
For another example of how to use the AWS KMS keyring with a custom client configuration,
2424
see the ``keyring/aws_kms/custom_kms_client_config`` example.
2525
26-
For examples of how to use the KMS keyring in discovery mode on decrypt,
26+
For examples of how to use the AWS KMS keyring in discovery mode on decrypt,
2727
see the ``keyring/aws_kms/discovery_decrypt``,
2828
``keyring/aws_kms/discovery_decrypt_in_region_only``,
2929
and ``keyring/aws_kms/discovery_decrypt_with_preferred_region`` examples.
@@ -32,7 +32,7 @@
3232
from botocore.session import Session
3333

3434
import aws_encryption_sdk
35-
from aws_encryption_sdk.keyrings.aws_kms import KmsKeyring
35+
from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
3636
from aws_encryption_sdk.keyrings.aws_kms.client_suppliers import ClientSupplier, DefaultClientSupplier
3737

3838
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
@@ -72,7 +72,7 @@ def __call__(self, region_name):
7272

7373
def run(aws_kms_cmk, source_plaintext):
7474
# type: (str, bytes) -> None
75-
"""Demonstrate an encrypt/decrypt cycle using a KMS keyring with a custom client supplier.
75+
"""Demonstrate an encrypt/decrypt cycle using an AWS KMS keyring with a custom client supplier.
7676
7777
:param str aws_kms_cmk: The ARN of an AWS KMS CMK that protects data keys
7878
:param bytes source_plaintext: Plaintext to encrypt
@@ -88,7 +88,7 @@ def run(aws_kms_cmk, source_plaintext):
8888
}
8989

9090
# Create the keyring that determines how your data keys are protected.
91-
keyring = KmsKeyring(generator_key_id=aws_kms_cmk, client_supplier=MultiPartitionClientSupplier())
91+
keyring = AwsKmsKeyring(generator_key_id=aws_kms_cmk, client_supplier=MultiPartitionClientSupplier())
9292

9393
# Encrypt your plaintext data.
9494
ciphertext, _encrypt_header = aws_encryption_sdk.encrypt(

examples/src/keyring/aws_kms/custom_kms_client_config.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
"""
4-
By default, the KMS keyring uses the default configurations
5-
for all KMS clients and uses the default discoverable credentials.
4+
By default, the AWS KMS keyring uses the default configurations
5+
for all AWS KMS clients and uses the default discoverable credentials.
66
If you need to change this configuration,
77
you can configure the client supplier.
88
9-
This example shows how to use custom-configured clients with the KMS keyring.
9+
This example shows how to use custom-configured clients with the AWS KMS keyring.
1010
1111
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/choose-keyring.html#use-kms-keyring
1212
13-
For an example of how to use the KMS keyring with CMKs in multiple regions,
13+
For an example of how to use the AWS KMS keyring with CMKs in multiple regions,
1414
see the ``keyring/aws_kms/multiple_regions`` example.
1515
16-
For another example of how to use the KMS keyring with custom client configuration,
16+
For another example of how to use the AWS KMS keyring with custom client configuration,
1717
see the ``keyring/aws_kms/custom_client_supplier`` example.
1818
19-
For examples of how to use the KMS keyring in discovery mode on decrypt,
19+
For examples of how to use the AWS KMS keyring in discovery mode on decrypt,
2020
see the ``keyring/aws_kms/discovery_decrypt``,
2121
``keyring/aws_kms/discovery_decrypt_in_region_only``,
2222
and ``keyring/aws_kms/discovery_decrypt_with_preferred_region`` examples.
@@ -26,13 +26,13 @@
2626

2727
import aws_encryption_sdk
2828
from aws_encryption_sdk.identifiers import USER_AGENT_SUFFIX
29-
from aws_encryption_sdk.keyrings.aws_kms import KmsKeyring
29+
from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
3030
from aws_encryption_sdk.keyrings.aws_kms.client_suppliers import DefaultClientSupplier
3131

3232

3333
def run(aws_kms_cmk, source_plaintext):
3434
# type: (str, bytes) -> None
35-
"""Demonstrate an encrypt/decrypt cycle using a KMS keyring with custom KMS client configuration.
35+
"""Demonstrate an encrypt/decrypt cycle using an AWS KMS keyring with custom AWS KMS client configuration.
3636
3737
:param str aws_kms_cmk: The ARN of an AWS KMS CMK that protects data keys
3838
:param bytes source_plaintext: Plaintext to encrypt
@@ -61,7 +61,7 @@ def run(aws_kms_cmk, source_plaintext):
6161

6262
# Create the keyring that determines how your data keys are protected,
6363
# providing the client supplier that you created.
64-
keyring = KmsKeyring(generator_key_id=aws_kms_cmk, client_supplier=client_supplier)
64+
keyring = AwsKmsKeyring(generator_key_id=aws_kms_cmk, client_supplier=client_supplier)
6565

6666
# Encrypt your plaintext data.
6767
ciphertext, _encrypt_header = aws_encryption_sdk.encrypt(

examples/src/keyring/aws_kms/discovery_decrypt.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
"""
4-
When you give the KMS keyring specific key IDs it will use those CMKs and nothing else.
4+
When you give the AWS KMS keyring specific key IDs it will use those CMKs and nothing else.
55
This is true both on encrypt and on decrypt.
66
However, sometimes you need more flexibility on decrypt,
77
especially when you don't know which CMKs were used to encrypt a message.
8-
To address this need, you can use a KMS discovery keyring.
9-
The KMS discovery keyring does nothing on encrypt,
10-
but attempts to decrypt *any* data keys that were encrypted under a KMS CMK.
8+
To address this need, you can use an AWS KMS discovery keyring.
9+
The AWS KMS discovery keyring does nothing on encrypt,
10+
but attempts to decrypt *any* data keys that were encrypted under an AWS KMS CMK.
1111
12-
This example shows how to configure and use a KMS discovery keyring.
12+
This example shows how to configure and use an AWS KMS discovery keyring.
1313
1414
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/choose-keyring.html#use-kms-keyring
1515
16-
For an example of how to use the KMS keyring with CMKs in multiple regions,
16+
For an example of how to use the AWS KMS keyring with CMKs in multiple regions,
1717
see the ``keyring/aws_kms/multiple_regions`` example.
1818
19-
For examples of how to use the KMS keyring with custom client configurations,
19+
For examples of how to use the AWS KMS keyring with custom client configurations,
2020
see the ``keyring/aws_kms/custom_client_supplier``
2121
and ``keyring/aws_kms/custom_kms_client_config`` examples.
2222
23-
For examples of how to use the KMS discovery keyring on decrypt,
23+
For examples of how to use the AWS KMS discovery keyring on decrypt,
2424
see the ``keyring/aws_kms/discovery_decrypt_in_region_only``
2525
and ``keyring/aws_kms/discovery_decrypt_with_preferred_region`` examples.
2626
"""
2727
import aws_encryption_sdk
28-
from aws_encryption_sdk.keyrings.aws_kms import KmsKeyring
28+
from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
2929

3030

3131
def run(aws_kms_cmk, source_plaintext):
3232
# type: (str, bytes) -> None
33-
"""Demonstrate configuring a KMS discovery keyring for decryption.
33+
"""Demonstrate configuring an AWS KMS discovery keyring for decryption.
3434
3535
:param str aws_kms_cmk: The ARN of an AWS KMS CMK that protects data keys
3636
:param bytes source_plaintext: Plaintext to encrypt
@@ -46,10 +46,10 @@ def run(aws_kms_cmk, source_plaintext):
4646
}
4747

4848
# Create the keyring that determines how your data keys are protected.
49-
encrypt_keyring = KmsKeyring(generator_key_id=aws_kms_cmk)
49+
encrypt_keyring = AwsKmsKeyring(generator_key_id=aws_kms_cmk)
5050

51-
# Create a KMS discovery keyring to use on decrypt.
52-
decrypt_keyring = KmsKeyring(is_discovery=True)
51+
# Create an AWS KMS discovery keyring to use on decrypt.
52+
decrypt_keyring = AwsKmsKeyring(is_discovery=True)
5353

5454
# Encrypt your plaintext data.
5555
ciphertext, _encrypt_header = aws_encryption_sdk.encrypt(
@@ -59,7 +59,7 @@ def run(aws_kms_cmk, source_plaintext):
5959
# Demonstrate that the ciphertext and plaintext are different.
6060
assert ciphertext != source_plaintext
6161

62-
# Decrypt your encrypted data using the KMS discovery keyring.
62+
# Decrypt your encrypted data using the AWS KMS discovery keyring.
6363
#
6464
# You do not need to specify the encryption context on decrypt
6565
# because the header of the encrypted message includes the encryption context.

examples/src/keyring/aws_kms/discovery_decrypt_in_region_only.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
"""
4-
When you give the KMS keyring specific key IDs it will use those CMKs and nothing else.
4+
When you give the AWS KMS keyring specific key IDs it will use those CMKs and nothing else.
55
This is true both on encrypt and on decrypt.
66
However, sometimes you need more flexibility on decrypt,
77
especially when you don't know which CMKs were used to encrypt a message.
8-
To address this need, you can use a KMS discovery keyring.
9-
The KMS discovery keyring does nothing on encrypt,
10-
but attempts to decrypt *any* data keys that were encrypted under a KMS CMK.
8+
To address this need, you can use an AWS KMS discovery keyring.
9+
The AWS KMS discovery keyring does nothing on encrypt,
10+
but attempts to decrypt *any* data keys that were encrypted under an AWS KMS CMK.
1111
1212
However, sometimes you need to be a *bit* more restrictive than that.
13-
To address this need, you can use a client supplier that restricts the regions a KMS keyring can talk to.
13+
To address this need, you can use a client supplier that restricts the regions an AWS KMS keyring can talk to.
1414
15-
This example shows how to configure and use a KMS regional discovery keyring that is restricted to one region.
15+
This example shows how to configure and use an AWS KMS regional discovery keyring that is restricted to one region.
1616
1717
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/choose-keyring.html#use-kms-keyring
1818
19-
For an example of how to use the KMS keyring with CMKs in multiple regions,
19+
For an example of how to use the AWS KMS keyring with CMKs in multiple regions,
2020
see the ``keyring/aws_kms/multiple_regions`` example.
2121
22-
For examples of how to use the KMS keyring with custom client configurations,
22+
For examples of how to use the AWS KMS keyring with custom client configurations,
2323
see the ``keyring/aws_kms/custom_client_supplier``
2424
and ``keyring/aws_kms/custom_kms_client_config`` examples.
2525
26-
For examples of how to use the KMS discovery keyring on decrypt,
26+
For examples of how to use the AWS KMS discovery keyring on decrypt,
2727
see the ``keyring/aws_kms/discovery_decrypt``
2828
and ``keyring/aws_kms/discovery_decrypt_with_preferred_region`` examples.
2929
"""
3030
import aws_encryption_sdk
31-
from aws_encryption_sdk.keyrings.aws_kms import KmsKeyring
31+
from aws_encryption_sdk.keyrings.aws_kms import AwsKmsKeyring
3232
from aws_encryption_sdk.keyrings.aws_kms.client_suppliers import AllowRegionsClientSupplier
3333

3434

3535
def run(aws_kms_cmk, source_plaintext):
3636
# type: (str, bytes) -> None
37-
"""Demonstrate configuring a KMS discovery keyring to only work within a single region.
37+
"""Demonstrate configuring an AWS KMS discovery keyring to only work within a single region.
3838
3939
:param str aws_kms_cmk: The ARN of an AWS KMS CMK that protects data keys
4040
:param bytes source_plaintext: Plaintext to encrypt
@@ -50,17 +50,17 @@ def run(aws_kms_cmk, source_plaintext):
5050
}
5151

5252
# Create the keyring that determines how your data keys are protected.
53-
encrypt_keyring = KmsKeyring(generator_key_id=aws_kms_cmk)
53+
encrypt_keyring = AwsKmsKeyring(generator_key_id=aws_kms_cmk)
5454

5555
# Extract the region from the CMK ARN.
5656
decrypt_region = aws_kms_cmk.split(":", 4)[3]
5757

58-
# Create the KMS discovery keyring that we will use on decrypt.
58+
# Create the AWS KMS discovery keyring that we will use on decrypt.
5959
#
6060
# The client supplier that we specify here will only supply clients for the specified region.
6161
# The keyring only attempts to decrypt data keys if it can get a client for that region,
6262
# so this keyring will now ignore any data keys that were encrypted under a CMK in another region.
63-
decrypt_keyring = KmsKeyring(
63+
decrypt_keyring = AwsKmsKeyring(
6464
is_discovery=True, client_supplier=AllowRegionsClientSupplier(allowed_regions=[decrypt_region])
6565
)
6666

@@ -72,7 +72,7 @@ def run(aws_kms_cmk, source_plaintext):
7272
# Demonstrate that the ciphertext and plaintext are different.
7373
assert ciphertext != source_plaintext
7474

75-
# Decrypt your encrypted data using the KMS discovery keyring.
75+
# Decrypt your encrypted data using the AWS KMS discovery keyring.
7676
#
7777
# You do not need to specify the encryption context on decrypt
7878
# because the header of the encrypted message includes the encryption context.

0 commit comments

Comments
 (0)