| Copyright | (c) 2013-2018 Brendan Hay |
|---|---|
| License | Mozilla Public License, v. 2.0. |
| Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
| Stability | auto-generated |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.AWS.KMS.ReEncrypt
Description
Encrypts data on the server side with a new customer master key (CMK) without exposing the plaintext of the data on the client side. The data is first decrypted and then reencrypted. You can also use this operation to change the encryption context of a ciphertext.
You can reencrypt data using CMKs in different AWS accounts.
Unlike other operations, ReEncrypt is authorized twice, once as ReEncryptFrom on the source CMK and once as ReEncryptTo on the destination CMK. We recommend that you include the "kms:ReEncrypt*" permission in your key policies to permit reencryption from or to the CMK. This permission is automatically included in the key policy when you create a CMK through the console, but you must include it manually when you create a CMK programmatically or when you set a key policy with the PutKeyPolicy operation.
Synopsis
- reEncrypt :: ByteString -> Text -> ReEncrypt
- data ReEncrypt
- reDestinationEncryptionContext :: Lens' ReEncrypt (HashMap Text Text)
- reSourceEncryptionContext :: Lens' ReEncrypt (HashMap Text Text)
- reGrantTokens :: Lens' ReEncrypt [Text]
- reCiphertextBlob :: Lens' ReEncrypt ByteString
- reDestinationKeyId :: Lens' ReEncrypt Text
- reEncryptResponse :: Int -> ReEncryptResponse
- data ReEncryptResponse
- rersSourceKeyId :: Lens' ReEncryptResponse (Maybe Text)
- rersKeyId :: Lens' ReEncryptResponse (Maybe Text)
- rersCiphertextBlob :: Lens' ReEncryptResponse (Maybe ByteString)
- rersResponseStatus :: Lens' ReEncryptResponse Int
Creating a Request
Arguments
| :: ByteString | |
| -> Text | |
| -> ReEncrypt |
Creates a value of ReEncrypt with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
reDestinationEncryptionContext- Encryption context to use when the data is reencrypted.reSourceEncryptionContext- Encryption context used to encrypt and decrypt the data specified in theCiphertextBlobparameter.reGrantTokens- A list of grant tokens. For more information, see Grant Tokens in the AWS Key Management Service Developer Guide .reCiphertextBlob- Ciphertext of the data to reencrypt.-- Note: ThisLensautomatically encodes and decodes Base64 data. The underlying isomorphism will encode to Base64 representation during serialisation, and decode from Base64 representation during deserialisation. ThisLensaccepts and returns only raw unencoded data.reDestinationKeyId- A unique identifier for the CMK that is used to reencrypt the data. To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. When using an alias name, prefix it with "alias". To specify a CMK in a different AWS account, you must use the key ARN or alias ARN. For example: * Key ID:1234abcd-12ab-34cd-56ef-1234567890ab* Key ARN: @arn:aws:kms:us-east-2:111122223333:key1234abcd-12ab-34cd-56ef-1234567890ab* Alias name:aliasExampleAlias* Alias ARN:arn:aws:kms:us-east-2:111122223333:aliasExampleAlias@ To get the key ID and key ARN for a CMK, useListKeysorDescribeKey. To get the alias name and alias ARN, useListAliases.
See: reEncrypt smart constructor.
Instances
Request Lenses
reDestinationEncryptionContext :: Lens' ReEncrypt (HashMap Text Text) Source #
Encryption context to use when the data is reencrypted.
reSourceEncryptionContext :: Lens' ReEncrypt (HashMap Text Text) Source #
Encryption context used to encrypt and decrypt the data specified in the CiphertextBlob parameter.
reGrantTokens :: Lens' ReEncrypt [Text] Source #
A list of grant tokens. For more information, see Grant Tokens in the AWS Key Management Service Developer Guide .
reCiphertextBlob :: Lens' ReEncrypt ByteString Source #
Ciphertext of the data to reencrypt.-- Note: This Lens automatically encodes and decodes Base64 data. The underlying isomorphism will encode to Base64 representation during serialisation, and decode from Base64 representation during deserialisation. This Lens accepts and returns only raw unencoded data.
reDestinationKeyId :: Lens' ReEncrypt Text Source #
A unique identifier for the CMK that is used to reencrypt the data. To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. When using an alias name, prefix it with "alias". To specify a CMK in a different AWS account, you must use the key ARN or alias ARN. For example: * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab * Key ARN: @arn:aws:kms:us-east-2:111122223333:key1234abcd-12ab-34cd-56ef-1234567890ab * Alias name: aliasExampleAlias * Alias ARN: arn:aws:kms:us-east-2:111122223333:aliasExampleAlias@ To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey . To get the alias name and alias ARN, use ListAliases .
Destructuring the Response
Arguments
| :: Int | |
| -> ReEncryptResponse |
Creates a value of ReEncryptResponse with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
rersSourceKeyId- Unique identifier of the CMK used to originally encrypt the data.rersKeyId- Unique identifier of the CMK used to reencrypt the data.rersCiphertextBlob- The reencrypted data. When you use the HTTP API or the AWS CLI, the value is Base64-encoded. Otherwise, it is not encoded.-- Note: ThisLensautomatically encodes and decodes Base64 data. The underlying isomorphism will encode to Base64 representation during serialisation, and decode from Base64 representation during deserialisation. ThisLensaccepts and returns only raw unencoded data.rersResponseStatus- -- | The response status code.
data ReEncryptResponse Source #
See: reEncryptResponse smart constructor.
Instances
Response Lenses
rersSourceKeyId :: Lens' ReEncryptResponse (Maybe Text) Source #
Unique identifier of the CMK used to originally encrypt the data.
rersKeyId :: Lens' ReEncryptResponse (Maybe Text) Source #
Unique identifier of the CMK used to reencrypt the data.
rersCiphertextBlob :: Lens' ReEncryptResponse (Maybe ByteString) Source #
The reencrypted data. When you use the HTTP API or the AWS CLI, the value is Base64-encoded. Otherwise, it is not encoded.-- Note: This Lens automatically encodes and decodes Base64 data. The underlying isomorphism will encode to Base64 representation during serialisation, and decode from Base64 representation during deserialisation. This Lens accepts and returns only raw unencoded data.
rersResponseStatus :: Lens' ReEncryptResponse Int Source #
- - | The response status code.