Copyright | (c) 2013-2023 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Verifies the hash-based message authentication code (HMAC) for a
specified message, HMAC KMS key, and MAC algorithm. To verify the HMAC,
VerifyMac
computes an HMAC using the message, HMAC KMS key, and MAC
algorithm that you specify, and compares the computed HMAC to the HMAC
that you specify. If the HMACs are identical, the verification succeeds;
otherwise, it fails. Verification indicates that the message hasn't
changed since the HMAC was calculated, and the specified key was used to
generate and verify the HMAC.
HMAC KMS keys and the HMAC algorithms that KMS uses conform to industry standards defined in RFC 2104.
This operation is part of KMS support for HMAC KMS keys. For details, see HMAC keys in KMS in the Key Management Service Developer Guide.
The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys in the Key Management Service Developer Guide.
Cross-account use: Yes. To perform this operation with a KMS key in
a different Amazon Web Services account, specify the key ARN or alias
ARN in the value of the KeyId
parameter.
Required permissions: kms:VerifyMac (key policy)
Related operations: GenerateMac
Synopsis
- data VerifyMac = VerifyMac' {
- grantTokens :: Maybe [Text]
- message :: Sensitive Base64
- keyId :: Text
- macAlgorithm :: MacAlgorithmSpec
- mac :: Base64
- newVerifyMac :: ByteString -> Text -> MacAlgorithmSpec -> ByteString -> VerifyMac
- verifyMac_grantTokens :: Lens' VerifyMac (Maybe [Text])
- verifyMac_message :: Lens' VerifyMac ByteString
- verifyMac_keyId :: Lens' VerifyMac Text
- verifyMac_macAlgorithm :: Lens' VerifyMac MacAlgorithmSpec
- verifyMac_mac :: Lens' VerifyMac ByteString
- data VerifyMacResponse = VerifyMacResponse' {}
- newVerifyMacResponse :: Int -> VerifyMacResponse
- verifyMacResponse_keyId :: Lens' VerifyMacResponse (Maybe Text)
- verifyMacResponse_macAlgorithm :: Lens' VerifyMacResponse (Maybe MacAlgorithmSpec)
- verifyMacResponse_macValid :: Lens' VerifyMacResponse (Maybe Bool)
- verifyMacResponse_httpStatus :: Lens' VerifyMacResponse Int
Creating a Request
See: newVerifyMac
smart constructor.
VerifyMac' | |
|
Instances
:: ByteString | |
-> Text | |
-> MacAlgorithmSpec | |
-> ByteString | |
-> VerifyMac |
Create a value of VerifyMac
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:grantTokens:VerifyMac'
, verifyMac_grantTokens
- A list of grant tokens.
Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the Key Management Service Developer Guide.
$sel:message:VerifyMac'
, verifyMac_message
- The message that will be used in the verification. Enter the same
message that was used to generate the HMAC.
GenerateMac and VerifyMac
do not provide special handling for message
digests. If you generated an HMAC for a hash digest of a message, you
must verify the HMAC for the same hash digest.--
-- 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.
VerifyMac
, verifyMac_keyId
- The KMS key that will be used in the verification.
Enter a key ID of the KMS key that was used to generate the HMAC. If you
identify a different KMS key, the VerifyMac
operation fails.
VerifyMac
, verifyMac_macAlgorithm
- The MAC algorithm that will be used in the verification. Enter the same
MAC algorithm that was used to compute the HMAC. This algorithm must be
supported by the HMAC KMS key identified by the KeyId
parameter.
$sel:mac:VerifyMac'
, verifyMac_mac
- The HMAC to verify. Enter the HMAC that was generated by the GenerateMac
operation when you specified the same message, HMAC KMS key, and MAC
algorithm as the values specified in this request.--
-- 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.
Request Lenses
verifyMac_grantTokens :: Lens' VerifyMac (Maybe [Text]) Source #
A list of grant tokens.
Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the Key Management Service Developer Guide.
verifyMac_message :: Lens' VerifyMac ByteString Source #
The message that will be used in the verification. Enter the same message that was used to generate the HMAC.
GenerateMac and VerifyMac
do not provide special handling for message
digests. If you generated an HMAC for a hash digest of a message, you
must verify the HMAC for the same hash digest.--
-- 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.
verifyMac_keyId :: Lens' VerifyMac Text Source #
The KMS key that will be used in the verification.
Enter a key ID of the KMS key that was used to generate the HMAC. If you
identify a different KMS key, the VerifyMac
operation fails.
verifyMac_macAlgorithm :: Lens' VerifyMac MacAlgorithmSpec Source #
The MAC algorithm that will be used in the verification. Enter the same
MAC algorithm that was used to compute the HMAC. This algorithm must be
supported by the HMAC KMS key identified by the KeyId
parameter.
verifyMac_mac :: Lens' VerifyMac ByteString Source #
The HMAC to verify. Enter the HMAC that was generated by the GenerateMac
operation when you specified the same message, HMAC KMS key, and MAC
algorithm as the values specified in this request.--
-- 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.
Destructuring the Response
data VerifyMacResponse Source #
See: newVerifyMacResponse
smart constructor.
VerifyMacResponse' | |
|
Instances
Create a value of VerifyMacResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
VerifyMac
, verifyMacResponse_keyId
- The HMAC KMS key used in the verification.
VerifyMac
, verifyMacResponse_macAlgorithm
- The MAC algorithm used in the verification.
$sel:macValid:VerifyMacResponse'
, verifyMacResponse_macValid
- A Boolean value that indicates whether the HMAC was verified. A value of
True
indicates that the HMAC (Mac
) was generated with the specified
Message
, HMAC KMS key (KeyID
) and MacAlgorithm.
.
If the HMAC is not verified, the VerifyMac
operation fails with a
KMSInvalidMacException
exception. This exception indicates that one or
more of the inputs changed since the HMAC was computed.
$sel:httpStatus:VerifyMacResponse'
, verifyMacResponse_httpStatus
- The response's http status code.
Response Lenses
verifyMacResponse_keyId :: Lens' VerifyMacResponse (Maybe Text) Source #
The HMAC KMS key used in the verification.
verifyMacResponse_macAlgorithm :: Lens' VerifyMacResponse (Maybe MacAlgorithmSpec) Source #
The MAC algorithm used in the verification.
verifyMacResponse_macValid :: Lens' VerifyMacResponse (Maybe Bool) Source #
A Boolean value that indicates whether the HMAC was verified. A value of
True
indicates that the HMAC (Mac
) was generated with the specified
Message
, HMAC KMS key (KeyID
) and MacAlgorithm.
.
If the HMAC is not verified, the VerifyMac
operation fails with a
KMSInvalidMacException
exception. This exception indicates that one or
more of the inputs changed since the HMAC was computed.
verifyMacResponse_httpStatus :: Lens' VerifyMacResponse Int Source #
The response's http status code.