Skip to main content

Verify

Verifies a digital signature that was generated by the Sign operation.

Description

The `Verify` operation uses an asymmetric KMS key to verify a digital signature. This operation is the complement of the `Sign` operation. If the signature is valid, the `Verify` operation returns a `SignatureValid` value of `true`. If the signature is not valid, the operation returns a `SignatureValid` value of `false`.

note
  • The KMS key must be asymmetric and its `KeyUsage` must be `SIGN_VERIFY`.
  • The maximum message size is 4096 bytes.
  • The message type and signing algorithm must match those used in the Sign request.
  • You can also verify the signature outside of QKMS using the public key.

Request Syntax

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.Verify
{ "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "Message": "SGVsbG8gV29ybGQ=", "MessageType": "RAW", "Signature": "Base64-encoded signature", "SigningAlgorithm": "RSASSA_PSS_SHA_256" }
Values in italics indicate user input and should be replaced with actual values.

Request Parameters

Headers

NameDescriptionRequiredType
Content-TypeMust be "application/x-amz-json-1.1"Yesstring
X-Amz-TargetMust be "TrentService.Verify"Yesstring

Request Body

NameDescriptionRequiredType
KeyIdIdentifies the asymmetric KMS key that will be used to verify the signature. This must be the ID or ARN of an asymmetric KMS key with a KeyUsage of SIGN_VERIFY.Yesstring
MessageThe message that was signed. Specify the same message that was specified in the Sign request.Yesblob
MessageTypeSpecifies the type of the message. Valid values are RAW or DIGEST.Nostring
SignatureThe signature that you want to verify. Pass in the value of the Signature field that was returned by the Sign operation.Yesblob
SigningAlgorithmThe signing algorithm that was used to sign the message. This must be the same algorithm that was used in the Sign request.Yesstring
GrantTokensA list of grant tokens. Use grant tokens when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency.Noarray

Examples

Example 1: Verify a signature using RSA

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.Verify
{ "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "Message": "SGVsbG8gV29ybGQ=", "MessageType": "RAW", "Signature": "Base64-encoded signature", "SigningAlgorithm": "RSASSA_PSS_SHA_256" }
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
{ "KeyId": "arn:verenc:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", "SignatureValid": true, "SigningAlgorithm": "RSASSA_PSS_SHA_256" }
Values in italics indicate variable response values.

Example 2: Verify a signature of a message digest using ECC

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.Verify
{ "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "Message": "Base64-encoded message digest", "MessageType": "DIGEST", "Signature": "Base64-encoded signature", "SigningAlgorithm": "ECDSA_SHA_384" }
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
{ "KeyId": "arn:verenc:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", "SignatureValid": true, "SigningAlgorithm": "ECDSA_SHA_384" }
Values in italics indicate variable response values.

Response Syntax

HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
{ "KeyId": "string", "SignatureValid": "boolean", "SigningAlgorithm": "string" }
Values in italics indicate variable response values.

Response Elements

NameDescriptionRequiredType
KeyIdThe Amazon Resource Name (ARN) of the asymmetric KMS key that was used to verify the signature.NoString
SignatureValidA Boolean value that indicates whether the signature is valid.NoString
SigningAlgorithmThe signing algorithm that was used to verify the signature.NoString

Special Errors

Error CodeDescription
DependencyTimeoutExceptionThe system timed out while trying to fulfill the request.
DisabledExceptionThe request was rejected because the specified KMS key is disabled.
InvalidKeyUsageExceptionThe request was rejected because the specified KeyId value cannot be used for this operation.
KeyUnavailableExceptionThe request was rejected because the specified KMS key was not available.
KMSInternalExceptionThe request was rejected because an internal error occurred.
KMSInvalidStateExceptionThe request was rejected because the key state is not valid for this operation.
NotFoundExceptionThe request was rejected because the specified entity or resource could not be found.
SignatureInvalidExceptionThe request was rejected because the signature verification failed.

Permissions

To use the `Verify` operation, you must have the following permissions:

  • `kms:Verify` on the KMS key (specified in the policy)

Try It Out

Test Verify

Verify a digital signature for a message or message digest.

Coming Soon

This feature is currently under development and will be available soon.