IAmazonKeyManagementService.Encrypt (EncryptRequest)

Method

Encrypts plaintext into ciphertext by using a customer master key. The Encrypt
function has two primary use cases:

You can encrypt up to 4 KB of arbitrary
data such as an RSA key, a database password, or other sensitive customer information.

If you are moving encrypted data from one region to another, you can use this
API to encrypt in the new region the plaintext data key that was used to encrypt the
data in the original region. This provides you with an encrypted copy of the data
key that can be decrypted in the new region and used there to decrypt the encrypted
data.

Unless you are moving encrypted data from one region to another, you don't use this
function to encrypt a generated data key within a region. You retrieve data keys already
encrypted by calling the GenerateDataKey or GenerateDataKeyWithoutPlaintext
function. Data keys don't need to be encrypted again by calling Encrypt.

If you want to encrypt data locally in your application, you can use the GenerateDataKey
function to return a plaintext data encryption key and a copy of the key encrypted
under the customer master key (CMK) of your choosing.

The request was rejected because the state of the specified resource is not valid
for this request.
For more information about how key state affects the use of a customer master key
(CMK), go to How
Key State Affects the Use of a Customer Master Key in the AWS Key Management
Service Developer Guide.