Skip to content

Commit 5075cb4

Browse files
authored
chore: Clarify StrictAwsKmsMasterKeyProvider docs (#316)
1 parent a75831f commit 5075cb4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

README.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ StrictAwsKmsMasterKeyProvider
116116
A ``StrictAwsKmsMasterKeyProvider`` is configured with an explicit list of AWS KMS
117117
CMKs with which to encrypt and decrypt data. On encryption, it encrypts the plaintext with all
118118
configured CMKs. On decryption, it only attempts to decrypt ciphertexts that have been wrapped
119-
with one of the configured CMKs.
119+
with a CMK that matches one of the configured CMK ARNs.
120+
121+
To create a ``StrictAwsKmsMasterKeyProvider`` you must provide one or more CMKs. For providers that will only
122+
be used for encryption, you can use any valid `KMS key identifier`_. For providers that will be used for decryption, you
123+
must use the key ARN; key ids, alias names, and alias ARNs are not supported.
120124

121125
Because the ``StrictAwsKmsMasterKeyProvider`` uses the `boto3 SDK`_ to interact with `AWS KMS`_,
122126
it requires AWS Credentials.
@@ -125,10 +129,6 @@ pre-existing instance of a ``botocore session`` to the ``StrictAwsKmsMasterKeyPr
125129
This latter option can be useful if you have an alternate way to store your AWS credentials or
126130
you want to reuse an existing instance of a botocore session in order to decrease startup costs.
127131

128-
To create a ``StrictAwsKmsMasterKeyProvider`` you must provide one or more CMKs. For providers that will only
129-
be used for encryption, you can use any valid `KMS key identifier`_. For providers that will be used for decryption, you
130-
must use the key ARN; key ids, alias names, and alias ARNs are not supported.
131-
132132
If you configure the the ``StrictAwsKmsMasterKeyProvider`` with multiple CMKs, the `final message`_
133133
will include a copy of the data key encrypted by each configured CMK.
134134

src/aws_encryption_sdk/key_providers/kms.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,13 @@ def _new_master_key(self, key_id):
228228

229229
class StrictAwsKmsMasterKeyProvider(BaseKMSMasterKeyProvider):
230230
"""Strict Master Key Provider for KMS. It is configured with an explicit list of AWS KMS master keys that
231-
should be used for encryption in decryption. On encryption, the plaintext will be encrypted with all configured
232-
master keys. On decryption, the ciphertext will be decrypted with the first master key that can decrypt. If the
233-
ciphertext is encrypted with a master key that was not explicitly configured, decryption will fail.
231+
should be used for encryption and decryption. On encryption, the plaintext will be encrypted with all configured
232+
master keys. On decryption, it only attempts to decrypt ciphertexts that have been wrapped with a CMK that
233+
matches one of the configured CMK ARNs. If the ciphertext is encrypted with a master key that was not
234+
explicitly configured, decryption will fail. To create a StrictAwsKmsMasterKeyProvider you must provide
235+
one or more CMKs. For providers that will only be used for encryption, you can use any valid KMS key
236+
identifier. For providers that will be used for decryption, you must use the key ARN; key ids, alias names, and
237+
alias ARNs are not supported.
234238
235239
>>> import aws_encryption_sdk
236240
>>> kms_key_provider = aws_encryption_sdk.StrictAwsKmsMasterKeyProvider(key_ids=[

0 commit comments

Comments
 (0)