Skip to content

Commit abacb0c

Browse files
lavalerirobin-aws
authored andcommitted
chore: Clarify StrictAwsKmsMasterKeyProvider docs (aws#316)
1 parent b34cfad commit abacb0c

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
@@ -113,7 +113,11 @@ StrictAwsKmsMasterKeyProvider
113113
A ``StrictAwsKmsMasterKeyProvider`` is configured with an explicit list of AWS KMS
114114
CMKs with which to encrypt and decrypt data. On encryption, it encrypts the plaintext with all
115115
configured CMKs. On decryption, it only attempts to decrypt ciphertexts that have been wrapped
116-
with one of the configured CMKs.
116+
with a CMK that matches one of the configured CMK ARNs.
117+
118+
To create a ``StrictAwsKmsMasterKeyProvider`` you must provide one or more CMKs. For providers that will only
119+
be used for encryption, you can use any valid `KMS key identifier`_. For providers that will be used for decryption, you
120+
must use the key ARN; key ids, alias names, and alias ARNs are not supported.
117121

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

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

src/aws_encryption_sdk/key_providers/kms.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,13 @@ def validate_config(self):
274274

275275
class StrictAwsKmsMasterKeyProvider(BaseKMSMasterKeyProvider):
276276
"""Strict Master Key Provider for KMS. It is configured with an explicit list of AWS KMS master keys that
277-
should be used for encryption in decryption. On encryption, the plaintext will be encrypted with all configured
278-
master keys. On decryption, the ciphertext will be decrypted with the first master key that can decrypt. If the
279-
ciphertext is encrypted with a master key that was not explicitly configured, decryption will fail.
277+
should be used for encryption and decryption. On encryption, the plaintext will be encrypted with all configured
278+
master keys. On decryption, it only attempts to decrypt ciphertexts that have been wrapped with a CMK that
279+
matches one of the configured CMK ARNs. If the ciphertext is encrypted with a master key that was not
280+
explicitly configured, decryption will fail. To create a StrictAwsKmsMasterKeyProvider you must provide
281+
one or more CMKs. For providers that will only be used for encryption, you can use any valid KMS key
282+
identifier. For providers that will be used for decryption, you must use the key ARN; key ids, alias names, and
283+
alias ARNs are not supported.
280284
281285
>>> import aws_encryption_sdk
282286
>>> kms_key_provider = aws_encryption_sdk.StrictAwsKmsMasterKeyProvider(key_ids=[

0 commit comments

Comments
 (0)