aws-sdk-kms 1.25.0 → 1.30.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc40b47d473897a755651115bc45f54ad4665f60
4
- data.tar.gz: 15b7304c7bcfb42ed6d837c1de32855847ebe046
3
+ metadata.gz: fd687a67eae0bd2e1e27db0bee56696bd8c259ae
4
+ data.tar.gz: a268d6ee5c1b71f031ad1484ef223ec9d9d89047
5
5
  SHA512:
6
- metadata.gz: a95c2c152d30f4075256ea7cecef0bd0b20b300055bd19b85864919135c3367cb85946af0ccca4a163a8ecd3aac8fac3c88c854756d6a935db51a77d40523723
7
- data.tar.gz: e4a0fe25fdb376afd009ad5e7773503138be0d899f483fafd023217375fd19217b3cd4bd25e1d2a901b2b72a8f3502d5adce7d184b0d4a8204c5186d251a7acc
6
+ metadata.gz: 0262c9d972c4ecc4f5f26b33c8d37acdcd113b94ad57ff02cbff92e438ba075ab1137b078077e3c089f441c657191fd9f1c754e096210eb85a71b8e5eaf882bc
7
+ data.tar.gz: 474114212e5a89a15a19b6f3294f1e3b75e43ec42053ebb91920d6acf137a32532f3a53bd37f2f2d7dae7d2c1029564f7825f5733f19797b7f4f690e81fb462f
@@ -24,17 +24,20 @@ require_relative 'aws-sdk-kms/customizations'
24
24
  # methods each accept a hash of request parameters and return a response
25
25
  # structure.
26
26
  #
27
+ # kms = Aws::KMS::Client.new
28
+ # resp = kms.cancel_key_deletion(params)
29
+ #
27
30
  # See {Client} for more information.
28
31
  #
29
32
  # # Errors
30
33
  #
31
- # Errors returned from AWS Key Management Service all
32
- # extend {Errors::ServiceError}.
34
+ # Errors returned from AWS Key Management Service are defined in the
35
+ # {Errors} module and all extend {Errors::ServiceError}.
33
36
  #
34
37
  # begin
35
38
  # # do stuff
36
39
  # rescue Aws::KMS::Errors::ServiceError
37
- # # rescues all service API errors
40
+ # # rescues all AWS Key Management Service API errors
38
41
  # end
39
42
  #
40
43
  # See {Errors} for more information.
@@ -42,6 +45,6 @@ require_relative 'aws-sdk-kms/customizations'
42
45
  # @service
43
46
  module Aws::KMS
44
47
 
45
- GEM_VERSION = '1.25.0'
48
+ GEM_VERSION = '1.30.0'
46
49
 
47
50
  end
@@ -30,6 +30,18 @@ require 'aws-sdk-core/plugins/protocols/json_rpc.rb'
30
30
  Aws::Plugins::GlobalConfiguration.add_identifier(:kms)
31
31
 
32
32
  module Aws::KMS
33
+ # An API client for KMS. To construct a client, you need to configure a `:region` and `:credentials`.
34
+ #
35
+ # client = Aws::KMS::Client.new(
36
+ # region: region_name,
37
+ # credentials: credentials,
38
+ # # ...
39
+ # )
40
+ #
41
+ # For details on configuring region and credentials see
42
+ # the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
43
+ #
44
+ # See {#initialize} for a full list of supported configuration options.
33
45
  class Client < Seahorse::Client::Base
34
46
 
35
47
  include Aws::ClientStubs
@@ -108,6 +120,12 @@ module Aws::KMS
108
120
  # When set to `true`, a thread polling for endpoints will be running in
109
121
  # the background every 60 secs (default). Defaults to `false`.
110
122
  #
123
+ # @option options [Boolean] :adaptive_retry_wait_to_fill (true)
124
+ # Used only in `adaptive` retry mode. When true, the request will sleep
125
+ # until there is sufficent client side capacity to retry the request.
126
+ # When false, the request will raise a `RetryCapacityNotAvailableError` and will
127
+ # not retry instead of sleeping.
128
+ #
111
129
  # @option options [Boolean] :client_side_monitoring (false)
112
130
  # When `true`, client-side metrics will be collected for all API requests from
113
131
  # this client.
@@ -132,6 +150,10 @@ module Aws::KMS
132
150
  # When `true`, an attempt is made to coerce request parameters into
133
151
  # the required types.
134
152
  #
153
+ # @option options [Boolean] :correct_clock_skew (true)
154
+ # Used only in `standard` and adaptive retry modes. Specifies whether to apply
155
+ # a clock skew correction and retry requests with skewed client clocks.
156
+ #
135
157
  # @option options [Boolean] :disable_host_prefix_injection (false)
136
158
  # Set to true to disable SDK automatically adding host prefix
137
159
  # to default service endpoint when available.
@@ -166,15 +188,29 @@ module Aws::KMS
166
188
  # The Logger instance to send log messages to. If this option
167
189
  # is not set, logging will be disabled.
168
190
  #
191
+ # @option options [Integer] :max_attempts (3)
192
+ # An integer representing the maximum number attempts that will be made for
193
+ # a single request, including the initial attempt. For example,
194
+ # setting this value to 5 will result in a request being retried up to
195
+ # 4 times. Used in `standard` and `adaptive` retry modes.
196
+ #
169
197
  # @option options [String] :profile ("default")
170
198
  # Used when loading credentials from the shared credentials file
171
199
  # at HOME/.aws/credentials. When not specified, 'default' is used.
172
200
  #
201
+ # @option options [Proc] :retry_backoff
202
+ # A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
203
+ # This option is only used in the `legacy` retry mode.
204
+ #
173
205
  # @option options [Float] :retry_base_delay (0.3)
174
- # The base delay in seconds used by the default backoff function.
206
+ # The base delay in seconds used by the default backoff function. This option
207
+ # is only used in the `legacy` retry mode.
175
208
  #
176
209
  # @option options [Symbol] :retry_jitter (:none)
177
- # A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number.
210
+ # A delay randomiser function used by the default backoff function.
211
+ # Some predefined functions can be referenced by name - :none, :equal, :full,
212
+ # otherwise a Proc that takes and returns a number. This option is only used
213
+ # in the `legacy` retry mode.
178
214
  #
179
215
  # @see https://www.awsarchitectureblog.com/2015/03/backoff.html
180
216
  #
@@ -182,11 +218,26 @@ module Aws::KMS
182
218
  # The maximum number of times to retry failed requests. Only
183
219
  # ~ 500 level server errors and certain ~ 400 level client errors
184
220
  # are retried. Generally, these are throttling errors, data
185
- # checksum errors, networking errors, timeout errors and auth
186
- # errors from expired credentials.
221
+ # checksum errors, networking errors, timeout errors, auth errors,
222
+ # endpoint discovery, and errors from expired credentials.
223
+ # This option is only used in the `legacy` retry mode.
187
224
  #
188
225
  # @option options [Integer] :retry_max_delay (0)
189
- # The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function.
226
+ # The maximum number of seconds to delay between retries (0 for no limit)
227
+ # used by the default backoff function. This option is only used in the
228
+ # `legacy` retry mode.
229
+ #
230
+ # @option options [String] :retry_mode ("legacy")
231
+ # Specifies which retry algorithm to use. Values are:
232
+ # * `legacy` - The pre-existing retry behavior. This is default value if
233
+ # no retry mode is provided.
234
+ # * `standard` - A standardized set of retry rules across the AWS SDKs.
235
+ # This includes support for retry quotas, which limit the number of
236
+ # unsuccessful retries a client can make.
237
+ # * `adaptive` - An experimental retry mode that includes all the
238
+ # functionality of `standard` mode along with automatic client side
239
+ # throttling. This is a provisional mode that may change behavior
240
+ # in the future.
190
241
  #
191
242
  # @option options [String] :secret_access_key
192
243
  #
@@ -219,16 +270,16 @@ module Aws::KMS
219
270
  # requests through. Formatted like 'http://proxy.com:123'.
220
271
  #
221
272
  # @option options [Float] :http_open_timeout (15) The number of
222
- # seconds to wait when opening a HTTP session before rasing a
273
+ # seconds to wait when opening a HTTP session before raising a
223
274
  # `Timeout::Error`.
224
275
  #
225
276
  # @option options [Integer] :http_read_timeout (60) The default
226
277
  # number of seconds to wait for response data. This value can
227
278
  # safely be set
228
- # per-request on the session yeidled by {#session_for}.
279
+ # per-request on the session yielded by {#session_for}.
229
280
  #
230
281
  # @option options [Float] :http_idle_timeout (5) The number of
231
- # seconds a connection is allowed to sit idble before it is
282
+ # seconds a connection is allowed to sit idle before it is
232
283
  # considered stale. Stale connections are closed and removed
233
284
  # from the pool before making a request.
234
285
  #
@@ -237,7 +288,7 @@ module Aws::KMS
237
288
  # request body. This option has no effect unless the request has
238
289
  # "Expect" header set to "100-continue". Defaults to `nil` which
239
290
  # disables this behaviour. This value can safely be set per
240
- # request on the session yeidled by {#session_for}.
291
+ # request on the session yielded by {#session_for}.
241
292
  #
242
293
  # @option options [Boolean] :http_wire_trace (false) When `true`,
243
294
  # HTTP debug output will be sent to the `:logger`.
@@ -265,17 +316,17 @@ module Aws::KMS
265
316
  # @!group API Operations
266
317
 
267
318
  # Cancels the deletion of a customer master key (CMK). When this
268
- # operation is successful, the CMK is set to the `Disabled` state. To
269
- # enable a CMK, use EnableKey. You cannot perform this operation on a
270
- # CMK in a different AWS account.
319
+ # operation succeeds, the key state of the CMK is `Disabled`. To enable
320
+ # the CMK, use EnableKey. You cannot perform this operation on a CMK in
321
+ # a different AWS account.
271
322
  #
272
323
  # For more information about scheduling and canceling deletion of a CMK,
273
324
  # see [Deleting Customer Master Keys][1] in the *AWS Key Management
274
325
  # Service Developer Guide*.
275
326
  #
276
- # The result of this operation varies with the key state of the CMK. For
277
- # details, see [How Key State Affects Use of a Customer Master Key][2]
278
- # in the *AWS Key Management Service Developer Guide*.
327
+ # The CMK that you use for this operation must be in a compatible key
328
+ # state. For details, see [How Key State Affects Use of a Customer
329
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
279
330
  #
280
331
  #
281
332
  #
@@ -344,7 +395,9 @@ module Aws::KMS
344
395
  # To connect a custom key store, its associated AWS CloudHSM cluster
345
396
  # must have at least one active HSM. To get the number of active HSMs in
346
397
  # a cluster, use the [DescribeClusters][2] operation. To add HSMs to the
347
- # cluster, use the [CreateHsm][3] operation.
398
+ # cluster, use the [CreateHsm][3] operation. Also, the [ `kmsuser`
399
+ # crypto user][4] (CU) must not be logged into the cluster. This
400
+ # prevents AWS KMS from using this account to log in.
348
401
  #
349
402
  # The connection process can take an extended amount of time to
350
403
  # complete; up to 20 minutes. This operation starts the connection
@@ -357,8 +410,7 @@ module Aws::KMS
357
410
  # During the connection process, AWS KMS finds the AWS CloudHSM cluster
358
411
  # that is associated with the custom key store, creates the connection
359
412
  # infrastructure, connects to the cluster, logs into the AWS CloudHSM
360
- # client as the [ `kmsuser` crypto user][4] (CU), and rotates its
361
- # password.
413
+ # client as the `kmsuser` CU, and rotates its password.
362
414
  #
363
415
  # The `ConnectCustomKeyStore` operation might fail for various reasons.
364
416
  # To find the reason, use the DescribeCustomKeyStores operation and see
@@ -405,39 +457,78 @@ module Aws::KMS
405
457
  end
406
458
 
407
459
  # Creates a display name for a customer managed customer master key
408
- # (CMK). You can use an alias to identify a CMK in selected operations,
409
- # such as Encrypt and GenerateDataKey.
410
- #
411
- # Each CMK can have multiple aliases, but each alias points to only one
412
- # CMK. The alias name must be unique in the AWS account and region. To
413
- # simplify code that runs in multiple regions, use the same alias name,
414
- # but point it to a different CMK in each region.
460
+ # (CMK). You can use an alias to identify a CMK in cryptographic
461
+ # operations, such as Encrypt and GenerateDataKey. You can change the
462
+ # CMK associated with the alias at any time.
463
+ #
464
+ # Aliases are easier to remember than key IDs. They can also help to
465
+ # simplify your applications. For example, if you use an alias in your
466
+ # code, you can change the CMK your code uses by associating a given
467
+ # alias with a different CMK.
468
+ #
469
+ # To run the same code in multiple AWS regions, use an alias in your
470
+ # code, such as `alias/ApplicationKey`. Then, in each AWS Region, create
471
+ # an `alias/ApplicationKey` alias that is associated with a CMK in that
472
+ # Region. When you run your code, it uses the `alias/ApplicationKey` CMK
473
+ # for that AWS Region without any Region-specific code.
474
+ #
475
+ # This operation does not return a response. To get the alias that you
476
+ # created, use the ListAliases operation.
477
+ #
478
+ # To use aliases successfully, be aware of the following information.
479
+ #
480
+ # * Each alias points to only one CMK at a time, although a single CMK
481
+ # can have multiple aliases. The alias and its associated CMK must be
482
+ # in the same AWS account and Region.
483
+ #
484
+ # * You can associate an alias with any customer managed CMK in the same
485
+ # AWS account and Region. However, you do not have permission to
486
+ # associate an alias with an [AWS managed CMK][1] or an [AWS owned
487
+ # CMK][2].
488
+ #
489
+ # * To change the CMK associated with an alias, use the UpdateAlias
490
+ # operation. The current CMK and the new CMK must be the same type
491
+ # (both symmetric or both asymmetric) and they must have the same key
492
+ # usage (`ENCRYPT_DECRYPT` or `SIGN_VERIFY`). This restriction
493
+ # prevents cryptographic errors in code that uses aliases.
494
+ #
495
+ # * The alias name must begin with `alias/` followed by a name, such as
496
+ # `alias/ExampleAlias`. It can contain only alphanumeric characters,
497
+ # forward slashes (/), underscores (\_), and dashes (-). The alias
498
+ # name cannot begin with `alias/aws/`. The `alias/aws/` prefix is
499
+ # reserved for [AWS managed CMKs][1].
500
+ #
501
+ # * The alias name must be unique within an AWS Region. However, you can
502
+ # use the same alias name in multiple Regions of the same AWS account.
503
+ # Each instance of the alias is associated with a CMK in its Region.
504
+ #
505
+ # * After you create an alias, you cannot change its alias name.
506
+ # However, you can use the DeleteAlias operation to delete the alias
507
+ # and then create a new alias with the desired name.
508
+ #
509
+ # * You can use an alias name or alias ARN to identify a CMK in AWS KMS
510
+ # cryptographic operations and in the DescribeKey operation. However,
511
+ # you cannot use alias names or alias ARNs in API operations that
512
+ # manage CMKs, such as DisableKey or GetKeyPolicy. For information
513
+ # about the valid CMK identifiers for each AWS KMS API operation, see
514
+ # the descriptions of the `KeyId` parameter in the API operation
515
+ # documentation.
415
516
  #
416
517
  # Because an alias is not a property of a CMK, you can delete and change
417
518
  # the aliases of a CMK without affecting the CMK. Also, aliases do not
418
519
  # appear in the response from the DescribeKey operation. To get the
419
- # aliases of all CMKs, use the ListAliases operation.
420
- #
421
- # The alias name must begin with `alias/` followed by a name, such as
422
- # `alias/ExampleAlias`. It can contain only alphanumeric characters,
423
- # forward slashes (/), underscores (\_), and dashes (-). The alias name
424
- # cannot begin with `alias/aws/`. The `alias/aws/` prefix is reserved
425
- # for [AWS managed CMKs][1].
426
- #
427
- # The alias and the CMK it is mapped to must be in the same AWS account
428
- # and the same region. You cannot perform this operation on an alias in
429
- # a different AWS account.
520
+ # aliases and alias ARNs of CMKs in each AWS account and Region, use the
521
+ # ListAliases operation.
430
522
  #
431
- # To map an existing alias to a different CMK, call UpdateAlias.
432
- #
433
- # The result of this operation varies with the key state of the CMK. For
434
- # details, see [How Key State Affects Use of a Customer Master Key][2]
435
- # in the *AWS Key Management Service Developer Guide*.
523
+ # The CMK that you use for this operation must be in a compatible key
524
+ # state. For details, see [How Key State Affects Use of a Customer
525
+ # Master Key][3] in the *AWS Key Management Service Developer Guide*.
436
526
  #
437
527
  #
438
528
  #
439
529
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk
440
- # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
530
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk
531
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
441
532
  #
442
533
  # @option params [required, String] :alias_name
443
534
  # Specifies the alias name. This value must begin with `alias/` followed
@@ -542,6 +633,9 @@ module Aws::KMS
542
633
  # the specified AWS CloudHSM cluster. AWS KMS logs into the cluster as
543
634
  # this user to manage key material on your behalf.
544
635
  #
636
+ # The password must be a string of 7 to 32 characters. Its value is case
637
+ # sensitive.
638
+ #
545
639
  # This parameter tells AWS KMS the `kmsuser` account password; it does
546
640
  # not change the password in the AWS CloudHSM cluster.
547
641
  #
@@ -581,23 +675,58 @@ module Aws::KMS
581
675
  # key policies.
582
676
  #
583
677
  # To create a grant that allows a cryptographic operation only when the
584
- # encryption context in the operation request matches or includes a
585
- # specified encryption context, use the `Constraints` parameter. For
586
- # details, see GrantConstraints.
678
+ # request includes a particular [encryption context][1], use the
679
+ # `Constraints` parameter. For details, see GrantConstraints.
680
+ #
681
+ # You can create grants on symmetric and asymmetric CMKs. However, if
682
+ # the grant allows an operation that the CMK does not support,
683
+ # `CreateGrant` fails with a `ValidationException`.
684
+ #
685
+ # * Grants for symmetric CMKs cannot allow operations that are not
686
+ # supported for symmetric CMKs, including Sign, Verify, and
687
+ # GetPublicKey. (There are limited exceptions to this rule for legacy
688
+ # operations, but you should not create a grant for an operation that
689
+ # AWS KMS does not support.)
690
+ #
691
+ # * Grants for asymmetric CMKs cannot allow operations that are not
692
+ # supported for asymmetric CMKs, including operations that [generate
693
+ # data keys][2] or [data key pairs][3], or operations related to
694
+ # [automatic key rotation][4], [imported key material][5], or CMKs in
695
+ # [custom key stores][6].
696
+ #
697
+ # * Grants for asymmetric CMKs with a `KeyUsage` of `ENCRYPT_DECRYPT`
698
+ # cannot allow the Sign or Verify operations. Grants for asymmetric
699
+ # CMKs with a `KeyUsage` of `SIGN_VERIFY` cannot allow the Encrypt or
700
+ # Decrypt operations.
701
+ #
702
+ # * Grants for asymmetric CMKs cannot include an encryption context
703
+ # grant constraint. An encryption context is not supported on
704
+ # asymmetric CMKs.
705
+ #
706
+ # For information about symmetric and asymmetric CMKs, see [Using
707
+ # Symmetric and Asymmetric CMKs][7] in the *AWS Key Management Service
708
+ # Developer Guide*.
587
709
  #
588
710
  # To perform this operation on a CMK in a different AWS account, specify
589
711
  # the key ARN in the value of the `KeyId` parameter. For more
590
- # information about grants, see [Grants][1] in the <i> <i>AWS Key
712
+ # information about grants, see [Grants][8] in the <i> <i>AWS Key
591
713
  # Management Service Developer Guide</i> </i>.
592
714
  #
593
- # The result of this operation varies with the key state of the CMK. For
594
- # details, see [How Key State Affects Use of a Customer Master Key][2]
595
- # in the *AWS Key Management Service Developer Guide*.
715
+ # The CMK that you use for this operation must be in a compatible key
716
+ # state. For details, see [How Key State Affects Use of a Customer
717
+ # Master Key][9] in the *AWS Key Management Service Developer Guide*.
596
718
  #
597
719
  #
598
720
  #
599
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/grants.html
600
- # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
721
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
722
+ # [2]: https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateDataKey
723
+ # [3]: https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateDataKeyPair
724
+ # [4]: https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html
725
+ # [5]: https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html
726
+ # [6]: https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html
727
+ # [7]: https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html
728
+ # [8]: https://docs.aws.amazon.com/kms/latest/developerguide/grants.html
729
+ # [9]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
601
730
  #
602
731
  # @option params [required, String] :key_id
603
732
  # The unique identifier for the customer master key (CMK) that the grant
@@ -720,7 +849,7 @@ module Aws::KMS
720
849
  # key_id: "KeyIdType", # required
721
850
  # grantee_principal: "PrincipalIdType", # required
722
851
  # retiring_principal: "PrincipalIdType",
723
- # operations: ["Decrypt"], # required, accepts Decrypt, Encrypt, GenerateDataKey, GenerateDataKeyWithoutPlaintext, ReEncryptFrom, ReEncryptTo, CreateGrant, RetireGrant, DescribeKey
852
+ # operations: ["Decrypt"], # required, accepts Decrypt, Encrypt, GenerateDataKey, GenerateDataKeyWithoutPlaintext, ReEncryptFrom, ReEncryptTo, Sign, Verify, GetPublicKey, CreateGrant, RetireGrant, DescribeKey, GenerateDataKeyPair, GenerateDataKeyPairWithoutPlaintext
724
853
  # constraints: {
725
854
  # encryption_context_subset: {
726
855
  # "EncryptionContextKey" => "EncryptionContextValue",
@@ -747,31 +876,91 @@ module Aws::KMS
747
876
  req.send_request(options)
748
877
  end
749
878
 
750
- # Creates a customer managed [customer master key][1] (CMK) in your AWS
751
- # account.
879
+ # Creates a unique customer managed [customer master key][1] (CMK) in
880
+ # your AWS account and Region. You cannot use this operation to create a
881
+ # CMK in a different AWS account.
882
+ #
883
+ # You can use the `CreateKey` operation to create symmetric or
884
+ # asymmetric CMKs.
885
+ #
886
+ # * **Symmetric CMKs** contain a 256-bit symmetric key that never leaves
887
+ # AWS KMS unencrypted. To use the CMK, you must call AWS KMS. You can
888
+ # use a symmetric CMK to encrypt and decrypt small amounts of data,
889
+ # but they are typically used to generate [data keys][2] and [data
890
+ # keys pairs][3]. For details, see GenerateDataKey and
891
+ # GenerateDataKeyPair.
892
+ #
893
+ # * **Asymmetric CMKs** can contain an RSA key pair or an Elliptic Curve
894
+ # (ECC) key pair. The private key in an asymmetric CMK never leaves
895
+ # AWS KMS unencrypted. However, you can use the GetPublicKey operation
896
+ # to download the public key so it can be used outside of AWS KMS.
897
+ # CMKs with RSA key pairs can be used to encrypt or decrypt data or
898
+ # sign and verify messages (but not both). CMKs with ECC key pairs can
899
+ # be used only to sign and verify messages.
900
+ #
901
+ # For information about symmetric and asymmetric CMKs, see [Using
902
+ # Symmetric and Asymmetric CMKs][4] in the *AWS Key Management Service
903
+ # Developer Guide*.
752
904
  #
753
- # You can use a CMK to encrypt small amounts of data (up to 4096 bytes)
754
- # directly. But CMKs are more commonly used to encrypt the [data
755
- # keys][2] that are used to encrypt data.
905
+ # To create different types of CMKs, use the following guidance:
756
906
  #
757
- # To create a CMK for imported key material, use the `Origin` parameter
758
- # with a value of `EXTERNAL`.
907
+ # Asymmetric CMKs
759
908
  #
760
- # To create a CMK in a [custom key store][3], use the `CustomKeyStoreId`
761
- # parameter to specify the custom key store. You must also use the
762
- # `Origin` parameter with a value of `AWS_CLOUDHSM`. The AWS CloudHSM
763
- # cluster that is associated with the custom key store must have at
764
- # least two active HSMs in different Availability Zones in the AWS
765
- # Region.
909
+ # : To create an asymmetric CMK, use the `CustomerMasterKeySpec`
910
+ # parameter to specify the type of key material in the CMK. Then, use
911
+ # the `KeyUsage` parameter to determine whether the CMK will be used
912
+ # to encrypt and decrypt or sign and verify. You can't change these
913
+ # properties after the CMK is created.
766
914
  #
767
- # You cannot use this operation to create a CMK in a different AWS
768
- # account.
769
915
  #
770
916
  #
917
+ # Symmetric CMKs
918
+ #
919
+ # : When creating a symmetric CMK, you don't need to specify the
920
+ # `CustomerMasterKeySpec` or `KeyUsage` parameters. The default value
921
+ # for `CustomerMasterKeySpec`, `SYMMETRIC_DEFAULT`, and the default
922
+ # value for `KeyUsage`, `ENCRYPT_DECRYPT`, are the only valid values
923
+ # for symmetric CMKs.
924
+ #
925
+ #
926
+ #
927
+ # Imported Key Material
928
+ #
929
+ # : To import your own key material, begin by creating a symmetric CMK
930
+ # with no key material. To do this, use the `Origin` parameter of
931
+ # `CreateKey` with a value of `EXTERNAL`. Next, use
932
+ # GetParametersForImport operation to get a public key and import
933
+ # token, and use the public key to encrypt your key material. Then,
934
+ # use ImportKeyMaterial with your import token to import the key
935
+ # material. For step-by-step instructions, see [Importing Key
936
+ # Material][5] in the <i> <i>AWS Key Management Service Developer
937
+ # Guide</i> </i>. You cannot import the key material into an
938
+ # asymmetric CMK.
939
+ #
771
940
  #
772
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys
941
+ #
942
+ # Custom Key Stores
943
+ #
944
+ # : To create a symmetric CMK in a [custom key store][6], use the
945
+ # `CustomKeyStoreId` parameter to specify the custom key store. You
946
+ # must also use the `Origin` parameter with a value of `AWS_CLOUDHSM`.
947
+ # The AWS CloudHSM cluster that is associated with the custom key
948
+ # store must have at least two active HSMs in different Availability
949
+ # Zones in the AWS Region.
950
+ #
951
+ # You cannot create an asymmetric CMK in a custom key store. For
952
+ # information about custom key stores in AWS KMS see [Using Custom Key
953
+ # Stores][6] in the <i> <i>AWS Key Management Service Developer
954
+ # Guide</i> </i>.
955
+ #
956
+ #
957
+ #
958
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master-keys
773
959
  # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys
774
- # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html
960
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-key-pairs
961
+ # [4]: https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html
962
+ # [5]: https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html
963
+ # [6]: https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html
775
964
  #
776
965
  # @option params [String] :policy
777
966
  # The key policy to attach to the CMK.
@@ -799,7 +988,7 @@ module Aws::KMS
799
988
  # policy to the CMK. For more information, see [Default Key Policy][3]
800
989
  # in the *AWS Key Management Service Developer Guide*.
801
990
  #
802
- # The key policy size limit is 32 kilobytes (32768 bytes).
991
+ # The key policy size quota is 32 kilobytes (32768 bytes).
803
992
  #
804
993
  #
805
994
  #
@@ -814,27 +1003,97 @@ module Aws::KMS
814
1003
  # for a task.
815
1004
  #
816
1005
  # @option params [String] :key_usage
817
- # The cryptographic operations for which you can use the CMK. The only
818
- # valid value is `ENCRYPT_DECRYPT`, which means you can use the CMK to
819
- # encrypt and decrypt data.
1006
+ # Determines the cryptographic operations for which you can use the CMK.
1007
+ # The default value is `ENCRYPT_DECRYPT`. This parameter is required
1008
+ # only for asymmetric CMKs. You can't change the `KeyUsage` value after
1009
+ # the CMK is created.
1010
+ #
1011
+ # Select only one valid value.
1012
+ #
1013
+ # * For symmetric CMKs, omit the parameter or specify `ENCRYPT_DECRYPT`.
1014
+ #
1015
+ # * For asymmetric CMKs with RSA key material, specify `ENCRYPT_DECRYPT`
1016
+ # or `SIGN_VERIFY`.
1017
+ #
1018
+ # * For asymmetric CMKs with ECC key material, specify `SIGN_VERIFY`.
1019
+ #
1020
+ # @option params [String] :customer_master_key_spec
1021
+ # Specifies the type of CMK to create. The default value,
1022
+ # `SYMMETRIC_DEFAULT`, creates a CMK with a 256-bit symmetric key for
1023
+ # encryption and decryption. For help choosing a key spec for your CMK,
1024
+ # see [How to Choose Your CMK Configuration][1] in the *AWS Key
1025
+ # Management Service Developer Guide*.
1026
+ #
1027
+ # The `CustomerMasterKeySpec` determines whether the CMK contains a
1028
+ # symmetric key or an asymmetric key pair. It also determines the
1029
+ # encryption algorithms or signing algorithms that the CMK supports. You
1030
+ # can't change the `CustomerMasterKeySpec` after the CMK is created. To
1031
+ # further restrict the algorithms that can be used with the CMK, use a
1032
+ # condition key in its key policy or IAM policy. For more information,
1033
+ # see [kms:EncryptionAlgorithm][2] or [kms:Signing Algorithm][3] in the
1034
+ # *AWS Key Management Service Developer Guide*.
1035
+ #
1036
+ # [AWS services that are integrated with AWS KMS][4] use symmetric CMKs
1037
+ # to protect your data. These services do not support asymmetric CMKs.
1038
+ # For help determining whether a CMK is symmetric or asymmetric, see
1039
+ # [Identifying Symmetric and Asymmetric CMKs][5] in the *AWS Key
1040
+ # Management Service Developer Guide*.
1041
+ #
1042
+ # AWS KMS supports the following key specs for CMKs:
1043
+ #
1044
+ # * Symmetric key (default)
1045
+ #
1046
+ # * `SYMMETRIC_DEFAULT` (AES-256-GCM)
1047
+ #
1048
+ # ^
1049
+ #
1050
+ # * Asymmetric RSA key pairs
1051
+ #
1052
+ # * `RSA_2048`
1053
+ #
1054
+ # * `RSA_3072`
1055
+ #
1056
+ # * `RSA_4096`
1057
+ #
1058
+ # * Asymmetric NIST-recommended elliptic curve key pairs
1059
+ #
1060
+ # * `ECC_NIST_P256` (secp256r1)
1061
+ #
1062
+ # * `ECC_NIST_P384` (secp384r1)
1063
+ #
1064
+ # * `ECC_NIST_P521` (secp521r1)
1065
+ #
1066
+ # * Other asymmetric elliptic curve key pairs
1067
+ #
1068
+ # * `ECC_SECG_P256K1` (secp256k1), commonly used for cryptocurrencies.
1069
+ #
1070
+ # ^
1071
+ #
1072
+ #
1073
+ #
1074
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-choose.html
1075
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-encryption-algorithm
1076
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-signing-algorithm
1077
+ # [4]: http://aws.amazon.com/kms/features/#AWS_Service_Integration
1078
+ # [5]: https://docs.aws.amazon.com/kms/latest/developerguide/find-symm-asymm.html
820
1079
  #
821
1080
  # @option params [String] :origin
822
1081
  # The source of the key material for the CMK. You cannot change the
823
- # origin after you create the CMK.
824
- #
825
- # The default is `AWS_KMS`, which means AWS KMS creates the key material
826
- # in its own key store.
1082
+ # origin after you create the CMK. The default is `AWS_KMS`, which means
1083
+ # AWS KMS creates the key material.
827
1084
  #
828
1085
  # When the parameter value is `EXTERNAL`, AWS KMS creates a CMK without
829
1086
  # key material so that you can import key material from your existing
830
1087
  # key management infrastructure. For more information about importing
831
1088
  # key material into AWS KMS, see [Importing Key Material][1] in the *AWS
832
- # Key Management Service Developer Guide*.
1089
+ # Key Management Service Developer Guide*. This value is valid only for
1090
+ # symmetric CMKs.
833
1091
  #
834
1092
  # When the parameter value is `AWS_CLOUDHSM`, AWS KMS creates the CMK in
835
1093
  # an AWS KMS [custom key store][2] and creates its key material in the
836
1094
  # associated AWS CloudHSM cluster. You must also use the
837
- # `CustomKeyStoreId` parameter to identify the custom key store.
1095
+ # `CustomKeyStoreId` parameter to identify the custom key store. This
1096
+ # value is valid only for symmetric CMKs.
838
1097
  #
839
1098
  #
840
1099
  #
@@ -849,6 +1108,9 @@ module Aws::KMS
849
1108
  # with the custom key store must have at least two active HSMs, each in
850
1109
  # a different Availability Zone in the Region.
851
1110
  #
1111
+ # This parameter is valid only for symmetric CMKs. You cannot create an
1112
+ # asymmetric CMK in a custom key store.
1113
+ #
852
1114
  # To find the ID of a custom key store, use the DescribeCustomKeyStores
853
1115
  # operation.
854
1116
  #
@@ -885,13 +1147,21 @@ module Aws::KMS
885
1147
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam
886
1148
  #
887
1149
  # @option params [Array<Types::Tag>] :tags
888
- # One or more tags. Each tag consists of a tag key and a tag value. Tag
889
- # keys and tag values are both required, but tag values can be empty
890
- # (null) strings.
1150
+ # One or more tags. Each tag consists of a tag key and a tag value. Both
1151
+ # the tag key and the tag value are required, but the tag value can be
1152
+ # an empty (null) string.
1153
+ #
1154
+ # When you add tags to an AWS resource, AWS generates a cost allocation
1155
+ # report with usage and costs aggregated by tags. For information about
1156
+ # adding, changing, deleting and listing tags for CMKs, see [Tagging
1157
+ # Keys][1].
1158
+ #
1159
+ # Use this parameter to tag the CMK when it is created. To add tags to
1160
+ # an existing CMK, use the TagResource operation.
1161
+ #
1162
+ #
891
1163
  #
892
- # Use this parameter to tag the CMK when it is created. Alternately, you
893
- # can omit this parameter and instead tag the CMK after it is created
894
- # using TagResource.
1164
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html
895
1165
  #
896
1166
  # @return [Types::CreateKeyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
897
1167
  #
@@ -932,7 +1202,8 @@ module Aws::KMS
932
1202
  # resp = client.create_key({
933
1203
  # policy: "PolicyType",
934
1204
  # description: "DescriptionType",
935
- # key_usage: "ENCRYPT_DECRYPT", # accepts ENCRYPT_DECRYPT
1205
+ # key_usage: "SIGN_VERIFY", # accepts SIGN_VERIFY, ENCRYPT_DECRYPT
1206
+ # customer_master_key_spec: "RSA_2048", # accepts RSA_2048, RSA_3072, RSA_4096, ECC_NIST_P256, ECC_NIST_P384, ECC_NIST_P521, ECC_SECG_P256K1, SYMMETRIC_DEFAULT
936
1207
  # origin: "AWS_KMS", # accepts AWS_KMS, EXTERNAL, AWS_CLOUDHSM
937
1208
  # custom_key_store_id: "CustomKeyStoreIdType",
938
1209
  # bypass_policy_lockout_safety_check: false,
@@ -952,7 +1223,7 @@ module Aws::KMS
952
1223
  # resp.key_metadata.creation_date #=> Time
953
1224
  # resp.key_metadata.enabled #=> Boolean
954
1225
  # resp.key_metadata.description #=> String
955
- # resp.key_metadata.key_usage #=> String, one of "ENCRYPT_DECRYPT"
1226
+ # resp.key_metadata.key_usage #=> String, one of "SIGN_VERIFY", "ENCRYPT_DECRYPT"
956
1227
  # resp.key_metadata.key_state #=> String, one of "Enabled", "Disabled", "PendingDeletion", "PendingImport", "Unavailable"
957
1228
  # resp.key_metadata.deletion_date #=> Time
958
1229
  # resp.key_metadata.valid_to #=> Time
@@ -961,6 +1232,11 @@ module Aws::KMS
961
1232
  # resp.key_metadata.cloud_hsm_cluster_id #=> String
962
1233
  # resp.key_metadata.expiration_model #=> String, one of "KEY_MATERIAL_EXPIRES", "KEY_MATERIAL_DOES_NOT_EXPIRE"
963
1234
  # resp.key_metadata.key_manager #=> String, one of "AWS", "CUSTOMER"
1235
+ # resp.key_metadata.customer_master_key_spec #=> String, one of "RSA_2048", "RSA_3072", "RSA_4096", "ECC_NIST_P256", "ECC_NIST_P384", "ECC_NIST_P521", "ECC_SECG_P256K1", "SYMMETRIC_DEFAULT"
1236
+ # resp.key_metadata.encryption_algorithms #=> Array
1237
+ # resp.key_metadata.encryption_algorithms[0] #=> String, one of "SYMMETRIC_DEFAULT", "RSAES_OAEP_SHA_1", "RSAES_OAEP_SHA_256"
1238
+ # resp.key_metadata.signing_algorithms #=> Array
1239
+ # resp.key_metadata.signing_algorithms[0] #=> String, one of "RSASSA_PSS_SHA_256", "RSASSA_PSS_SHA_384", "RSASSA_PSS_SHA_512", "RSASSA_PKCS1_V1_5_SHA_256", "RSASSA_PKCS1_V1_5_SHA_384", "RSASSA_PKCS1_V1_5_SHA_512", "ECDSA_SHA_256", "ECDSA_SHA_384", "ECDSA_SHA_512"
964
1240
  #
965
1241
  # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateKey AWS API Documentation
966
1242
  #
@@ -971,39 +1247,79 @@ module Aws::KMS
971
1247
  req.send_request(options)
972
1248
  end
973
1249
 
974
- # Decrypts ciphertext. Ciphertext is plaintext that has been previously
975
- # encrypted by using any of the following operations:
1250
+ # Decrypts ciphertext that was encrypted by a AWS KMS customer master
1251
+ # key (CMK) using any of the following operations:
1252
+ #
1253
+ # * Encrypt
976
1254
  #
977
1255
  # * GenerateDataKey
978
1256
  #
1257
+ # * GenerateDataKeyPair
1258
+ #
979
1259
  # * GenerateDataKeyWithoutPlaintext
980
1260
  #
981
- # * Encrypt
1261
+ # * GenerateDataKeyPairWithoutPlaintext
1262
+ #
1263
+ # You can use this operation to decrypt ciphertext that was encrypted
1264
+ # under a symmetric or asymmetric CMK. When the CMK is asymmetric, you
1265
+ # must specify the CMK and the encryption algorithm that was used to
1266
+ # encrypt the ciphertext. For information about symmetric and asymmetric
1267
+ # CMKs, see [Using Symmetric and Asymmetric CMKs][1] in the *AWS Key
1268
+ # Management Service Developer Guide*.
1269
+ #
1270
+ # The Decrypt operation also decrypts ciphertext that was encrypted
1271
+ # outside of AWS KMS by the public key in an AWS KMS asymmetric CMK.
1272
+ # However, it cannot decrypt ciphertext produced by other libraries,
1273
+ # such as the [AWS Encryption SDK][2] or [Amazon S3 client-side
1274
+ # encryption][3]. These libraries return a ciphertext format that is
1275
+ # incompatible with AWS KMS.
1276
+ #
1277
+ # If the ciphertext was encrypted under a symmetric CMK, you do not need
1278
+ # to specify the CMK or the encryption algorithm. AWS KMS can get this
1279
+ # information from metadata that it adds to the symmetric ciphertext
1280
+ # blob. However, if you prefer, you can specify the `KeyId` to ensure
1281
+ # that a particular CMK is used to decrypt the ciphertext. If you
1282
+ # specify a different CMK than the one used to encrypt the ciphertext,
1283
+ # the `Decrypt` operation fails.
982
1284
  #
983
1285
  # Whenever possible, use key policies to give users permission to call
984
- # the Decrypt operation on the CMK, instead of IAM policies. Otherwise,
985
- # you might create an IAM user policy that gives the user Decrypt
986
- # permission on all CMKs. This user could decrypt ciphertext that was
987
- # encrypted by CMKs in other accounts if the key policy for the
988
- # cross-account CMK permits it. If you must use an IAM policy for
989
- # `Decrypt` permissions, limit the user to particular CMKs or particular
990
- # trusted accounts.
991
- #
992
- # The result of this operation varies with the key state of the CMK. For
993
- # details, see [How Key State Affects Use of a Customer Master Key][1]
994
- # in the *AWS Key Management Service Developer Guide*.
1286
+ # the Decrypt operation on a particular CMK, instead of using IAM
1287
+ # policies. Otherwise, you might create an IAM user policy that gives
1288
+ # the user Decrypt permission on all CMKs. This user could decrypt
1289
+ # ciphertext that was encrypted by CMKs in other accounts if the key
1290
+ # policy for the cross-account CMK permits it. If you must use an IAM
1291
+ # policy for `Decrypt` permissions, limit the user to particular CMKs or
1292
+ # particular trusted accounts.
995
1293
  #
1294
+ # The CMK that you use for this operation must be in a compatible key
1295
+ # state. For details, see [How Key State Affects Use of a Customer
1296
+ # Master Key][4] in the *AWS Key Management Service Developer Guide*.
996
1297
  #
997
1298
  #
998
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
1299
+ #
1300
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html
1301
+ # [2]: https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/
1302
+ # [3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html
1303
+ # [4]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
999
1304
  #
1000
1305
  # @option params [required, String, IO] :ciphertext_blob
1001
1306
  # Ciphertext to be decrypted. The blob includes metadata.
1002
1307
  #
1003
1308
  # @option params [Hash<String,String>] :encryption_context
1004
- # The encryption context. If this was specified in the Encrypt function,
1005
- # it must be specified here or the decryption operation will fail. For
1006
- # more information, see [Encryption Context][1].
1309
+ # Specifies the encryption context to use when decrypting the data. An
1310
+ # encryption context is valid only for cryptographic operations with a
1311
+ # symmetric CMK. The standard asymmetric encryption algorithms that AWS
1312
+ # KMS uses do not support an encryption context.
1313
+ #
1314
+ # An *encryption context* is a collection of non-secret key-value pairs
1315
+ # that represents additional authenticated data. When you use an
1316
+ # encryption context to encrypt data, you must specify the same (an
1317
+ # exact case-sensitive match) encryption context to decrypt the data. An
1318
+ # encryption context is optional when encrypting with a symmetric CMK,
1319
+ # but it is highly recommended.
1320
+ #
1321
+ # For more information, see [Encryption Context][1] in the *AWS Key
1322
+ # Management Service Developer Guide*.
1007
1323
  #
1008
1324
  #
1009
1325
  #
@@ -1019,10 +1335,54 @@ module Aws::KMS
1019
1335
  #
1020
1336
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
1021
1337
  #
1338
+ # @option params [String] :key_id
1339
+ # Specifies the customer master key (CMK) that AWS KMS will use to
1340
+ # decrypt the ciphertext. Enter a key ID of the CMK that was used to
1341
+ # encrypt the ciphertext.
1342
+ #
1343
+ # If you specify a `KeyId` value, the `Decrypt` operation succeeds only
1344
+ # if the specified CMK was used to encrypt the ciphertext.
1345
+ #
1346
+ # This parameter is required only when the ciphertext was encrypted
1347
+ # under an asymmetric CMK. Otherwise, AWS KMS uses the metadata that it
1348
+ # adds to the ciphertext blob to determine which CMK was used to encrypt
1349
+ # the ciphertext. However, you can use this parameter to ensure that a
1350
+ # particular CMK (of any kind) is used to decrypt the ciphertext.
1351
+ #
1352
+ # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
1353
+ # name, or alias ARN. When using an alias name, prefix it with
1354
+ # `"alias/"`.
1355
+ #
1356
+ # For example:
1357
+ #
1358
+ # * Key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
1359
+ #
1360
+ # * Key ARN:
1361
+ # `arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
1362
+ #
1363
+ # * Alias name: `alias/ExampleAlias`
1364
+ #
1365
+ # * Alias ARN: `arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias`
1366
+ #
1367
+ # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
1368
+ # To get the alias name and alias ARN, use ListAliases.
1369
+ #
1370
+ # @option params [String] :encryption_algorithm
1371
+ # Specifies the encryption algorithm that will be used to decrypt the
1372
+ # ciphertext. Specify the same algorithm that was used to encrypt the
1373
+ # data. If you specify a different algorithm, the `Decrypt` operation
1374
+ # fails.
1375
+ #
1376
+ # This parameter is required only when the ciphertext was encrypted
1377
+ # under an asymmetric CMK. The default value, `SYMMETRIC_DEFAULT`,
1378
+ # represents the only supported algorithm that is valid for symmetric
1379
+ # CMKs.
1380
+ #
1022
1381
  # @return [Types::DecryptResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1023
1382
  #
1024
1383
  # * {Types::DecryptResponse#key_id #key_id} => String
1025
1384
  # * {Types::DecryptResponse#plaintext #plaintext} => String
1385
+ # * {Types::DecryptResponse#encryption_algorithm #encryption_algorithm} => String
1026
1386
  #
1027
1387
  #
1028
1388
  # @example Example: To decrypt data
@@ -1047,12 +1407,15 @@ module Aws::KMS
1047
1407
  # "EncryptionContextKey" => "EncryptionContextValue",
1048
1408
  # },
1049
1409
  # grant_tokens: ["GrantTokenType"],
1410
+ # key_id: "KeyIdType",
1411
+ # encryption_algorithm: "SYMMETRIC_DEFAULT", # accepts SYMMETRIC_DEFAULT, RSAES_OAEP_SHA_1, RSAES_OAEP_SHA_256
1050
1412
  # })
1051
1413
  #
1052
1414
  # @example Response structure
1053
1415
  #
1054
1416
  # resp.key_id #=> String
1055
1417
  # resp.plaintext #=> String
1418
+ # resp.encryption_algorithm #=> String, one of "SYMMETRIC_DEFAULT", "RSAES_OAEP_SHA_1", "RSAES_OAEP_SHA_256"
1056
1419
  #
1057
1420
  # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Decrypt AWS API Documentation
1058
1421
  #
@@ -1178,9 +1541,9 @@ module Aws::KMS
1178
1541
  # After you delete key material, you can use ImportKeyMaterial to
1179
1542
  # reimport the same key material into the CMK.
1180
1543
  #
1181
- # The result of this operation varies with the key state of the CMK. For
1182
- # details, see [How Key State Affects Use of a Customer Master Key][2]
1183
- # in the *AWS Key Management Service Developer Guide*.
1544
+ # The CMK that you use for this operation must be in a compatible key
1545
+ # state. For details, see [How Key State Affects Use of a Customer
1546
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
1184
1547
  #
1185
1548
  #
1186
1549
  #
@@ -1314,7 +1677,7 @@ module Aws::KMS
1314
1677
  # resp.custom_key_stores[0].cloud_hsm_cluster_id #=> String
1315
1678
  # resp.custom_key_stores[0].trust_anchor_certificate #=> String
1316
1679
  # resp.custom_key_stores[0].connection_state #=> String, one of "CONNECTED", "CONNECTING", "FAILED", "DISCONNECTED", "DISCONNECTING"
1317
- # resp.custom_key_stores[0].connection_error_code #=> String, one of "INVALID_CREDENTIALS", "CLUSTER_NOT_FOUND", "NETWORK_ERRORS", "INTERNAL_ERROR", "INSUFFICIENT_CLOUDHSM_HSMS", "USER_LOCKED_OUT"
1680
+ # resp.custom_key_stores[0].connection_error_code #=> String, one of "INVALID_CREDENTIALS", "CLUSTER_NOT_FOUND", "NETWORK_ERRORS", "INTERNAL_ERROR", "INSUFFICIENT_CLOUDHSM_HSMS", "USER_LOCKED_OUT", "USER_NOT_FOUND", "USER_LOGGED_IN", "SUBNET_NOT_FOUND"
1318
1681
  # resp.custom_key_stores[0].creation_date #=> Time
1319
1682
  # resp.next_marker #=> String
1320
1683
  # resp.truncated #=> Boolean
@@ -1328,20 +1691,50 @@ module Aws::KMS
1328
1691
  req.send_request(options)
1329
1692
  end
1330
1693
 
1331
- # Provides detailed information about the specified customer master key
1332
- # (CMK).
1694
+ # Provides detailed information about a customer master key (CMK). You
1695
+ # can run `DescribeKey` on a [customer managed CMK][1] or an [AWS
1696
+ # managed CMK][2].
1697
+ #
1698
+ # This detailed information includes the key ARN, creation date (and
1699
+ # deletion date, if applicable), the key state, and the origin and
1700
+ # expiration date (if any) of the key material. For CMKs in custom key
1701
+ # stores, it includes information about the custom key store, such as
1702
+ # the key store ID and the AWS CloudHSM cluster ID. It includes fields,
1703
+ # like `KeySpec`, that help you distinguish symmetric from asymmetric
1704
+ # CMKs. It also provides information that is particularly important to
1705
+ # asymmetric CMKs, such as the key usage (encryption or signing) and the
1706
+ # encryption algorithms or signing algorithms that the CMK supports.
1707
+ #
1708
+ # `DescribeKey` does not return the following information:
1709
+ #
1710
+ # * Aliases associated with the CMK. To get this information, use
1711
+ # ListAliases.
1712
+ #
1713
+ # * Whether automatic key rotation is enabled on the CMK. To get this
1714
+ # information, use GetKeyRotationStatus. Also, some key states prevent
1715
+ # a CMK from being automatically rotated. For details, see [How
1716
+ # Automatic Key Rotation Works][3] in *AWS Key Management Service
1717
+ # Developer Guide*.
1333
1718
  #
1334
- # You can use `DescribeKey` on a predefined AWS alias, that is, an AWS
1335
- # alias with no key ID. When you do, AWS KMS associates the alias with
1336
- # an [AWS managed CMK][1] and returns its `KeyId` and `Arn` in the
1337
- # response.
1719
+ # * Tags on the CMK. To get this information, use ListResourceTags.
1720
+ #
1721
+ # * Key policies and grants on the CMK. To get this information, use
1722
+ # GetKeyPolicy and ListGrants.
1723
+ #
1724
+ # If you call the `DescribeKey` operation on a *predefined AWS alias*,
1725
+ # that is, an AWS alias with no key ID, AWS KMS creates an [AWS managed
1726
+ # CMK][4]. Then, it associates the alias with the new CMK, and returns
1727
+ # the `KeyId` and `Arn` of the new CMK in the response.
1338
1728
  #
1339
1729
  # To perform this operation on a CMK in a different AWS account, specify
1340
1730
  # the key ARN or alias ARN in the value of the KeyId parameter.
1341
1731
  #
1342
1732
  #
1343
1733
  #
1344
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys
1734
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk
1735
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk
1736
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotate-keys-how-it-works
1737
+ # [4]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys
1345
1738
  #
1346
1739
  # @option params [required, String] :key_id
1347
1740
  # Describes the specified customer master key (CMK).
@@ -1427,7 +1820,7 @@ module Aws::KMS
1427
1820
  # resp.key_metadata.creation_date #=> Time
1428
1821
  # resp.key_metadata.enabled #=> Boolean
1429
1822
  # resp.key_metadata.description #=> String
1430
- # resp.key_metadata.key_usage #=> String, one of "ENCRYPT_DECRYPT"
1823
+ # resp.key_metadata.key_usage #=> String, one of "SIGN_VERIFY", "ENCRYPT_DECRYPT"
1431
1824
  # resp.key_metadata.key_state #=> String, one of "Enabled", "Disabled", "PendingDeletion", "PendingImport", "Unavailable"
1432
1825
  # resp.key_metadata.deletion_date #=> Time
1433
1826
  # resp.key_metadata.valid_to #=> Time
@@ -1436,6 +1829,11 @@ module Aws::KMS
1436
1829
  # resp.key_metadata.cloud_hsm_cluster_id #=> String
1437
1830
  # resp.key_metadata.expiration_model #=> String, one of "KEY_MATERIAL_EXPIRES", "KEY_MATERIAL_DOES_NOT_EXPIRE"
1438
1831
  # resp.key_metadata.key_manager #=> String, one of "AWS", "CUSTOMER"
1832
+ # resp.key_metadata.customer_master_key_spec #=> String, one of "RSA_2048", "RSA_3072", "RSA_4096", "ECC_NIST_P256", "ECC_NIST_P384", "ECC_NIST_P521", "ECC_SECG_P256K1", "SYMMETRIC_DEFAULT"
1833
+ # resp.key_metadata.encryption_algorithms #=> Array
1834
+ # resp.key_metadata.encryption_algorithms[0] #=> String, one of "SYMMETRIC_DEFAULT", "RSAES_OAEP_SHA_1", "RSAES_OAEP_SHA_256"
1835
+ # resp.key_metadata.signing_algorithms #=> Array
1836
+ # resp.key_metadata.signing_algorithms[0] #=> String, one of "RSASSA_PSS_SHA_256", "RSASSA_PSS_SHA_384", "RSASSA_PSS_SHA_512", "RSASSA_PKCS1_V1_5_SHA_256", "RSASSA_PKCS1_V1_5_SHA_384", "RSASSA_PKCS1_V1_5_SHA_512", "ECDSA_SHA_256", "ECDSA_SHA_384", "ECDSA_SHA_512"
1439
1837
  #
1440
1838
  # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeKey AWS API Documentation
1441
1839
  #
@@ -1454,9 +1852,9 @@ module Aws::KMS
1454
1852
  # [How Key State Affects the Use of a Customer Master Key][1] in the <i>
1455
1853
  # <i>AWS Key Management Service Developer Guide</i> </i>.
1456
1854
  #
1457
- # The result of this operation varies with the key state of the CMK. For
1458
- # details, see [How Key State Affects Use of a Customer Master Key][1]
1459
- # in the *AWS Key Management Service Developer Guide*.
1855
+ # The CMK that you use for this operation must be in a compatible key
1856
+ # state. For details, see [How Key State Affects Use of a Customer
1857
+ # Master Key][1] in the *AWS Key Management Service Developer Guide*.
1460
1858
  #
1461
1859
  #
1462
1860
  #
@@ -1503,20 +1901,26 @@ module Aws::KMS
1503
1901
  end
1504
1902
 
1505
1903
  # Disables [automatic rotation of the key material][1] for the specified
1506
- # customer master key (CMK). You cannot perform this operation on a CMK
1507
- # in a different AWS account.
1904
+ # symmetric customer master key (CMK).
1508
1905
  #
1509
- # The result of this operation varies with the key state of the CMK. For
1510
- # details, see [How Key State Affects Use of a Customer Master Key][2]
1511
- # in the *AWS Key Management Service Developer Guide*.
1906
+ # You cannot enable automatic rotation of asymmetric CMKs, CMKs with
1907
+ # imported key material, or CMKs in a [custom key store][2]. You cannot
1908
+ # perform this operation on a CMK in a different AWS account.
1909
+ #
1910
+ # The CMK that you use for this operation must be in a compatible key
1911
+ # state. For details, see [How Key State Affects Use of a Customer
1912
+ # Master Key][3] in the *AWS Key Management Service Developer Guide*.
1512
1913
  #
1513
1914
  #
1514
1915
  #
1515
1916
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html
1516
- # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
1917
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html
1918
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
1517
1919
  #
1518
1920
  # @option params [required, String] :key_id
1519
- # A unique identifier for the customer master key (CMK).
1921
+ # Identifies a symmetric customer master key (CMK). You cannot enable
1922
+ # automatic rotation of [asymmetric CMKs][1], CMKs with [imported key
1923
+ # material][2], or CMKs in a [custom key store][3].
1520
1924
  #
1521
1925
  # Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
1522
1926
  #
@@ -1529,6 +1933,12 @@ module Aws::KMS
1529
1933
  #
1530
1934
  # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
1531
1935
  #
1936
+ #
1937
+ #
1938
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html#asymmetric-cmks
1939
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html
1940
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html
1941
+ #
1532
1942
  # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
1533
1943
  #
1534
1944
  #
@@ -1611,9 +2021,9 @@ module Aws::KMS
1611
2021
  # allows you to use the CMK for cryptographic operations. You cannot
1612
2022
  # perform this operation on a CMK in a different AWS account.
1613
2023
  #
1614
- # The result of this operation varies with the key state of the CMK. For
1615
- # details, see [How Key State Affects Use of a Customer Master Key][1]
1616
- # in the *AWS Key Management Service Developer Guide*.
2024
+ # The CMK that you use for this operation must be in a compatible key
2025
+ # state. For details, see [How Key State Affects Use of a Customer
2026
+ # Master Key][1] in the *AWS Key Management Service Developer Guide*.
1617
2027
  #
1618
2028
  #
1619
2029
  #
@@ -1660,15 +2070,15 @@ module Aws::KMS
1660
2070
  end
1661
2071
 
1662
2072
  # Enables [automatic rotation of the key material][1] for the specified
1663
- # customer master key (CMK). You cannot perform this operation on a CMK
1664
- # in a different AWS account.
2073
+ # symmetric customer master key (CMK). You cannot perform this operation
2074
+ # on a CMK in a different AWS account.
1665
2075
  #
1666
- # You cannot enable automatic rotation of CMKs with imported key
1667
- # material or CMKs in a [custom key store][2].
2076
+ # You cannot enable automatic rotation of asymmetric CMKs, CMKs with
2077
+ # imported key material, or CMKs in a [custom key store][2].
1668
2078
  #
1669
- # The result of this operation varies with the key state of the CMK. For
1670
- # details, see [How Key State Affects Use of a Customer Master Key][3]
1671
- # in the *AWS Key Management Service Developer Guide*.
2079
+ # The CMK that you use for this operation must be in a compatible key
2080
+ # state. For details, see [How Key State Affects Use of a Customer
2081
+ # Master Key][3] in the *AWS Key Management Service Developer Guide*.
1672
2082
  #
1673
2083
  #
1674
2084
  #
@@ -1677,7 +2087,9 @@ module Aws::KMS
1677
2087
  # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
1678
2088
  #
1679
2089
  # @option params [required, String] :key_id
1680
- # A unique identifier for the customer master key (CMK).
2090
+ # Identifies a symmetric customer master key (CMK). You cannot enable
2091
+ # automatic rotation of asymmetric CMKs, CMKs with imported key
2092
+ # material, or CMKs in a [custom key store][1].
1681
2093
  #
1682
2094
  # Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
1683
2095
  #
@@ -1690,6 +2102,10 @@ module Aws::KMS
1690
2102
  #
1691
2103
  # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
1692
2104
  #
2105
+ #
2106
+ #
2107
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html
2108
+ #
1693
2109
  # @return [Struct] Returns an empty {Seahorse::Client::Response response}.
1694
2110
  #
1695
2111
  #
@@ -1719,9 +2135,8 @@ module Aws::KMS
1719
2135
  # Encrypts plaintext into ciphertext by using a customer master key
1720
2136
  # (CMK). The `Encrypt` operation has two primary use cases:
1721
2137
  #
1722
- # * You can encrypt up to 4 kilobytes (4096 bytes) of arbitrary data
1723
- # such as an RSA key, a database password, or other sensitive
1724
- # information.
2138
+ # * You can encrypt small amounts of arbitrary data, such as a personal
2139
+ # identifier or database password, or other sensitive information.
1725
2140
  #
1726
2141
  # * You can use the `Encrypt` operation to move encrypted data from one
1727
2142
  # AWS region to another. In the first region, generate a data key and
@@ -1730,24 +2145,76 @@ module Aws::KMS
1730
2145
  # safely move the encrypted data and encrypted data key to the new
1731
2146
  # region, and decrypt in the new region when necessary.
1732
2147
  #
1733
- # You don't need use this operation to encrypt a data key within a
1734
- # region. The GenerateDataKey and GenerateDataKeyWithoutPlaintext
1735
- # operations return an encrypted data key.
2148
+ # You don't need to use the `Encrypt` operation to encrypt a data key.
2149
+ # The GenerateDataKey and GenerateDataKeyPair operations return a
2150
+ # plaintext data key and an encrypted copy of that data key.
1736
2151
  #
1737
- # Also, you don't need to use this operation to encrypt data in your
1738
- # application. You can use the plaintext and encrypted data keys that
1739
- # the `GenerateDataKey` operation returns.
2152
+ # When you encrypt data, you must specify a symmetric or asymmetric CMK
2153
+ # to use in the encryption operation. The CMK must have a `KeyUsage`
2154
+ # value of `ENCRYPT_DECRYPT.` To find the `KeyUsage` of a CMK, use the
2155
+ # DescribeKey operation.
1740
2156
  #
1741
- # The result of this operation varies with the key state of the CMK. For
1742
- # details, see [How Key State Affects Use of a Customer Master Key][1]
1743
- # in the *AWS Key Management Service Developer Guide*.
2157
+ # If you use a symmetric CMK, you can use an encryption context to add
2158
+ # additional security to your encryption operation. If you specify an
2159
+ # `EncryptionContext` when encrypting data, you must specify the same
2160
+ # encryption context (a case-sensitive exact match) when decrypting the
2161
+ # data. Otherwise, the request to decrypt fails with an
2162
+ # `InvalidCiphertextException`. For more information, see [Encryption
2163
+ # Context][1] in the *AWS Key Management Service Developer Guide*.
2164
+ #
2165
+ # If you specify an asymmetric CMK, you must also specify the encryption
2166
+ # algorithm. The algorithm must be compatible with the CMK type.
2167
+ #
2168
+ # When you use an asymmetric CMK to encrypt or reencrypt data, be sure
2169
+ # to record the CMK and encryption algorithm that you choose. You will
2170
+ # be required to provide the same CMK and encryption algorithm when you
2171
+ # decrypt the data. If the CMK and algorithm do not match the values
2172
+ # used to encrypt the data, the decrypt operation fails.
2173
+ #
2174
+ # You are not required to supply the CMK ID and encryption algorithm
2175
+ # when you decrypt with symmetric CMKs because AWS KMS stores this
2176
+ # information in the ciphertext blob. AWS KMS cannot store metadata in
2177
+ # ciphertext generated with asymmetric keys. The standard format for
2178
+ # asymmetric key ciphertext does not include configurable fields.
2179
+ #
2180
+ # The maximum size of the data that you can encrypt varies with the type
2181
+ # of CMK and the encryption algorithm that you choose.
2182
+ #
2183
+ # * Symmetric CMKs
2184
+ #
2185
+ # * `SYMMETRIC_DEFAULT`\: 4096 bytes
2186
+ #
2187
+ # ^
2188
+ #
2189
+ # * `RSA_2048`
2190
+ #
2191
+ # * `RSAES_OAEP_SHA_1`\: 214 bytes
2192
+ #
2193
+ # * `RSAES_OAEP_SHA_256`\: 190 bytes
2194
+ #
2195
+ # * `RSA_3072`
2196
+ #
2197
+ # * `RSAES_OAEP_SHA_1`\: 342 bytes
2198
+ #
2199
+ # * `RSAES_OAEP_SHA_256`\: 318 bytes
2200
+ #
2201
+ # * `RSA_4096`
2202
+ #
2203
+ # * `RSAES_OAEP_SHA_1`\: 470 bytes
2204
+ #
2205
+ # * `RSAES_OAEP_SHA_256`\: 446 bytes
2206
+ #
2207
+ # The CMK that you use for this operation must be in a compatible key
2208
+ # state. For details, see [How Key State Affects Use of a Customer
2209
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
1744
2210
  #
1745
2211
  # To perform this operation on a CMK in a different AWS account, specify
1746
2212
  # the key ARN or alias ARN in the value of the KeyId parameter.
1747
2213
  #
1748
2214
  #
1749
2215
  #
1750
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
2216
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
2217
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
1751
2218
  #
1752
2219
  # @option params [required, String] :key_id
1753
2220
  # A unique identifier for the customer master key (CMK).
@@ -1775,10 +2242,20 @@ module Aws::KMS
1775
2242
  # Data to be encrypted.
1776
2243
  #
1777
2244
  # @option params [Hash<String,String>] :encryption_context
1778
- # Name-value pair that specifies the encryption context to be used for
1779
- # authenticated encryption. If used here, the same value must be
1780
- # supplied to the `Decrypt` API or decryption will fail. For more
1781
- # information, see [Encryption Context][1].
2245
+ # Specifies the encryption context that will be used to encrypt the
2246
+ # data. An encryption context is valid only for cryptographic operations
2247
+ # with a symmetric CMK. The standard asymmetric encryption algorithms
2248
+ # that AWS KMS uses do not support an encryption context.
2249
+ #
2250
+ # An *encryption context* is a collection of non-secret key-value pairs
2251
+ # that represents additional authenticated data. When you use an
2252
+ # encryption context to encrypt data, you must specify the same (an
2253
+ # exact case-sensitive match) encryption context to decrypt the data. An
2254
+ # encryption context is optional when encrypting with a symmetric CMK,
2255
+ # but it is highly recommended.
2256
+ #
2257
+ # For more information, see [Encryption Context][1] in the *AWS Key
2258
+ # Management Service Developer Guide*.
1782
2259
  #
1783
2260
  #
1784
2261
  #
@@ -1794,10 +2271,21 @@ module Aws::KMS
1794
2271
  #
1795
2272
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
1796
2273
  #
2274
+ # @option params [String] :encryption_algorithm
2275
+ # Specifies the encryption algorithm that AWS KMS will use to encrypt
2276
+ # the plaintext message. The algorithm must be compatible with the CMK
2277
+ # that you specify.
2278
+ #
2279
+ # This parameter is required only for asymmetric CMKs. The default
2280
+ # value, `SYMMETRIC_DEFAULT`, is the algorithm used for symmetric CMKs.
2281
+ # If you are using an asymmetric CMK, we recommend
2282
+ # RSAES\_OAEP\_SHA\_256.
2283
+ #
1797
2284
  # @return [Types::EncryptResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
1798
2285
  #
1799
2286
  # * {Types::EncryptResponse#ciphertext_blob #ciphertext_blob} => String
1800
2287
  # * {Types::EncryptResponse#key_id #key_id} => String
2288
+ # * {Types::EncryptResponse#encryption_algorithm #encryption_algorithm} => String
1801
2289
  #
1802
2290
  #
1803
2291
  # @example Example: To encrypt data
@@ -1824,12 +2312,14 @@ module Aws::KMS
1824
2312
  # "EncryptionContextKey" => "EncryptionContextValue",
1825
2313
  # },
1826
2314
  # grant_tokens: ["GrantTokenType"],
2315
+ # encryption_algorithm: "SYMMETRIC_DEFAULT", # accepts SYMMETRIC_DEFAULT, RSAES_OAEP_SHA_1, RSAES_OAEP_SHA_256
1827
2316
  # })
1828
2317
  #
1829
2318
  # @example Response structure
1830
2319
  #
1831
2320
  # resp.ciphertext_blob #=> String
1832
2321
  # resp.key_id #=> String
2322
+ # resp.encryption_algorithm #=> String, one of "SYMMETRIC_DEFAULT", "RSAES_OAEP_SHA_1", "RSAES_OAEP_SHA_256"
1833
2323
  #
1834
2324
  # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Encrypt AWS API Documentation
1835
2325
  #
@@ -1840,27 +2330,45 @@ module Aws::KMS
1840
2330
  req.send_request(options)
1841
2331
  end
1842
2332
 
1843
- # Generates a unique data key. This operation returns a plaintext copy
1844
- # of the data key and a copy that is encrypted under a customer master
1845
- # key (CMK) that you specify. You can use the plaintext key to encrypt
1846
- # your data outside of KMS and store the encrypted data key with the
1847
- # encrypted data.
2333
+ # Generates a unique symmetric data key. This operation returns a
2334
+ # plaintext copy of the data key and a copy that is encrypted under a
2335
+ # customer master key (CMK) that you specify. You can use the plaintext
2336
+ # key to encrypt your data outside of AWS KMS and store the encrypted
2337
+ # data key with the encrypted data.
1848
2338
  #
1849
2339
  # `GenerateDataKey` returns a unique data key for each request. The
1850
2340
  # bytes in the key are not related to the caller or CMK that is used to
1851
2341
  # encrypt the data key.
1852
2342
  #
1853
- # To generate a data key, you need to specify the customer master key
1854
- # (CMK) that will be used to encrypt the data key. You must also specify
1855
- # the length of the data key using either the `KeySpec` or
1856
- # `NumberOfBytes` field (but not both). For common key lengths (128-bit
1857
- # and 256-bit symmetric keys), we recommend that you use `KeySpec`. To
1858
- # perform this operation on a CMK in a different AWS account, specify
1859
- # the key ARN or alias ARN in the value of the KeyId parameter.
2343
+ # To generate a data key, specify the symmetric CMK that will be used to
2344
+ # encrypt the data key. You cannot use an asymmetric CMK to generate
2345
+ # data keys. To get the type of your CMK, use the DescribeKey operation.
2346
+ #
2347
+ # You must also specify the length of the data key. Use either the
2348
+ # `KeySpec` or `NumberOfBytes` parameters (but not both). For 128-bit
2349
+ # and 256-bit data keys, use the `KeySpec` parameter.
1860
2350
  #
1861
- # You will find the plaintext copy of the data key in the `Plaintext`
1862
- # field of the response, and the encrypted copy of the data key in the
1863
- # `CiphertextBlob` field.
2351
+ # If the operation succeeds, the plaintext copy of the data key is in
2352
+ # the `Plaintext` field of the response, and the encrypted copy of the
2353
+ # data key in the `CiphertextBlob` field.
2354
+ #
2355
+ # To get only an encrypted copy of the data key, use
2356
+ # GenerateDataKeyWithoutPlaintext. To generate an asymmetric data key
2357
+ # pair, use the GenerateDataKeyPair or
2358
+ # GenerateDataKeyPairWithoutPlaintext operation. To get a
2359
+ # cryptographically secure random byte string, use GenerateRandom.
2360
+ #
2361
+ # You can use the optional encryption context to add additional security
2362
+ # to the encryption operation. If you specify an `EncryptionContext`,
2363
+ # you must specify the same encryption context (a case-sensitive exact
2364
+ # match) when decrypting the encrypted data key. Otherwise, the request
2365
+ # to decrypt fails with an InvalidCiphertextException. For more
2366
+ # information, see [Encryption Context][1] in the *AWS Key Management
2367
+ # Service Developer Guide*.
2368
+ #
2369
+ # The CMK that you use for this operation must be in a compatible key
2370
+ # state. For details, see [How Key State Affects Use of a Customer
2371
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
1864
2372
  #
1865
2373
  # We recommend that you use the following pattern to encrypt data
1866
2374
  # locally in your application:
@@ -1882,30 +2390,13 @@ module Aws::KMS
1882
2390
  # 2. Use the plaintext data key to decrypt data locally, then erase the
1883
2391
  # plaintext data key from memory.
1884
2392
  #
1885
- # To get only an encrypted copy of the data key, use
1886
- # GenerateDataKeyWithoutPlaintext. To get a cryptographically secure
1887
- # random byte string, use GenerateRandom.
1888
- #
1889
- # You can use the optional encryption context to add additional security
1890
- # to your encryption operation. When you specify an `EncryptionContext`
1891
- # in the `GenerateDataKey` operation, you must specify the same
1892
- # encryption context (a case-sensitive exact match) in your request to
1893
- # Decrypt the data key. Otherwise, the request to decrypt fails with an
1894
- # `InvalidCiphertextException`. For more information, see [Encryption
1895
- # Context][1] in the <i> <i>AWS Key Management Service Developer
1896
- # Guide</i> </i>.
1897
- #
1898
- # The result of this operation varies with the key state of the CMK. For
1899
- # details, see [How Key State Affects Use of a Customer Master Key][2]
1900
- # in the *AWS Key Management Service Developer Guide*.
1901
- #
1902
2393
  #
1903
2394
  #
1904
2395
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
1905
2396
  # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
1906
2397
  #
1907
2398
  # @option params [required, String] :key_id
1908
- # An identifier for the CMK that encrypts the data key.
2399
+ # Identifies the symmetric CMK that encrypts the data key.
1909
2400
  #
1910
2401
  # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
1911
2402
  # name, or alias ARN. When using an alias name, prefix it with
@@ -1927,8 +2418,15 @@ module Aws::KMS
1927
2418
  # To get the alias name and alias ARN, use ListAliases.
1928
2419
  #
1929
2420
  # @option params [Hash<String,String>] :encryption_context
1930
- # A set of key-value pairs that represents additional authenticated
1931
- # data.
2421
+ # Specifies the encryption context that will be used when encrypting the
2422
+ # data key.
2423
+ #
2424
+ # An *encryption context* is a collection of non-secret key-value pairs
2425
+ # that represents additional authenticated data. When you use an
2426
+ # encryption context to encrypt data, you must specify the same (an
2427
+ # exact case-sensitive match) encryption context to decrypt the data. An
2428
+ # encryption context is optional when encrypting with a symmetric CMK,
2429
+ # but it is highly recommended.
1932
2430
  #
1933
2431
  # For more information, see [Encryption Context][1] in the *AWS Key
1934
2432
  # Management Service Developer Guide*.
@@ -1938,14 +2436,21 @@ module Aws::KMS
1938
2436
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
1939
2437
  #
1940
2438
  # @option params [Integer] :number_of_bytes
1941
- # The length of the data key in bytes. For example, use the value 64 to
1942
- # generate a 512-bit data key (64 bytes is 512 bits). For common key
1943
- # lengths (128-bit and 256-bit symmetric keys), we recommend that you
1944
- # use the `KeySpec` field instead of this one.
2439
+ # Specifies the length of the data key in bytes. For example, use the
2440
+ # value 64 to generate a 512-bit data key (64 bytes is 512 bits). For
2441
+ # 128-bit (16-byte) and 256-bit (32-byte) data keys, use the `KeySpec`
2442
+ # parameter.
2443
+ #
2444
+ # You must specify either the `KeySpec` or the `NumberOfBytes` parameter
2445
+ # (but not both) in every `GenerateDataKey` request.
1945
2446
  #
1946
2447
  # @option params [String] :key_spec
1947
- # The length of the data key. Use `AES_128` to generate a 128-bit
1948
- # symmetric key, or `AES_256` to generate a 256-bit symmetric key.
2448
+ # Specifies the length of the data key. Use `AES_128` to generate a
2449
+ # 128-bit symmetric key, or `AES_256` to generate a 256-bit symmetric
2450
+ # key.
2451
+ #
2452
+ # You must specify either the `KeySpec` or the `NumberOfBytes` parameter
2453
+ # (but not both) in every `GenerateDataKey` request.
1949
2454
  #
1950
2455
  # @option params [Array<String>] :grant_tokens
1951
2456
  # A list of grant tokens.
@@ -2008,40 +2513,74 @@ module Aws::KMS
2008
2513
  req.send_request(options)
2009
2514
  end
2010
2515
 
2011
- # Generates a unique data key. This operation returns a data key that is
2012
- # encrypted under a customer master key (CMK) that you specify.
2013
- # `GenerateDataKeyWithoutPlaintext` is identical to GenerateDataKey
2014
- # except that returns only the encrypted copy of the data key.
2516
+ # Generates a unique asymmetric data key pair. The `GenerateDataKeyPair`
2517
+ # operation returns a plaintext public key, a plaintext private key, and
2518
+ # a copy of the private key that is encrypted under the symmetric CMK
2519
+ # you specify. You can use the data key pair to perform asymmetric
2520
+ # cryptography outside of AWS KMS.
2521
+ #
2522
+ # `GenerateDataKeyPair` returns a unique data key pair for each request.
2523
+ # The bytes in the keys are not related to the caller or the CMK that is
2524
+ # used to encrypt the private key.
2525
+ #
2526
+ # You can use the public key that `GenerateDataKeyPair` returns to
2527
+ # encrypt data or verify a signature outside of AWS KMS. Then, store the
2528
+ # encrypted private key with the data. When you are ready to decrypt
2529
+ # data or sign a message, you can use the Decrypt operation to decrypt
2530
+ # the encrypted private key.
2531
+ #
2532
+ # To generate a data key pair, you must specify a symmetric customer
2533
+ # master key (CMK) to encrypt the private key in a data key pair. You
2534
+ # cannot use an asymmetric CMK. To get the type of your CMK, use the
2535
+ # DescribeKey operation.
2536
+ #
2537
+ # If you are using the data key pair to encrypt data, or for any
2538
+ # operation where you don't immediately need a private key, consider
2539
+ # using the GenerateDataKeyPairWithoutPlaintext operation.
2540
+ # `GenerateDataKeyPairWithoutPlaintext` returns a plaintext public key
2541
+ # and an encrypted private key, but omits the plaintext private key that
2542
+ # you need only to decrypt ciphertext or sign a message. Later, when you
2543
+ # need to decrypt the data or sign a message, use the Decrypt operation
2544
+ # to decrypt the encrypted private key in the data key pair.
2015
2545
  #
2016
- # Like `GenerateDataKey`, `GenerateDataKeyWithoutPlaintext` returns a
2017
- # unique data key for each request. The bytes in the key are not related
2018
- # to the caller or CMK that is used to encrypt the data key.
2546
+ # You can use the optional encryption context to add additional security
2547
+ # to the encryption operation. If you specify an `EncryptionContext`,
2548
+ # you must specify the same encryption context (a case-sensitive exact
2549
+ # match) when decrypting the encrypted data key. Otherwise, the request
2550
+ # to decrypt fails with an InvalidCiphertextException. For more
2551
+ # information, see [Encryption Context][1] in the *AWS Key Management
2552
+ # Service Developer Guide*.
2019
2553
  #
2020
- # This operation is useful for systems that need to encrypt data at some
2021
- # point, but not immediately. When you need to encrypt the data, you
2022
- # call the Decrypt operation on the encrypted copy of the key.
2554
+ # The CMK that you use for this operation must be in a compatible key
2555
+ # state. For details, see [How Key State Affects Use of a Customer
2556
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
2023
2557
  #
2024
- # It's also useful in distributed systems with different levels of
2025
- # trust. For example, you might store encrypted data in containers. One
2026
- # component of your system creates new containers and stores an
2027
- # encrypted data key with each container. Then, a different component
2028
- # puts the data into the containers. That component first decrypts the
2029
- # data key, uses the plaintext data key to encrypt data, puts the
2030
- # encrypted data into the container, and then destroys the plaintext
2031
- # data key. In this system, the component that creates the containers
2032
- # never sees the plaintext data key.
2033
2558
  #
2034
- # The result of this operation varies with the key state of the CMK. For
2035
- # details, see [How Key State Affects Use of a Customer Master Key][1]
2036
- # in the *AWS Key Management Service Developer Guide*.
2037
2559
  #
2560
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
2561
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
2562
+ #
2563
+ # @option params [Hash<String,String>] :encryption_context
2564
+ # Specifies the encryption context that will be used when encrypting the
2565
+ # private key in the data key pair.
2566
+ #
2567
+ # An *encryption context* is a collection of non-secret key-value pairs
2568
+ # that represents additional authenticated data. When you use an
2569
+ # encryption context to encrypt data, you must specify the same (an
2570
+ # exact case-sensitive match) encryption context to decrypt the data. An
2571
+ # encryption context is optional when encrypting with a symmetric CMK,
2572
+ # but it is highly recommended.
2573
+ #
2574
+ # For more information, see [Encryption Context][1] in the *AWS Key
2575
+ # Management Service Developer Guide*.
2038
2576
  #
2039
2577
  #
2040
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
2578
+ #
2579
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
2041
2580
  #
2042
2581
  # @option params [required, String] :key_id
2043
- # The identifier of the customer master key (CMK) that encrypts the data
2044
- # key.
2582
+ # Specifies the symmetric CMK that encrypts the private key in the data
2583
+ # key pair. You cannot specify an asymmetric CMKs.
2045
2584
  #
2046
2585
  # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
2047
2586
  # name, or alias ARN. When using an alias name, prefix it with
@@ -2062,26 +2601,13 @@ module Aws::KMS
2062
2601
  # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
2063
2602
  # To get the alias name and alias ARN, use ListAliases.
2064
2603
  #
2065
- # @option params [Hash<String,String>] :encryption_context
2066
- # A set of key-value pairs that represents additional authenticated
2067
- # data.
2068
- #
2069
- # For more information, see [Encryption Context][1] in the *AWS Key
2070
- # Management Service Developer Guide*.
2071
- #
2072
- #
2073
- #
2074
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
2075
- #
2076
- # @option params [String] :key_spec
2077
- # The length of the data key. Use `AES_128` to generate a 128-bit
2078
- # symmetric key, or `AES_256` to generate a 256-bit symmetric key.
2604
+ # @option params [required, String] :key_pair_spec
2605
+ # Determines the type of data key pair that is generated.
2079
2606
  #
2080
- # @option params [Integer] :number_of_bytes
2081
- # The length of the data key in bytes. For example, use the value 64 to
2082
- # generate a 512-bit data key (64 bytes is 512 bits). For common key
2083
- # lengths (128-bit and 256-bit symmetric keys), we recommend that you
2084
- # use the `KeySpec` field instead of this one.
2607
+ # The AWS KMS rule that restricts the use of asymmetric RSA CMKs to
2608
+ # encrypt and decrypt or to sign and verify (but not both), and the rule
2609
+ # that permits you to use ECC CMKs only to sign and verify, are not
2610
+ # effective outside of AWS KMS.
2085
2611
  #
2086
2612
  # @option params [Array<String>] :grant_tokens
2087
2613
  # A list of grant tokens.
@@ -2093,24 +2619,302 @@ module Aws::KMS
2093
2619
  #
2094
2620
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
2095
2621
  #
2096
- # @return [Types::GenerateDataKeyWithoutPlaintextResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
2097
- #
2098
- # * {Types::GenerateDataKeyWithoutPlaintextResponse#ciphertext_blob #ciphertext_blob} => String
2099
- # * {Types::GenerateDataKeyWithoutPlaintextResponse#key_id #key_id} => String
2100
- #
2622
+ # @return [Types::GenerateDataKeyPairResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
2101
2623
  #
2102
- # @example Example: To generate an encrypted data key
2624
+ # * {Types::GenerateDataKeyPairResponse#private_key_ciphertext_blob #private_key_ciphertext_blob} => String
2625
+ # * {Types::GenerateDataKeyPairResponse#private_key_plaintext #private_key_plaintext} => String
2626
+ # * {Types::GenerateDataKeyPairResponse#public_key #public_key} => String
2627
+ # * {Types::GenerateDataKeyPairResponse#key_id #key_id} => String
2628
+ # * {Types::GenerateDataKeyPairResponse#key_pair_spec #key_pair_spec} => String
2103
2629
  #
2104
- # # The following example generates an encrypted copy of a 256-bit symmetric data encryption key (data key). The data key is
2105
- # # encrypted with the specified customer master key (CMK).
2630
+ # @example Request syntax with placeholder values
2106
2631
  #
2107
- # resp = client.generate_data_key_without_plaintext({
2108
- # key_id: "alias/ExampleAlias", # The identifier of the CMK to use to encrypt the data key. You can use the key ID or Amazon Resource Name (ARN) of the CMK, or the name or ARN of an alias that refers to the CMK.
2109
- # key_spec: "AES_256", # Specifies the type of data key to return.
2632
+ # resp = client.generate_data_key_pair({
2633
+ # encryption_context: {
2634
+ # "EncryptionContextKey" => "EncryptionContextValue",
2635
+ # },
2636
+ # key_id: "KeyIdType", # required
2637
+ # key_pair_spec: "RSA_2048", # required, accepts RSA_2048, RSA_3072, RSA_4096, ECC_NIST_P256, ECC_NIST_P384, ECC_NIST_P521, ECC_SECG_P256K1
2638
+ # grant_tokens: ["GrantTokenType"],
2110
2639
  # })
2111
2640
  #
2112
- # resp.to_h outputs the following:
2113
- # {
2641
+ # @example Response structure
2642
+ #
2643
+ # resp.private_key_ciphertext_blob #=> String
2644
+ # resp.private_key_plaintext #=> String
2645
+ # resp.public_key #=> String
2646
+ # resp.key_id #=> String
2647
+ # resp.key_pair_spec #=> String, one of "RSA_2048", "RSA_3072", "RSA_4096", "ECC_NIST_P256", "ECC_NIST_P384", "ECC_NIST_P521", "ECC_SECG_P256K1"
2648
+ #
2649
+ # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPair AWS API Documentation
2650
+ #
2651
+ # @overload generate_data_key_pair(params = {})
2652
+ # @param [Hash] params ({})
2653
+ def generate_data_key_pair(params = {}, options = {})
2654
+ req = build_request(:generate_data_key_pair, params)
2655
+ req.send_request(options)
2656
+ end
2657
+
2658
+ # Generates a unique asymmetric data key pair. The
2659
+ # `GenerateDataKeyPairWithoutPlaintext` operation returns a plaintext
2660
+ # public key and a copy of the private key that is encrypted under the
2661
+ # symmetric CMK you specify. Unlike GenerateDataKeyPair, this operation
2662
+ # does not return a plaintext private key.
2663
+ #
2664
+ # To generate a data key pair, you must specify a symmetric customer
2665
+ # master key (CMK) to encrypt the private key in the data key pair. You
2666
+ # cannot use an asymmetric CMK. To get the type of your CMK, use the
2667
+ # `KeySpec` field in the DescribeKey response.
2668
+ #
2669
+ # You can use the public key that `GenerateDataKeyPairWithoutPlaintext`
2670
+ # returns to encrypt data or verify a signature outside of AWS KMS.
2671
+ # Then, store the encrypted private key with the data. When you are
2672
+ # ready to decrypt data or sign a message, you can use the Decrypt
2673
+ # operation to decrypt the encrypted private key.
2674
+ #
2675
+ # `GenerateDataKeyPairWithoutPlaintext` returns a unique data key pair
2676
+ # for each request. The bytes in the key are not related to the caller
2677
+ # or CMK that is used to encrypt the private key.
2678
+ #
2679
+ # You can use the optional encryption context to add additional security
2680
+ # to the encryption operation. If you specify an `EncryptionContext`,
2681
+ # you must specify the same encryption context (a case-sensitive exact
2682
+ # match) when decrypting the encrypted data key. Otherwise, the request
2683
+ # to decrypt fails with an InvalidCiphertextException. For more
2684
+ # information, see [Encryption Context][1] in the *AWS Key Management
2685
+ # Service Developer Guide*.
2686
+ #
2687
+ # The CMK that you use for this operation must be in a compatible key
2688
+ # state. For details, see [How Key State Affects Use of a Customer
2689
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
2690
+ #
2691
+ #
2692
+ #
2693
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
2694
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
2695
+ #
2696
+ # @option params [Hash<String,String>] :encryption_context
2697
+ # Specifies the encryption context that will be used when encrypting the
2698
+ # private key in the data key pair.
2699
+ #
2700
+ # An *encryption context* is a collection of non-secret key-value pairs
2701
+ # that represents additional authenticated data. When you use an
2702
+ # encryption context to encrypt data, you must specify the same (an
2703
+ # exact case-sensitive match) encryption context to decrypt the data. An
2704
+ # encryption context is optional when encrypting with a symmetric CMK,
2705
+ # but it is highly recommended.
2706
+ #
2707
+ # For more information, see [Encryption Context][1] in the *AWS Key
2708
+ # Management Service Developer Guide*.
2709
+ #
2710
+ #
2711
+ #
2712
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
2713
+ #
2714
+ # @option params [required, String] :key_id
2715
+ # Specifies the CMK that encrypts the private key in the data key pair.
2716
+ # You must specify a symmetric CMK. You cannot use an asymmetric CMK. To
2717
+ # get the type of your CMK, use the DescribeKey operation.
2718
+ #
2719
+ # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
2720
+ # name, or alias ARN. When using an alias name, prefix it with
2721
+ # `"alias/"`.
2722
+ #
2723
+ # For example:
2724
+ #
2725
+ # * Key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
2726
+ #
2727
+ # * Key ARN:
2728
+ # `arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
2729
+ #
2730
+ # * Alias name: `alias/ExampleAlias`
2731
+ #
2732
+ # * Alias ARN: `arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias`
2733
+ #
2734
+ # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
2735
+ # To get the alias name and alias ARN, use ListAliases.
2736
+ #
2737
+ # @option params [required, String] :key_pair_spec
2738
+ # Determines the type of data key pair that is generated.
2739
+ #
2740
+ # The AWS KMS rule that restricts the use of asymmetric RSA CMKs to
2741
+ # encrypt and decrypt or to sign and verify (but not both), and the rule
2742
+ # that permits you to use ECC CMKs only to sign and verify, are not
2743
+ # effective outside of AWS KMS.
2744
+ #
2745
+ # @option params [Array<String>] :grant_tokens
2746
+ # A list of grant tokens.
2747
+ #
2748
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
2749
+ # Service Developer Guide*.
2750
+ #
2751
+ #
2752
+ #
2753
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
2754
+ #
2755
+ # @return [Types::GenerateDataKeyPairWithoutPlaintextResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
2756
+ #
2757
+ # * {Types::GenerateDataKeyPairWithoutPlaintextResponse#private_key_ciphertext_blob #private_key_ciphertext_blob} => String
2758
+ # * {Types::GenerateDataKeyPairWithoutPlaintextResponse#public_key #public_key} => String
2759
+ # * {Types::GenerateDataKeyPairWithoutPlaintextResponse#key_id #key_id} => String
2760
+ # * {Types::GenerateDataKeyPairWithoutPlaintextResponse#key_pair_spec #key_pair_spec} => String
2761
+ #
2762
+ # @example Request syntax with placeholder values
2763
+ #
2764
+ # resp = client.generate_data_key_pair_without_plaintext({
2765
+ # encryption_context: {
2766
+ # "EncryptionContextKey" => "EncryptionContextValue",
2767
+ # },
2768
+ # key_id: "KeyIdType", # required
2769
+ # key_pair_spec: "RSA_2048", # required, accepts RSA_2048, RSA_3072, RSA_4096, ECC_NIST_P256, ECC_NIST_P384, ECC_NIST_P521, ECC_SECG_P256K1
2770
+ # grant_tokens: ["GrantTokenType"],
2771
+ # })
2772
+ #
2773
+ # @example Response structure
2774
+ #
2775
+ # resp.private_key_ciphertext_blob #=> String
2776
+ # resp.public_key #=> String
2777
+ # resp.key_id #=> String
2778
+ # resp.key_pair_spec #=> String, one of "RSA_2048", "RSA_3072", "RSA_4096", "ECC_NIST_P256", "ECC_NIST_P384", "ECC_NIST_P521", "ECC_SECG_P256K1"
2779
+ #
2780
+ # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPairWithoutPlaintext AWS API Documentation
2781
+ #
2782
+ # @overload generate_data_key_pair_without_plaintext(params = {})
2783
+ # @param [Hash] params ({})
2784
+ def generate_data_key_pair_without_plaintext(params = {}, options = {})
2785
+ req = build_request(:generate_data_key_pair_without_plaintext, params)
2786
+ req.send_request(options)
2787
+ end
2788
+
2789
+ # Generates a unique symmetric data key. This operation returns a data
2790
+ # key that is encrypted under a customer master key (CMK) that you
2791
+ # specify. To request an asymmetric data key pair, use the
2792
+ # GenerateDataKeyPair or GenerateDataKeyPairWithoutPlaintext operations.
2793
+ #
2794
+ # `GenerateDataKeyWithoutPlaintext` is identical to the GenerateDataKey
2795
+ # operation except that returns only the encrypted copy of the data key.
2796
+ # This operation is useful for systems that need to encrypt data at some
2797
+ # point, but not immediately. When you need to encrypt the data, you
2798
+ # call the Decrypt operation on the encrypted copy of the key.
2799
+ #
2800
+ # It's also useful in distributed systems with different levels of
2801
+ # trust. For example, you might store encrypted data in containers. One
2802
+ # component of your system creates new containers and stores an
2803
+ # encrypted data key with each container. Then, a different component
2804
+ # puts the data into the containers. That component first decrypts the
2805
+ # data key, uses the plaintext data key to encrypt data, puts the
2806
+ # encrypted data into the container, and then destroys the plaintext
2807
+ # data key. In this system, the component that creates the containers
2808
+ # never sees the plaintext data key.
2809
+ #
2810
+ # `GenerateDataKeyWithoutPlaintext` returns a unique data key for each
2811
+ # request. The bytes in the keys are not related to the caller or CMK
2812
+ # that is used to encrypt the private key.
2813
+ #
2814
+ # To generate a data key, you must specify the symmetric customer master
2815
+ # key (CMK) that is used to encrypt the data key. You cannot use an
2816
+ # asymmetric CMK to generate a data key. To get the type of your CMK,
2817
+ # use the DescribeKey operation.
2818
+ #
2819
+ # If the operation succeeds, you will find the encrypted copy of the
2820
+ # data key in the `CiphertextBlob` field.
2821
+ #
2822
+ # You can use the optional encryption context to add additional security
2823
+ # to the encryption operation. If you specify an `EncryptionContext`,
2824
+ # you must specify the same encryption context (a case-sensitive exact
2825
+ # match) when decrypting the encrypted data key. Otherwise, the request
2826
+ # to decrypt fails with an InvalidCiphertextException. For more
2827
+ # information, see [Encryption Context][1] in the *AWS Key Management
2828
+ # Service Developer Guide*.
2829
+ #
2830
+ # The CMK that you use for this operation must be in a compatible key
2831
+ # state. For details, see [How Key State Affects Use of a Customer
2832
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
2833
+ #
2834
+ #
2835
+ #
2836
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
2837
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
2838
+ #
2839
+ # @option params [required, String] :key_id
2840
+ # The identifier of the symmetric customer master key (CMK) that
2841
+ # encrypts the data key.
2842
+ #
2843
+ # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
2844
+ # name, or alias ARN. When using an alias name, prefix it with
2845
+ # `"alias/"`. To specify a CMK in a different AWS account, you must use
2846
+ # the key ARN or alias ARN.
2847
+ #
2848
+ # For example:
2849
+ #
2850
+ # * Key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
2851
+ #
2852
+ # * Key ARN:
2853
+ # `arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
2854
+ #
2855
+ # * Alias name: `alias/ExampleAlias`
2856
+ #
2857
+ # * Alias ARN: `arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias`
2858
+ #
2859
+ # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
2860
+ # To get the alias name and alias ARN, use ListAliases.
2861
+ #
2862
+ # @option params [Hash<String,String>] :encryption_context
2863
+ # Specifies the encryption context that will be used when encrypting the
2864
+ # data key.
2865
+ #
2866
+ # An *encryption context* is a collection of non-secret key-value pairs
2867
+ # that represents additional authenticated data. When you use an
2868
+ # encryption context to encrypt data, you must specify the same (an
2869
+ # exact case-sensitive match) encryption context to decrypt the data. An
2870
+ # encryption context is optional when encrypting with a symmetric CMK,
2871
+ # but it is highly recommended.
2872
+ #
2873
+ # For more information, see [Encryption Context][1] in the *AWS Key
2874
+ # Management Service Developer Guide*.
2875
+ #
2876
+ #
2877
+ #
2878
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
2879
+ #
2880
+ # @option params [String] :key_spec
2881
+ # The length of the data key. Use `AES_128` to generate a 128-bit
2882
+ # symmetric key, or `AES_256` to generate a 256-bit symmetric key.
2883
+ #
2884
+ # @option params [Integer] :number_of_bytes
2885
+ # The length of the data key in bytes. For example, use the value 64 to
2886
+ # generate a 512-bit data key (64 bytes is 512 bits). For common key
2887
+ # lengths (128-bit and 256-bit symmetric keys), we recommend that you
2888
+ # use the `KeySpec` field instead of this one.
2889
+ #
2890
+ # @option params [Array<String>] :grant_tokens
2891
+ # A list of grant tokens.
2892
+ #
2893
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
2894
+ # Service Developer Guide*.
2895
+ #
2896
+ #
2897
+ #
2898
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
2899
+ #
2900
+ # @return [Types::GenerateDataKeyWithoutPlaintextResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
2901
+ #
2902
+ # * {Types::GenerateDataKeyWithoutPlaintextResponse#ciphertext_blob #ciphertext_blob} => String
2903
+ # * {Types::GenerateDataKeyWithoutPlaintextResponse#key_id #key_id} => String
2904
+ #
2905
+ #
2906
+ # @example Example: To generate an encrypted data key
2907
+ #
2908
+ # # The following example generates an encrypted copy of a 256-bit symmetric data encryption key (data key). The data key is
2909
+ # # encrypted with the specified customer master key (CMK).
2910
+ #
2911
+ # resp = client.generate_data_key_without_plaintext({
2912
+ # key_id: "alias/ExampleAlias", # The identifier of the CMK to use to encrypt the data key. You can use the key ID or Amazon Resource Name (ARN) of the CMK, or the name or ARN of an alias that refers to the CMK.
2913
+ # key_spec: "AES_256", # Specifies the type of data key to return.
2914
+ # })
2915
+ #
2916
+ # resp.to_h outputs the following:
2917
+ # {
2114
2918
  # ciphertext_blob: "<binary data>", # The encrypted data key.
2115
2919
  # key_id: "arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", # The ARN of the CMK that was used to encrypt the data key.
2116
2920
  # }
@@ -2270,9 +3074,13 @@ module Aws::KMS
2270
3074
  # key material][1] is enabled for the specified customer master key
2271
3075
  # (CMK).
2272
3076
  #
2273
- # The result of this operation varies with the key state of the CMK. For
2274
- # details, see [How Key State Affects Use of a Customer Master Key][2]
2275
- # in the *AWS Key Management Service Developer Guide*.
3077
+ # You cannot enable automatic rotation of asymmetric CMKs, CMKs with
3078
+ # imported key material, or CMKs in a [custom key store][2]. The key
3079
+ # rotation status for these CMKs is always `false`.
3080
+ #
3081
+ # The CMK that you use for this operation must be in a compatible key
3082
+ # state. For details, see [How Key State Affects Use of a Customer
3083
+ # Master Key][3] in the *AWS Key Management Service Developer Guide*.
2276
3084
  #
2277
3085
  # * Disabled: The key rotation status does not change when you disable a
2278
3086
  # CMK. However, while the CMK is disabled, AWS KMS does not rotate the
@@ -2289,7 +3097,8 @@ module Aws::KMS
2289
3097
  #
2290
3098
  #
2291
3099
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html
2292
- # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
3100
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html
3101
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
2293
3102
  #
2294
3103
  # @option params [required, String] :key_id
2295
3104
  # A unique identifier for the customer master key (CMK).
@@ -2343,29 +3152,32 @@ module Aws::KMS
2343
3152
  req.send_request(options)
2344
3153
  end
2345
3154
 
2346
- # Returns the items you need in order to import key material into AWS
2347
- # KMS from your existing key management infrastructure. For more
2348
- # information about importing key material into AWS KMS, see [Importing
2349
- # Key Material][1] in the *AWS Key Management Service Developer Guide*.
2350
- #
2351
- # You must specify the key ID of the customer master key (CMK) into
2352
- # which you will import key material. This CMK's `Origin` must be
2353
- # `EXTERNAL`. You must also specify the wrapping algorithm and type of
2354
- # wrapping key (public key) that you will use to encrypt the key
2355
- # material. You cannot perform this operation on a CMK in a different
2356
- # AWS account.
3155
+ # Returns the items you need to import key material into a symmetric,
3156
+ # customer managed customer master key (CMK). For more information about
3157
+ # importing key material into AWS KMS, see [Importing Key Material][1]
3158
+ # in the *AWS Key Management Service Developer Guide*.
2357
3159
  #
2358
3160
  # This operation returns a public key and an import token. Use the
2359
- # public key to encrypt the key material. Store the import token to send
2360
- # with a subsequent ImportKeyMaterial request. The public key and import
2361
- # token from the same response must be used together. These items are
2362
- # valid for 24 hours. When they expire, they cannot be used for a
2363
- # subsequent ImportKeyMaterial request. To get new ones, send another
3161
+ # public key to encrypt the symmetric key material. Store the import
3162
+ # token to send with a subsequent ImportKeyMaterial request.
3163
+ #
3164
+ # You must specify the key ID of the symmetric CMK into which you will
3165
+ # import key material. This CMK's `Origin` must be `EXTERNAL`. You must
3166
+ # also specify the wrapping algorithm and type of wrapping key (public
3167
+ # key) that you will use to encrypt the key material. You cannot perform
3168
+ # this operation on an asymmetric CMK or on any CMK in a different AWS
3169
+ # account.
3170
+ #
3171
+ # To import key material, you must use the public key and import token
3172
+ # from the same response. These items are valid for 24 hours. The
3173
+ # expiration date and time appear in the `GetParametersForImport`
3174
+ # response. You cannot use an expired token in an ImportKeyMaterial
3175
+ # request. If your key and token expire, send another
2364
3176
  # `GetParametersForImport` request.
2365
3177
  #
2366
- # The result of this operation varies with the key state of the CMK. For
2367
- # details, see [How Key State Affects Use of a Customer Master Key][2]
2368
- # in the *AWS Key Management Service Developer Guide*.
3178
+ # The CMK that you use for this operation must be in a compatible key
3179
+ # state. For details, see [How Key State Affects Use of a Customer
3180
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
2369
3181
  #
2370
3182
  #
2371
3183
  #
@@ -2373,8 +3185,8 @@ module Aws::KMS
2373
3185
  # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
2374
3186
  #
2375
3187
  # @option params [required, String] :key_id
2376
- # The identifier of the CMK into which you will import key material. The
2377
- # CMK's `Origin` must be `EXTERNAL`.
3188
+ # The identifier of the symmetric CMK into which you will import key
3189
+ # material. The `Origin` of the CMK must be `EXTERNAL`.
2378
3190
  #
2379
3191
  # Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
2380
3192
  #
@@ -2451,12 +3263,136 @@ module Aws::KMS
2451
3263
  req.send_request(options)
2452
3264
  end
2453
3265
 
2454
- # Imports key material into an existing AWS KMS customer master key
2455
- # (CMK) that was created without key material. You cannot perform this
2456
- # operation on a CMK in a different AWS account. For more information
2457
- # about creating CMKs with no key material and then importing key
2458
- # material, see [Importing Key Material][1] in the *AWS Key Management
2459
- # Service Developer Guide*.
3266
+ # Returns the public key of an asymmetric CMK. Unlike the private key of
3267
+ # a asymmetric CMK, which never leaves AWS KMS unencrypted, callers with
3268
+ # `kms:GetPublicKey` permission can download the public key of an
3269
+ # asymmetric CMK. You can share the public key to allow others to
3270
+ # encrypt messages and verify signatures outside of AWS KMS. For
3271
+ # information about symmetric and asymmetric CMKs, see [Using Symmetric
3272
+ # and Asymmetric CMKs][1] in the *AWS Key Management Service Developer
3273
+ # Guide*.
3274
+ #
3275
+ # You do not need to download the public key. Instead, you can use the
3276
+ # public key within AWS KMS by calling the Encrypt, ReEncrypt, or Verify
3277
+ # operations with the identifier of an asymmetric CMK. When you use the
3278
+ # public key within AWS KMS, you benefit from the authentication,
3279
+ # authorization, and logging that are part of every AWS KMS operation.
3280
+ # You also reduce of risk of encrypting data that cannot be decrypted.
3281
+ # These features are not effective outside of AWS KMS. For details, see
3282
+ # [Special Considerations for Downloading Public Keys][2].
3283
+ #
3284
+ # To help you use the public key safely outside of AWS KMS,
3285
+ # `GetPublicKey` returns important information about the public key in
3286
+ # the response, including:
3287
+ #
3288
+ # * [CustomerMasterKeySpec][3]\: The type of key material in the public
3289
+ # key, such as `RSA_4096` or `ECC_NIST_P521`.
3290
+ #
3291
+ # * [KeyUsage][4]\: Whether the key is used for encryption or signing.
3292
+ #
3293
+ # * [EncryptionAlgorithms][5] or [SigningAlgorithms][6]\: A list of the
3294
+ # encryption algorithms or the signing algorithms for the key.
3295
+ #
3296
+ # Although AWS KMS cannot enforce these restrictions on external
3297
+ # operations, it is crucial that you use this information to prevent the
3298
+ # public key from being used improperly. For example, you can prevent a
3299
+ # public signing key from being used encrypt data, or prevent a public
3300
+ # key from being used with an encryption algorithm that is not supported
3301
+ # by AWS KMS. You can also avoid errors, such as using the wrong signing
3302
+ # algorithm in a verification operation.
3303
+ #
3304
+ # The CMK that you use for this operation must be in a compatible key
3305
+ # state. For details, see [How Key State Affects Use of a Customer
3306
+ # Master Key][7] in the *AWS Key Management Service Developer Guide*.
3307
+ #
3308
+ #
3309
+ #
3310
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html
3311
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/download-public-key.html#download-public-key-considerations
3312
+ # [3]: https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html#KMS-GetPublicKey-response-CustomerMasterKeySpec
3313
+ # [4]: https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html#KMS-GetPublicKey-response-KeyUsage
3314
+ # [5]: https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html#KMS-GetPublicKey-response-EncryptionAlgorithms
3315
+ # [6]: https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html#KMS-GetPublicKey-response-SigningAlgorithms
3316
+ # [7]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
3317
+ #
3318
+ # @option params [required, String] :key_id
3319
+ # Identifies the asymmetric CMK that includes the public key.
3320
+ #
3321
+ # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
3322
+ # name, or alias ARN. When using an alias name, prefix it with
3323
+ # `"alias/"`. To specify a CMK in a different AWS account, you must use
3324
+ # the key ARN or alias ARN.
3325
+ #
3326
+ # For example:
3327
+ #
3328
+ # * Key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
3329
+ #
3330
+ # * Key ARN:
3331
+ # `arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
3332
+ #
3333
+ # * Alias name: `alias/ExampleAlias`
3334
+ #
3335
+ # * Alias ARN: `arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias`
3336
+ #
3337
+ # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
3338
+ # To get the alias name and alias ARN, use ListAliases.
3339
+ #
3340
+ # @option params [Array<String>] :grant_tokens
3341
+ # A list of grant tokens.
3342
+ #
3343
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
3344
+ # Service Developer Guide*.
3345
+ #
3346
+ #
3347
+ #
3348
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
3349
+ #
3350
+ # @return [Types::GetPublicKeyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
3351
+ #
3352
+ # * {Types::GetPublicKeyResponse#key_id #key_id} => String
3353
+ # * {Types::GetPublicKeyResponse#public_key #public_key} => String
3354
+ # * {Types::GetPublicKeyResponse#customer_master_key_spec #customer_master_key_spec} => String
3355
+ # * {Types::GetPublicKeyResponse#key_usage #key_usage} => String
3356
+ # * {Types::GetPublicKeyResponse#encryption_algorithms #encryption_algorithms} => Array&lt;String&gt;
3357
+ # * {Types::GetPublicKeyResponse#signing_algorithms #signing_algorithms} => Array&lt;String&gt;
3358
+ #
3359
+ # @example Request syntax with placeholder values
3360
+ #
3361
+ # resp = client.get_public_key({
3362
+ # key_id: "KeyIdType", # required
3363
+ # grant_tokens: ["GrantTokenType"],
3364
+ # })
3365
+ #
3366
+ # @example Response structure
3367
+ #
3368
+ # resp.key_id #=> String
3369
+ # resp.public_key #=> String
3370
+ # resp.customer_master_key_spec #=> String, one of "RSA_2048", "RSA_3072", "RSA_4096", "ECC_NIST_P256", "ECC_NIST_P384", "ECC_NIST_P521", "ECC_SECG_P256K1", "SYMMETRIC_DEFAULT"
3371
+ # resp.key_usage #=> String, one of "SIGN_VERIFY", "ENCRYPT_DECRYPT"
3372
+ # resp.encryption_algorithms #=> Array
3373
+ # resp.encryption_algorithms[0] #=> String, one of "SYMMETRIC_DEFAULT", "RSAES_OAEP_SHA_1", "RSAES_OAEP_SHA_256"
3374
+ # resp.signing_algorithms #=> Array
3375
+ # resp.signing_algorithms[0] #=> String, one of "RSASSA_PSS_SHA_256", "RSASSA_PSS_SHA_384", "RSASSA_PSS_SHA_512", "RSASSA_PKCS1_V1_5_SHA_256", "RSASSA_PKCS1_V1_5_SHA_384", "RSASSA_PKCS1_V1_5_SHA_512", "ECDSA_SHA_256", "ECDSA_SHA_384", "ECDSA_SHA_512"
3376
+ #
3377
+ # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetPublicKey AWS API Documentation
3378
+ #
3379
+ # @overload get_public_key(params = {})
3380
+ # @param [Hash] params ({})
3381
+ def get_public_key(params = {}, options = {})
3382
+ req = build_request(:get_public_key, params)
3383
+ req.send_request(options)
3384
+ end
3385
+
3386
+ # Imports key material into an existing symmetric AWS KMS customer
3387
+ # master key (CMK) that was created without key material. After you
3388
+ # successfully import key material into a CMK, you can [reimport the
3389
+ # same key material][1] into that CMK, but you cannot import different
3390
+ # key material.
3391
+ #
3392
+ # You cannot perform this operation on an asymmetric CMK or on any CMK
3393
+ # in a different AWS account. For more information about creating CMKs
3394
+ # with no key material and then importing key material, see [Importing
3395
+ # Key Material][2] in the *AWS Key Management Service Developer Guide*.
2460
3396
  #
2461
3397
  # Before using this operation, call GetParametersForImport. Its response
2462
3398
  # includes a public key and an import token. Use the public key to
@@ -2475,35 +3411,43 @@ module Aws::KMS
2475
3411
  # * The encrypted key material. To get the public key to encrypt the key
2476
3412
  # material, call GetParametersForImport.
2477
3413
  #
2478
- # * The import token that GetParametersForImport returned. This token
2479
- # and the public key used to encrypt the key material must have come
2480
- # from the same response.
3414
+ # * The import token that GetParametersForImport returned. You must use
3415
+ # a public key and token from the same `GetParametersForImport`
3416
+ # response.
2481
3417
  #
2482
3418
  # * Whether the key material expires and if so, when. If you set an
2483
- # expiration date, you can change it only by reimporting the same key
2484
- # material and specifying a new expiration date. If the key material
2485
- # expires, AWS KMS deletes the key material and the CMK becomes
2486
- # unusable. To use the CMK again, you must reimport the same key
2487
- # material.
3419
+ # expiration date, AWS KMS deletes the key material from the CMK on
3420
+ # the specified date, and the CMK becomes unusable. To use the CMK
3421
+ # again, you must reimport the same key material. The only way to
3422
+ # change an expiration date is by reimporting the same key material
3423
+ # and specifying a new expiration date.
2488
3424
  #
2489
3425
  # When this operation is successful, the key state of the CMK changes
2490
- # from `PendingImport` to `Enabled`, and you can use the CMK. After you
2491
- # successfully import key material into a CMK, you can reimport the same
2492
- # key material into that CMK, but you cannot import different key
2493
- # material.
3426
+ # from `PendingImport` to `Enabled`, and you can use the CMK.
2494
3427
  #
2495
- # The result of this operation varies with the key state of the CMK. For
2496
- # details, see [How Key State Affects Use of a Customer Master Key][2]
2497
- # in the *AWS Key Management Service Developer Guide*.
3428
+ # If this operation fails, use the exception to help determine the
3429
+ # problem. If the error is related to the key material, the import
3430
+ # token, or wrapping key, use GetParametersForImport to get a new public
3431
+ # key and import token for the CMK and repeat the import procedure. For
3432
+ # help, see [How To Import Key Material][3] in the *AWS Key Management
3433
+ # Service Developer Guide*.
2498
3434
  #
3435
+ # The CMK that you use for this operation must be in a compatible key
3436
+ # state. For details, see [How Key State Affects Use of a Customer
3437
+ # Master Key][4] in the *AWS Key Management Service Developer Guide*.
2499
3438
  #
2500
3439
  #
2501
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html
2502
- # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
3440
+ #
3441
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html#reimport-key-material
3442
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html
3443
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html#importing-keys-overview
3444
+ # [4]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
2503
3445
  #
2504
3446
  # @option params [required, String] :key_id
2505
- # The identifier of the CMK to import the key material into. The CMK's
2506
- # `Origin` must be `EXTERNAL`.
3447
+ # The identifier of the symmetric CMK that receives the imported key
3448
+ # material. The CMK's `Origin` must be `EXTERNAL`. This must be the
3449
+ # same CMK specified in the `KeyID` parameter of the corresponding
3450
+ # GetParametersForImport request.
2507
3451
  #
2508
3452
  # Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
2509
3453
  #
@@ -2522,10 +3466,10 @@ module Aws::KMS
2522
3466
  # contained the public key that you used to encrypt the key material.
2523
3467
  #
2524
3468
  # @option params [required, String, IO] :encrypted_key_material
2525
- # The encrypted key material to import. It must be encrypted with the
2526
- # public key that you received in the response to a previous
2527
- # GetParametersForImport request, using the wrapping algorithm that you
2528
- # specified in that request.
3469
+ # The encrypted key material to import. The key material must be
3470
+ # encrypted with the public wrapping key that GetParametersForImport
3471
+ # returned, using the wrapping algorithm that you specified in the same
3472
+ # `GetParametersForImport` request.
2529
3473
  #
2530
3474
  # @option params [Time,DateTime,Date,Integer,String] :valid_to
2531
3475
  # The time at which the imported key material expires. When the key
@@ -2591,7 +3535,7 @@ module Aws::KMS
2591
3535
  # field. These are predefined aliases that AWS has created but has not
2592
3536
  # yet associated with a CMK. Aliases that AWS creates in your account,
2593
3537
  # including predefined aliases, do not count against your [AWS KMS
2594
- # aliases limit][1].
3538
+ # aliases quota][1].
2595
3539
  #
2596
3540
  #
2597
3541
  #
@@ -2831,7 +3775,7 @@ module Aws::KMS
2831
3775
  # resp.grants[0].retiring_principal #=> String
2832
3776
  # resp.grants[0].issuing_account #=> String
2833
3777
  # resp.grants[0].operations #=> Array
2834
- # resp.grants[0].operations[0] #=> String, one of "Decrypt", "Encrypt", "GenerateDataKey", "GenerateDataKeyWithoutPlaintext", "ReEncryptFrom", "ReEncryptTo", "CreateGrant", "RetireGrant", "DescribeKey"
3778
+ # resp.grants[0].operations[0] #=> String, one of "Decrypt", "Encrypt", "GenerateDataKey", "GenerateDataKeyWithoutPlaintext", "ReEncryptFrom", "ReEncryptTo", "Sign", "Verify", "GetPublicKey", "CreateGrant", "RetireGrant", "DescribeKey", "GenerateDataKeyPair", "GenerateDataKeyPairWithoutPlaintext"
2835
3779
  # resp.grants[0].constraints.encryption_context_subset #=> Hash
2836
3780
  # resp.grants[0].constraints.encryption_context_subset["EncryptionContextKey"] #=> String
2837
3781
  # resp.grants[0].constraints.encryption_context_equals #=> Hash
@@ -2932,7 +3876,7 @@ module Aws::KMS
2932
3876
  end
2933
3877
 
2934
3878
  # Gets a list of all customer master keys (CMKs) in the caller's AWS
2935
- # account and region.
3879
+ # account and Region.
2936
3880
  #
2937
3881
  # @option params [Integer] :limit
2938
3882
  # Use this parameter to specify the maximum number of items to return.
@@ -3202,7 +4146,7 @@ module Aws::KMS
3202
4146
  # resp.grants[0].retiring_principal #=> String
3203
4147
  # resp.grants[0].issuing_account #=> String
3204
4148
  # resp.grants[0].operations #=> Array
3205
- # resp.grants[0].operations[0] #=> String, one of "Decrypt", "Encrypt", "GenerateDataKey", "GenerateDataKeyWithoutPlaintext", "ReEncryptFrom", "ReEncryptTo", "CreateGrant", "RetireGrant", "DescribeKey"
4149
+ # resp.grants[0].operations[0] #=> String, one of "Decrypt", "Encrypt", "GenerateDataKey", "GenerateDataKeyWithoutPlaintext", "ReEncryptFrom", "ReEncryptTo", "Sign", "Verify", "GetPublicKey", "CreateGrant", "RetireGrant", "DescribeKey", "GenerateDataKeyPair", "GenerateDataKeyPairWithoutPlaintext"
3206
4150
  # resp.grants[0].constraints.encryption_context_subset #=> Hash
3207
4151
  # resp.grants[0].constraints.encryption_context_subset["EncryptionContextKey"] #=> String
3208
4152
  # resp.grants[0].constraints.encryption_context_equals #=> Hash
@@ -3267,12 +4211,15 @@ module Aws::KMS
3267
4211
  # information, see [Changes that I make are not always immediately
3268
4212
  # visible][2] in the *AWS Identity and Access Management User Guide*.
3269
4213
  #
3270
- # The key policy size limit is 32 kilobytes (32768 bytes).
4214
+ # The key policy cannot exceed 32 kilobytes (32768 bytes). For more
4215
+ # information, see [Resource Quotas][3] in the *AWS Key Management
4216
+ # Service Developer Guide*.
3271
4217
  #
3272
4218
  #
3273
4219
  #
3274
4220
  # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam
3275
4221
  # [2]: https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency
4222
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/resource-limits.html
3276
4223
  #
3277
4224
  # @option params [Boolean] :bypass_policy_lockout_safety_check
3278
4225
  # A flag to indicate whether to bypass the key policy lockout safety
@@ -3326,40 +4273,142 @@ module Aws::KMS
3326
4273
  req.send_request(options)
3327
4274
  end
3328
4275
 
3329
- # Encrypts data on the server side with a new customer master key (CMK)
3330
- # without exposing the plaintext of the data on the client side. The
3331
- # data is first decrypted and then reencrypted. You can also use this
3332
- # operation to change the encryption context of a ciphertext.
3333
- #
3334
- # You can reencrypt data using CMKs in different AWS accounts.
3335
- #
3336
- # Unlike other operations, `ReEncrypt` is authorized twice, once as
3337
- # `ReEncryptFrom` on the source CMK and once as `ReEncryptTo` on the
3338
- # destination CMK. We recommend that you include the `"kms:ReEncrypt*"`
3339
- # permission in your [key policies][1] to permit reencryption from or to
3340
- # the CMK. This permission is automatically included in the key policy
3341
- # when you create a CMK through the console. But you must include it
3342
- # manually when you create a CMK programmatically or when you set a key
3343
- # policy with the PutKeyPolicy operation.
3344
- #
3345
- # The result of this operation varies with the key state of the CMK. For
3346
- # details, see [How Key State Affects Use of a Customer Master Key][2]
3347
- # in the *AWS Key Management Service Developer Guide*.
4276
+ # Decrypts ciphertext and then reencrypts it entirely within AWS KMS.
4277
+ # You can use this operation to change the customer master key (CMK)
4278
+ # under which data is encrypted, such as when you [manually rotate][1] a
4279
+ # CMK or change the CMK that protects a ciphertext. You can also use it
4280
+ # to reencrypt ciphertext under the same CMK, such as to change the
4281
+ # encryption context of a ciphertext.
4282
+ #
4283
+ # The `ReEncrypt` operation can decrypt ciphertext that was encrypted by
4284
+ # using an AWS KMS CMK in an AWS KMS operation, such as Encrypt or
4285
+ # GenerateDataKey. It can also decrypt ciphertext that was encrypted by
4286
+ # using the public key of an asymmetric CMK outside of AWS KMS. However,
4287
+ # it cannot decrypt ciphertext produced by other libraries, such as the
4288
+ # [AWS Encryption SDK][2] or [Amazon S3 client-side encryption][3].
4289
+ # These libraries return a ciphertext format that is incompatible with
4290
+ # AWS KMS.
4291
+ #
4292
+ # When you use the `ReEncrypt` operation, you need to provide
4293
+ # information for the decrypt operation and the subsequent encrypt
4294
+ # operation.
3348
4295
  #
4296
+ # * If your ciphertext was encrypted under an asymmetric CMK, you must
4297
+ # identify the *source CMK*, that is, the CMK that encrypted the
4298
+ # ciphertext. You must also supply the encryption algorithm that was
4299
+ # used. This information is required to decrypt the data.
3349
4300
  #
4301
+ # * It is optional, but you can specify a source CMK even when the
4302
+ # ciphertext was encrypted under a symmetric CMK. This ensures that
4303
+ # the ciphertext is decrypted only by using a particular CMK. If the
4304
+ # CMK that you specify cannot decrypt the ciphertext, the `ReEncrypt`
4305
+ # operation fails.
3350
4306
  #
3351
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html
3352
- # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
4307
+ # * To reencrypt the data, you must specify the *destination CMK*, that
4308
+ # is, the CMK that re-encrypts the data after it is decrypted. You can
4309
+ # select a symmetric or asymmetric CMK. If the destination CMK is an
4310
+ # asymmetric CMK, you must also provide the encryption algorithm. The
4311
+ # algorithm that you choose must be compatible with the CMK.
4312
+ #
4313
+ # When you use an asymmetric CMK to encrypt or reencrypt data, be sure
4314
+ # to record the CMK and encryption algorithm that you choose. You will
4315
+ # be required to provide the same CMK and encryption algorithm when
4316
+ # you decrypt the data. If the CMK and algorithm do not match the
4317
+ # values used to encrypt the data, the decrypt operation fails.
4318
+ #
4319
+ # You are not required to supply the CMK ID and encryption algorithm
4320
+ # when you decrypt with symmetric CMKs because AWS KMS stores this
4321
+ # information in the ciphertext blob. AWS KMS cannot store metadata in
4322
+ # ciphertext generated with asymmetric keys. The standard format for
4323
+ # asymmetric key ciphertext does not include configurable fields.
4324
+ #
4325
+ # Unlike other AWS KMS API operations, `ReEncrypt` callers must have two
4326
+ # permissions:
4327
+ #
4328
+ # * `kms:EncryptFrom` permission on the source CMK
4329
+ #
4330
+ # * `kms:EncryptTo` permission on the destination CMK
4331
+ #
4332
+ # To permit reencryption from
4333
+ #
4334
+ # or to a CMK, include the `"kms:ReEncrypt*"` permission in your [key
4335
+ # policy][4]. This permission is automatically included in the key
4336
+ # policy when you use the console to create a CMK. But you must include
4337
+ # it manually when you create a CMK programmatically or when you use the
4338
+ # PutKeyPolicy operation set a key policy.
4339
+ #
4340
+ # The CMK that you use for this operation must be in a compatible key
4341
+ # state. For details, see [How Key State Affects Use of a Customer
4342
+ # Master Key][5] in the *AWS Key Management Service Developer Guide*.
4343
+ #
4344
+ #
4345
+ #
4346
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotate-keys-manually
4347
+ # [2]: https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/
4348
+ # [3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html
4349
+ # [4]: https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html
4350
+ # [5]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
3353
4351
  #
3354
4352
  # @option params [required, String, IO] :ciphertext_blob
3355
4353
  # Ciphertext of the data to reencrypt.
3356
4354
  #
3357
4355
  # @option params [Hash<String,String>] :source_encryption_context
3358
- # Encryption context used to encrypt and decrypt the data specified in
3359
- # the `CiphertextBlob` parameter.
4356
+ # Specifies the encryption context to use to decrypt the ciphertext.
4357
+ # Enter the same encryption context that was used to encrypt the
4358
+ # ciphertext.
4359
+ #
4360
+ # An *encryption context* is a collection of non-secret key-value pairs
4361
+ # that represents additional authenticated data. When you use an
4362
+ # encryption context to encrypt data, you must specify the same (an
4363
+ # exact case-sensitive match) encryption context to decrypt the data. An
4364
+ # encryption context is optional when encrypting with a symmetric CMK,
4365
+ # but it is highly recommended.
4366
+ #
4367
+ # For more information, see [Encryption Context][1] in the *AWS Key
4368
+ # Management Service Developer Guide*.
4369
+ #
4370
+ #
4371
+ #
4372
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
4373
+ #
4374
+ # @option params [String] :source_key_id
4375
+ # A unique identifier for the CMK that is used to decrypt the ciphertext
4376
+ # before it reencrypts it using the destination CMK.
4377
+ #
4378
+ # This parameter is required only when the ciphertext was encrypted
4379
+ # under an asymmetric CMK. Otherwise, AWS KMS uses the metadata that it
4380
+ # adds to the ciphertext blob to determine which CMK was used to encrypt
4381
+ # the ciphertext. However, you can use this parameter to ensure that a
4382
+ # particular CMK (of any kind) is used to decrypt the ciphertext before
4383
+ # it is reencrypted.
4384
+ #
4385
+ # If you specify a `KeyId` value, the decrypt part of the `ReEncrypt`
4386
+ # operation succeeds only if the specified CMK was used to encrypt the
4387
+ # ciphertext.
4388
+ #
4389
+ # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
4390
+ # name, or alias ARN. When using an alias name, prefix it with
4391
+ # `"alias/"`.
4392
+ #
4393
+ # For example:
4394
+ #
4395
+ # * Key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
4396
+ #
4397
+ # * Key ARN:
4398
+ # `arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
4399
+ #
4400
+ # * Alias name: `alias/ExampleAlias`
4401
+ #
4402
+ # * Alias ARN: `arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias`
4403
+ #
4404
+ # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
4405
+ # To get the alias name and alias ARN, use ListAliases.
3360
4406
  #
3361
4407
  # @option params [required, String] :destination_key_id
3362
4408
  # A unique identifier for the CMK that is used to reencrypt the data.
4409
+ # Specify a symmetric or asymmetric CMK with a `KeyUsage` value of
4410
+ # `ENCRYPT_DECRYPT`. To find the `KeyUsage` value of a CMK, use the
4411
+ # DescribeKey operation.
3363
4412
  #
3364
4413
  # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
3365
4414
  # name, or alias ARN. When using an alias name, prefix it with
@@ -3381,7 +4430,46 @@ module Aws::KMS
3381
4430
  # To get the alias name and alias ARN, use ListAliases.
3382
4431
  #
3383
4432
  # @option params [Hash<String,String>] :destination_encryption_context
3384
- # Encryption context to use when the data is reencrypted.
4433
+ # Specifies that encryption context to use when the reencrypting the
4434
+ # data.
4435
+ #
4436
+ # A destination encryption context is valid only when the destination
4437
+ # CMK is a symmetric CMK. The standard ciphertext format for asymmetric
4438
+ # CMKs does not include fields for metadata.
4439
+ #
4440
+ # An *encryption context* is a collection of non-secret key-value pairs
4441
+ # that represents additional authenticated data. When you use an
4442
+ # encryption context to encrypt data, you must specify the same (an
4443
+ # exact case-sensitive match) encryption context to decrypt the data. An
4444
+ # encryption context is optional when encrypting with a symmetric CMK,
4445
+ # but it is highly recommended.
4446
+ #
4447
+ # For more information, see [Encryption Context][1] in the *AWS Key
4448
+ # Management Service Developer Guide*.
4449
+ #
4450
+ #
4451
+ #
4452
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
4453
+ #
4454
+ # @option params [String] :source_encryption_algorithm
4455
+ # Specifies the encryption algorithm that AWS KMS will use to decrypt
4456
+ # the ciphertext before it is reencrypted. The default value,
4457
+ # `SYMMETRIC_DEFAULT`, represents the algorithm used for symmetric CMKs.
4458
+ #
4459
+ # Specify the same algorithm that was used to encrypt the ciphertext. If
4460
+ # you specify a different algorithm, the decrypt attempt fails.
4461
+ #
4462
+ # This parameter is required only when the ciphertext was encrypted
4463
+ # under an asymmetric CMK.
4464
+ #
4465
+ # @option params [String] :destination_encryption_algorithm
4466
+ # Specifies the encryption algorithm that AWS KMS will use to reecrypt
4467
+ # the data after it has decrypted it. The default value,
4468
+ # `SYMMETRIC_DEFAULT`, represents the encryption algorithm used for
4469
+ # symmetric CMKs.
4470
+ #
4471
+ # This parameter is required only when the destination CMK is an
4472
+ # asymmetric CMK.
3385
4473
  #
3386
4474
  # @option params [Array<String>] :grant_tokens
3387
4475
  # A list of grant tokens.
@@ -3398,6 +4486,8 @@ module Aws::KMS
3398
4486
  # * {Types::ReEncryptResponse#ciphertext_blob #ciphertext_blob} => String
3399
4487
  # * {Types::ReEncryptResponse#source_key_id #source_key_id} => String
3400
4488
  # * {Types::ReEncryptResponse#key_id #key_id} => String
4489
+ # * {Types::ReEncryptResponse#source_encryption_algorithm #source_encryption_algorithm} => String
4490
+ # * {Types::ReEncryptResponse#destination_encryption_algorithm #destination_encryption_algorithm} => String
3401
4491
  #
3402
4492
  #
3403
4493
  # @example Example: To reencrypt data
@@ -3423,10 +4513,13 @@ module Aws::KMS
3423
4513
  # source_encryption_context: {
3424
4514
  # "EncryptionContextKey" => "EncryptionContextValue",
3425
4515
  # },
4516
+ # source_key_id: "KeyIdType",
3426
4517
  # destination_key_id: "KeyIdType", # required
3427
4518
  # destination_encryption_context: {
3428
4519
  # "EncryptionContextKey" => "EncryptionContextValue",
3429
4520
  # },
4521
+ # source_encryption_algorithm: "SYMMETRIC_DEFAULT", # accepts SYMMETRIC_DEFAULT, RSAES_OAEP_SHA_1, RSAES_OAEP_SHA_256
4522
+ # destination_encryption_algorithm: "SYMMETRIC_DEFAULT", # accepts SYMMETRIC_DEFAULT, RSAES_OAEP_SHA_1, RSAES_OAEP_SHA_256
3430
4523
  # grant_tokens: ["GrantTokenType"],
3431
4524
  # })
3432
4525
  #
@@ -3435,6 +4528,8 @@ module Aws::KMS
3435
4528
  # resp.ciphertext_blob #=> String
3436
4529
  # resp.source_key_id #=> String
3437
4530
  # resp.key_id #=> String
4531
+ # resp.source_encryption_algorithm #=> String, one of "SYMMETRIC_DEFAULT", "RSAES_OAEP_SHA_1", "RSAES_OAEP_SHA_256"
4532
+ # resp.destination_encryption_algorithm #=> String, one of "SYMMETRIC_DEFAULT", "RSAES_OAEP_SHA_1", "RSAES_OAEP_SHA_256"
3438
4533
  #
3439
4534
  # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ReEncrypt AWS API Documentation
3440
4535
  #
@@ -3591,9 +4686,9 @@ module Aws::KMS
3591
4686
  # [Deleting Customer Master Keys][3] in the *AWS Key Management Service
3592
4687
  # Developer Guide*.
3593
4688
  #
3594
- # The result of this operation varies with the key state of the CMK. For
3595
- # details, see [How Key State Affects Use of a Customer Master Key][4]
3596
- # in the *AWS Key Management Service Developer Guide*.
4689
+ # The CMK that you use for this operation must be in a compatible key
4690
+ # state. For details, see [How Key State Affects Use of a Customer
4691
+ # Master Key][4] in the *AWS Key Management Service Developer Guide*.
3597
4692
  #
3598
4693
  #
3599
4694
  #
@@ -3665,6 +4760,138 @@ module Aws::KMS
3665
4760
  req.send_request(options)
3666
4761
  end
3667
4762
 
4763
+ # Creates a [digital signature][1] for a message or message digest by
4764
+ # using the private key in an asymmetric CMK. To verify the signature,
4765
+ # use the Verify operation, or use the public key in the same asymmetric
4766
+ # CMK outside of AWS KMS. For information about symmetric and asymmetric
4767
+ # CMKs, see [Using Symmetric and Asymmetric CMKs][2] in the *AWS Key
4768
+ # Management Service Developer Guide*.
4769
+ #
4770
+ # Digital signatures are generated and verified by using asymmetric key
4771
+ # pair, such as an RSA or ECC pair that is represented by an asymmetric
4772
+ # customer master key (CMK). The key owner (or an authorized user) uses
4773
+ # their private key to sign a message. Anyone with the public key can
4774
+ # verify that the message was signed with that particular private key
4775
+ # and that the message hasn't changed since it was signed.
4776
+ #
4777
+ # To use the `Sign` operation, provide the following information:
4778
+ #
4779
+ # * Use the `KeyId` parameter to identify an asymmetric CMK with a
4780
+ # `KeyUsage` value of `SIGN_VERIFY`. To get the `KeyUsage` value of a
4781
+ # CMK, use the DescribeKey operation. The caller must have `kms:Sign`
4782
+ # permission on the CMK.
4783
+ #
4784
+ # * Use the `Message` parameter to specify the message or message digest
4785
+ # to sign. You can submit messages of up to 4096 bytes. To sign a
4786
+ # larger message, generate a hash digest of the message, and then
4787
+ # provide the hash digest in the `Message` parameter. To indicate
4788
+ # whether the message is a full message or a digest, use the
4789
+ # `MessageType` parameter.
4790
+ #
4791
+ # * Choose a signing algorithm that is compatible with the CMK.
4792
+ #
4793
+ # When signing a message, be sure to record the CMK and the signing
4794
+ # algorithm. This information is required to verify the signature.
4795
+ #
4796
+ # To verify the signature that this operation generates, use the Verify
4797
+ # operation. Or use the GetPublicKey operation to download the public
4798
+ # key and then use the public key to verify the signature outside of AWS
4799
+ # KMS.
4800
+ #
4801
+ # The CMK that you use for this operation must be in a compatible key
4802
+ # state. For details, see [How Key State Affects Use of a Customer
4803
+ # Master Key][3] in the *AWS Key Management Service Developer Guide*.
4804
+ #
4805
+ #
4806
+ #
4807
+ # [1]: https://en.wikipedia.org/wiki/Digital_signature
4808
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html
4809
+ # [3]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
4810
+ #
4811
+ # @option params [required, String] :key_id
4812
+ # Identifies an asymmetric CMK. AWS KMS uses the private key in the
4813
+ # asymmetric CMK to sign the message. The `KeyUsage` type of the CMK
4814
+ # must be `SIGN_VERIFY`. To find the `KeyUsage` of a CMK, use the
4815
+ # DescribeKey operation.
4816
+ #
4817
+ # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
4818
+ # name, or alias ARN. When using an alias name, prefix it with
4819
+ # `"alias/"`. To specify a CMK in a different AWS account, you must use
4820
+ # the key ARN or alias ARN.
4821
+ #
4822
+ # For example:
4823
+ #
4824
+ # * Key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
4825
+ #
4826
+ # * Key ARN:
4827
+ # `arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
4828
+ #
4829
+ # * Alias name: `alias/ExampleAlias`
4830
+ #
4831
+ # * Alias ARN: `arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias`
4832
+ #
4833
+ # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
4834
+ # To get the alias name and alias ARN, use ListAliases.
4835
+ #
4836
+ # @option params [required, String, IO] :message
4837
+ # Specifies the message or message digest to sign. Messages can be
4838
+ # 0-4096 bytes. To sign a larger message, provide the message digest.
4839
+ #
4840
+ # If you provide a message, AWS KMS generates a hash digest of the
4841
+ # message and then signs it.
4842
+ #
4843
+ # @option params [String] :message_type
4844
+ # Tells AWS KMS whether the value of the `Message` parameter is a
4845
+ # message or message digest. The default value, RAW, indicates a
4846
+ # message. To indicate a message digest, enter `DIGEST`.
4847
+ #
4848
+ # @option params [Array<String>] :grant_tokens
4849
+ # A list of grant tokens.
4850
+ #
4851
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
4852
+ # Service Developer Guide*.
4853
+ #
4854
+ #
4855
+ #
4856
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
4857
+ #
4858
+ # @option params [required, String] :signing_algorithm
4859
+ # Specifies the signing algorithm to use when signing the message.
4860
+ #
4861
+ # Choose an algorithm that is compatible with the type and size of the
4862
+ # specified asymmetric CMK.
4863
+ #
4864
+ # @return [Types::SignResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
4865
+ #
4866
+ # * {Types::SignResponse#key_id #key_id} => String
4867
+ # * {Types::SignResponse#signature #signature} => String
4868
+ # * {Types::SignResponse#signing_algorithm #signing_algorithm} => String
4869
+ #
4870
+ # @example Request syntax with placeholder values
4871
+ #
4872
+ # resp = client.sign({
4873
+ # key_id: "KeyIdType", # required
4874
+ # message: "data", # required
4875
+ # message_type: "RAW", # accepts RAW, DIGEST
4876
+ # grant_tokens: ["GrantTokenType"],
4877
+ # signing_algorithm: "RSASSA_PSS_SHA_256", # required, accepts RSASSA_PSS_SHA_256, RSASSA_PSS_SHA_384, RSASSA_PSS_SHA_512, RSASSA_PKCS1_V1_5_SHA_256, RSASSA_PKCS1_V1_5_SHA_384, RSASSA_PKCS1_V1_5_SHA_512, ECDSA_SHA_256, ECDSA_SHA_384, ECDSA_SHA_512
4878
+ # })
4879
+ #
4880
+ # @example Response structure
4881
+ #
4882
+ # resp.key_id #=> String
4883
+ # resp.signature #=> String
4884
+ # resp.signing_algorithm #=> String, one of "RSASSA_PSS_SHA_256", "RSASSA_PSS_SHA_384", "RSASSA_PSS_SHA_512", "RSASSA_PKCS1_V1_5_SHA_256", "RSASSA_PKCS1_V1_5_SHA_384", "RSASSA_PKCS1_V1_5_SHA_512", "ECDSA_SHA_256", "ECDSA_SHA_384", "ECDSA_SHA_512"
4885
+ #
4886
+ # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Sign AWS API Documentation
4887
+ #
4888
+ # @overload sign(params = {})
4889
+ # @param [Hash] params ({})
4890
+ def sign(params = {}, options = {})
4891
+ req = build_request(:sign, params)
4892
+ req.send_request(options)
4893
+ end
4894
+
3668
4895
  # Adds or edits tags for a customer master key (CMK). You cannot perform
3669
4896
  # this operation on a CMK in a different AWS account.
3670
4897
  #
@@ -3679,9 +4906,9 @@ module Aws::KMS
3679
4906
  # see [User-Defined Tag Restrictions][1] in the *AWS Billing and Cost
3680
4907
  # Management User Guide*.
3681
4908
  #
3682
- # The result of this operation varies with the key state of the CMK. For
3683
- # details, see [How Key State Affects Use of a Customer Master Key][2]
3684
- # in the *AWS Key Management Service Developer Guide*.
4909
+ # The CMK that you use for this operation must be in a compatible key
4910
+ # state. For details, see [How Key State Affects Use of a Customer
4911
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
3685
4912
  #
3686
4913
  #
3687
4914
  #
@@ -3750,9 +4977,9 @@ module Aws::KMS
3750
4977
  # To remove a tag, specify the tag key. To change the tag value of an
3751
4978
  # existing tag key, use TagResource.
3752
4979
  #
3753
- # The result of this operation varies with the key state of the CMK. For
3754
- # details, see [How Key State Affects Use of a Customer Master Key][1]
3755
- # in the *AWS Key Management Service Developer Guide*.
4980
+ # The CMK that you use for this operation must be in a compatible key
4981
+ # state. For details, see [How Key State Affects Use of a Customer
4982
+ # Master Key][1] in the *AWS Key Management Service Developer Guide*.
3756
4983
  #
3757
4984
  #
3758
4985
  #
@@ -3806,14 +5033,22 @@ module Aws::KMS
3806
5033
  req.send_request(options)
3807
5034
  end
3808
5035
 
3809
- # Associates an existing alias with a different customer master key
3810
- # (CMK). Each CMK can have multiple aliases, but the aliases must be
3811
- # unique within the account and region. You cannot perform this
5036
+ # Associates an existing AWS KMS alias with a different customer master
5037
+ # key (CMK). Each alias is associated with only one CMK at a time,
5038
+ # although a CMK can have multiple aliases. The alias and the CMK must
5039
+ # be in the same AWS account and region. You cannot perform this
3812
5040
  # operation on an alias in a different AWS account.
3813
5041
  #
3814
- # This operation works only on existing aliases. To change the alias of
3815
- # a CMK to a new value, use CreateAlias to create a new alias and
3816
- # DeleteAlias to delete the old alias.
5042
+ # The current and new CMK must be the same type (both symmetric or both
5043
+ # asymmetric), and they must have the same key usage (`ENCRYPT_DECRYPT`
5044
+ # or `SIGN_VERIFY`). This restriction prevents errors in code that uses
5045
+ # aliases. If you must assign an alias to a different type of CMK, use
5046
+ # DeleteAlias to delete the old alias and CreateAlias to create a new
5047
+ # alias.
5048
+ #
5049
+ # You cannot use `UpdateAlias` to change an alias name. To change an
5050
+ # alias name, use DeleteAlias to delete the old alias and CreateAlias to
5051
+ # create a new alias.
3817
5052
  #
3818
5053
  # Because an alias is not a property of a CMK, you can create, update,
3819
5054
  # and delete the aliases of a CMK without affecting the CMK. Also,
@@ -3821,29 +5056,28 @@ module Aws::KMS
3821
5056
  # To get the aliases of all CMKs in the account, use the ListAliases
3822
5057
  # operation.
3823
5058
  #
3824
- # The alias name must begin with `alias/` followed by a name, such as
3825
- # `alias/ExampleAlias`. It can contain only alphanumeric characters,
3826
- # forward slashes (/), underscores (\_), and dashes (-). The alias name
3827
- # cannot begin with `alias/aws/`. The `alias/aws/` prefix is reserved
3828
- # for [AWS managed CMKs][1].
5059
+ # The CMK that you use for this operation must be in a compatible key
5060
+ # state. For details, see [How Key State Affects Use of a Customer
5061
+ # Master Key][1] in the *AWS Key Management Service Developer Guide*.
3829
5062
  #
3830
- # The result of this operation varies with the key state of the CMK. For
3831
- # details, see [How Key State Affects Use of a Customer Master Key][2]
3832
- # in the *AWS Key Management Service Developer Guide*.
3833
5063
  #
3834
5064
  #
3835
- #
3836
- # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk
3837
- # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
5065
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
3838
5066
  #
3839
5067
  # @option params [required, String] :alias_name
3840
- # Specifies the name of the alias to change. This value must begin with
3841
- # `alias/` followed by the alias name, such as `alias/ExampleAlias`.
5068
+ # Identifies the alias that is changing its CMK. This value must begin
5069
+ # with `alias/` followed by the alias name, such as
5070
+ # `alias/ExampleAlias`. You cannot use UpdateAlias to change the alias
5071
+ # name.
3842
5072
  #
3843
5073
  # @option params [required, String] :target_key_id
3844
- # Unique identifier of the customer master key (CMK) to be mapped to the
3845
- # alias. When the update operation completes, the alias will point to
3846
- # this CMK.
5074
+ # Identifies the CMK to associate with the alias. When the update
5075
+ # operation completes, the alias will point to this CMK.
5076
+ #
5077
+ # The CMK must be in the same AWS account and Region as the alias. Also,
5078
+ # the new target CMK must be the same type as the current target CMK
5079
+ # (both symmetric or both asymmetric) and they must have the same key
5080
+ # usage.
3847
5081
  #
3848
5082
  # Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
3849
5083
  #
@@ -3994,9 +5228,9 @@ module Aws::KMS
3994
5228
  #
3995
5229
  # You cannot perform this operation on a CMK in a different AWS account.
3996
5230
  #
3997
- # The result of this operation varies with the key state of the CMK. For
3998
- # details, see [How Key State Affects Use of a Customer Master Key][1]
3999
- # in the *AWS Key Management Service Developer Guide*.
5231
+ # The CMK that you use for this operation must be in a compatible key
5232
+ # state. For details, see [How Key State Affects Use of a Customer
5233
+ # Master Key][1] in the *AWS Key Management Service Developer Guide*.
4000
5234
  #
4001
5235
  #
4002
5236
  #
@@ -4047,6 +5281,138 @@ module Aws::KMS
4047
5281
  req.send_request(options)
4048
5282
  end
4049
5283
 
5284
+ # Verifies a digital signature that was generated by the Sign operation.
5285
+ #
5286
+ #
5287
+ #
5288
+ # Verification confirms that an authorized user signed the message with
5289
+ # the specified CMK and signing algorithm, and the message hasn't
5290
+ # changed since it was signed. If the signature is verified, the value
5291
+ # of the `SignatureValid` field in the response is `True`. If the
5292
+ # signature verification fails, the `Verify` operation fails with an
5293
+ # `KMSInvalidSignatureException` exception.
5294
+ #
5295
+ # A digital signature is generated by using the private key in an
5296
+ # asymmetric CMK. The signature is verified by using the public key in
5297
+ # the same asymmetric CMK. For information about symmetric and
5298
+ # asymmetric CMKs, see [Using Symmetric and Asymmetric CMKs][1] in the
5299
+ # *AWS Key Management Service Developer Guide*.
5300
+ #
5301
+ # To verify a digital signature, you can use the `Verify` operation.
5302
+ # Specify the same asymmetric CMK, message, and signing algorithm that
5303
+ # were used to produce the signature.
5304
+ #
5305
+ # You can also verify the digital signature by using the public key of
5306
+ # the CMK outside of AWS KMS. Use the GetPublicKey operation to download
5307
+ # the public key in the asymmetric CMK and then use the public key to
5308
+ # verify the signature outside of AWS KMS. The advantage of using the
5309
+ # `Verify` operation is that it is performed within AWS KMS. As a
5310
+ # result, it's easy to call, the operation is performed within the FIPS
5311
+ # boundary, it is logged in AWS CloudTrail, and you can use key policy
5312
+ # and IAM policy to determine who is authorized to use the CMK to verify
5313
+ # signatures.
5314
+ #
5315
+ # The CMK that you use for this operation must be in a compatible key
5316
+ # state. For details, see [How Key State Affects Use of a Customer
5317
+ # Master Key][2] in the *AWS Key Management Service Developer Guide*.
5318
+ #
5319
+ #
5320
+ #
5321
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html
5322
+ # [2]: https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html
5323
+ #
5324
+ # @option params [required, String] :key_id
5325
+ # Identifies the asymmetric CMK that will be used to verify the
5326
+ # signature. This must be the same CMK that was used to generate the
5327
+ # signature. If you specify a different CMK, the signature verification
5328
+ # fails.
5329
+ #
5330
+ # To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias
5331
+ # name, or alias ARN. When using an alias name, prefix it with
5332
+ # `"alias/"`. To specify a CMK in a different AWS account, you must use
5333
+ # the key ARN or alias ARN.
5334
+ #
5335
+ # For example:
5336
+ #
5337
+ # * Key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
5338
+ #
5339
+ # * Key ARN:
5340
+ # `arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`
5341
+ #
5342
+ # * Alias name: `alias/ExampleAlias`
5343
+ #
5344
+ # * Alias ARN: `arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias`
5345
+ #
5346
+ # To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
5347
+ # To get the alias name and alias ARN, use ListAliases.
5348
+ #
5349
+ # @option params [required, String, IO] :message
5350
+ # Specifies the message that was signed. You can submit a raw message of
5351
+ # up to 4096 bytes, or a hash digest of the message. If you submit a
5352
+ # digest, use the `MessageType` parameter with a value of `DIGEST`.
5353
+ #
5354
+ # If the message specified here is different from the message that was
5355
+ # signed, the signature verification fails. A message and its hash
5356
+ # digest are considered to be the same message.
5357
+ #
5358
+ # @option params [String] :message_type
5359
+ # Tells AWS KMS whether the value of the `Message` parameter is a
5360
+ # message or message digest. The default value, RAW, indicates a
5361
+ # message. To indicate a message digest, enter `DIGEST`.
5362
+ #
5363
+ # Use the `DIGEST` value only when the value of the `Message` parameter
5364
+ # is a message digest. If you use the `DIGEST` value with a raw message,
5365
+ # the security of the verification operation can be compromised.
5366
+ #
5367
+ # @option params [required, String, IO] :signature
5368
+ # The signature that the `Sign` operation generated.
5369
+ #
5370
+ # @option params [required, String] :signing_algorithm
5371
+ # The signing algorithm that was used to sign the message. If you submit
5372
+ # a different algorithm, the signature verification fails.
5373
+ #
5374
+ # @option params [Array<String>] :grant_tokens
5375
+ # A list of grant tokens.
5376
+ #
5377
+ # For more information, see [Grant Tokens][1] in the *AWS Key Management
5378
+ # Service Developer Guide*.
5379
+ #
5380
+ #
5381
+ #
5382
+ # [1]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token
5383
+ #
5384
+ # @return [Types::VerifyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
5385
+ #
5386
+ # * {Types::VerifyResponse#key_id #key_id} => String
5387
+ # * {Types::VerifyResponse#signature_valid #signature_valid} => Boolean
5388
+ # * {Types::VerifyResponse#signing_algorithm #signing_algorithm} => String
5389
+ #
5390
+ # @example Request syntax with placeholder values
5391
+ #
5392
+ # resp = client.verify({
5393
+ # key_id: "KeyIdType", # required
5394
+ # message: "data", # required
5395
+ # message_type: "RAW", # accepts RAW, DIGEST
5396
+ # signature: "data", # required
5397
+ # signing_algorithm: "RSASSA_PSS_SHA_256", # required, accepts RSASSA_PSS_SHA_256, RSASSA_PSS_SHA_384, RSASSA_PSS_SHA_512, RSASSA_PKCS1_V1_5_SHA_256, RSASSA_PKCS1_V1_5_SHA_384, RSASSA_PKCS1_V1_5_SHA_512, ECDSA_SHA_256, ECDSA_SHA_384, ECDSA_SHA_512
5398
+ # grant_tokens: ["GrantTokenType"],
5399
+ # })
5400
+ #
5401
+ # @example Response structure
5402
+ #
5403
+ # resp.key_id #=> String
5404
+ # resp.signature_valid #=> Boolean
5405
+ # resp.signing_algorithm #=> String, one of "RSASSA_PSS_SHA_256", "RSASSA_PSS_SHA_384", "RSASSA_PSS_SHA_512", "RSASSA_PKCS1_V1_5_SHA_256", "RSASSA_PKCS1_V1_5_SHA_384", "RSASSA_PKCS1_V1_5_SHA_512", "ECDSA_SHA_256", "ECDSA_SHA_384", "ECDSA_SHA_512"
5406
+ #
5407
+ # @see http://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Verify AWS API Documentation
5408
+ #
5409
+ # @overload verify(params = {})
5410
+ # @param [Hash] params ({})
5411
+ def verify(params = {}, options = {})
5412
+ req = build_request(:verify, params)
5413
+ req.send_request(options)
5414
+ end
5415
+
4050
5416
  # @!endgroup
4051
5417
 
4052
5418
  # @param params ({})
@@ -4060,7 +5426,7 @@ module Aws::KMS
4060
5426
  params: params,
4061
5427
  config: config)
4062
5428
  context[:gem_name] = 'aws-sdk-kms'
4063
- context[:gem_version] = '1.25.0'
5429
+ context[:gem_version] = '1.30.0'
4064
5430
  Seahorse::Client::Request.new(handlers, context)
4065
5431
  end
4066
5432